cancel axios adapter
This commit is contained in:
parent
0c50ebcc2c
commit
d973d8437f
614
package-lock.json
generated
614
package-lock.json
generated
@ -24,9 +24,7 @@
|
||||
"ws": "^8.18.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@esbuild/win32-x64": "^0.25.5",
|
||||
"@rollup/plugin-inject": "^5.0.5",
|
||||
"@rollup/rollup-win32-x64-msvc": "^4.41.1",
|
||||
"@types/node": "^22.15.29",
|
||||
"@types/pako": "^2.0.3",
|
||||
"@types/showdown": "^2.0.0",
|
||||
@ -39,6 +37,7 @@
|
||||
"turbo": "^2.5.3",
|
||||
"typescript": "^5.4.2",
|
||||
"vite": "^6.3.5",
|
||||
"vite-plugin-dts": "^4.5.4",
|
||||
"vite-plugin-static-copy": "^3.0.0",
|
||||
"vite-plugin-vue-devtools": "^7.7.6",
|
||||
"vue-tsc": "^2.2.10",
|
||||
@ -956,21 +955,6 @@
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-x64": {
|
||||
"version": "0.25.5",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.25.5.tgz",
|
||||
"integrity": "sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@floating-ui/core": {
|
||||
"version": "1.7.0",
|
||||
"license": "MIT",
|
||||
@ -1110,6 +1094,153 @@
|
||||
"version": "1.0.2",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@microsoft/api-extractor": {
|
||||
"version": "7.52.8",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.52.8.tgz",
|
||||
"integrity": "sha512-cszYIcjiNscDoMB1CIKZ3My61+JOhpERGlGr54i6bocvGLrcL/wo9o+RNXMBrb7XgLtKaizZWUpqRduQuHQLdg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@microsoft/api-extractor-model": "7.30.6",
|
||||
"@microsoft/tsdoc": "~0.15.1",
|
||||
"@microsoft/tsdoc-config": "~0.17.1",
|
||||
"@rushstack/node-core-library": "5.13.1",
|
||||
"@rushstack/rig-package": "0.5.3",
|
||||
"@rushstack/terminal": "0.15.3",
|
||||
"@rushstack/ts-command-line": "5.0.1",
|
||||
"lodash": "~4.17.15",
|
||||
"minimatch": "~3.0.3",
|
||||
"resolve": "~1.22.1",
|
||||
"semver": "~7.5.4",
|
||||
"source-map": "~0.6.1",
|
||||
"typescript": "5.8.2"
|
||||
},
|
||||
"bin": {
|
||||
"api-extractor": "bin/api-extractor"
|
||||
}
|
||||
},
|
||||
"node_modules/@microsoft/api-extractor-model": {
|
||||
"version": "7.30.6",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.30.6.tgz",
|
||||
"integrity": "sha512-znmFn69wf/AIrwHya3fxX6uB5etSIn6vg4Q4RB/tb5VDDs1rqREc+AvMC/p19MUN13CZ7+V/8pkYPTj7q8tftg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@microsoft/tsdoc": "~0.15.1",
|
||||
"@microsoft/tsdoc-config": "~0.17.1",
|
||||
"@rushstack/node-core-library": "5.13.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@microsoft/api-extractor/node_modules/lru-cache": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@microsoft/api-extractor/node_modules/minimatch": {
|
||||
"version": "3.0.8",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz",
|
||||
"integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@microsoft/api-extractor/node_modules/semver": {
|
||||
"version": "7.5.4",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"lru-cache": "^6.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@microsoft/api-extractor/node_modules/source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@microsoft/api-extractor/node_modules/typescript": {
|
||||
"version": "5.8.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz",
|
||||
"integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/@microsoft/api-extractor/node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/@microsoft/tsdoc": {
|
||||
"version": "0.15.1",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.15.1.tgz",
|
||||
"integrity": "sha512-4aErSrCR/On/e5G2hDP0wjooqDdauzEbIq8hIkIe5pXV0rtWJZvdCEKL0ykZxex+IxIwBp0eGeV48hQN07dXtw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@microsoft/tsdoc-config": {
|
||||
"version": "0.17.1",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.17.1.tgz",
|
||||
"integrity": "sha512-UtjIFe0C6oYgTnad4q1QP4qXwLhe6tIpNTRStJ2RZEPIkqQPREAwE5spzVxsdn9UaEMUqhh0AqSx3X4nWAKXWw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@microsoft/tsdoc": "0.15.1",
|
||||
"ajv": "~8.12.0",
|
||||
"jju": "~1.4.0",
|
||||
"resolve": "~1.22.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@microsoft/tsdoc-config/node_modules/ajv": {
|
||||
"version": "8.12.0",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz",
|
||||
"integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"json-schema-traverse": "^1.0.0",
|
||||
"require-from-string": "^2.0.2",
|
||||
"uri-js": "^4.2.2"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/epoberezkin"
|
||||
}
|
||||
},
|
||||
"node_modules/@modelcontextprotocol/sdk": {
|
||||
"version": "1.12.1",
|
||||
"license": "MIT",
|
||||
@ -1519,17 +1650,185 @@
|
||||
"win32"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-win32-x64-msvc": {
|
||||
"version": "4.41.1",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.41.1.tgz",
|
||||
"integrity": "sha512-Wq2zpapRYLfi4aKxf2Xff0tN+7slj2d4R87WEzqw7ZLsVvO5zwYCIuEGSZYiK41+GlwUo1HiR+GdkLEJnCKTCw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"node_modules/@rushstack/node-core-library": {
|
||||
"version": "5.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-5.13.1.tgz",
|
||||
"integrity": "sha512-5yXhzPFGEkVc9Fu92wsNJ9jlvdwz4RNb2bMso+/+TH0nMm1jDDDsOIf4l8GAkPxGuwPw5DH24RliWVfSPhlW/Q==",
|
||||
"dev": true,
|
||||
"os": [
|
||||
"win32"
|
||||
]
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ajv": "~8.13.0",
|
||||
"ajv-draft-04": "~1.0.0",
|
||||
"ajv-formats": "~3.0.1",
|
||||
"fs-extra": "~11.3.0",
|
||||
"import-lazy": "~4.0.0",
|
||||
"jju": "~1.4.0",
|
||||
"resolve": "~1.22.1",
|
||||
"semver": "~7.5.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/node": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/node": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/node-core-library/node_modules/ajv": {
|
||||
"version": "8.13.0",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.13.0.tgz",
|
||||
"integrity": "sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"json-schema-traverse": "^1.0.0",
|
||||
"require-from-string": "^2.0.2",
|
||||
"uri-js": "^4.4.1"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/epoberezkin"
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/node-core-library/node_modules/ajv-formats": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz",
|
||||
"integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ajv": "^8.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"ajv": "^8.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"ajv": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/node-core-library/node_modules/fs-extra": {
|
||||
"version": "11.3.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz",
|
||||
"integrity": "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.2.0",
|
||||
"jsonfile": "^6.0.1",
|
||||
"universalify": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/node-core-library/node_modules/lru-cache": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/node-core-library/node_modules/semver": {
|
||||
"version": "7.5.4",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"lru-cache": "^6.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/node-core-library/node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/@rushstack/rig-package": {
|
||||
"version": "0.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.5.3.tgz",
|
||||
"integrity": "sha512-olzSSjYrvCNxUFZowevC3uz8gvKr3WTpHQ7BkpjtRpA3wK+T0ybep/SRUMfr195gBzJm5gaXw0ZMgjIyHqJUow==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"resolve": "~1.22.1",
|
||||
"strip-json-comments": "~3.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/terminal": {
|
||||
"version": "0.15.3",
|
||||
"resolved": "https://registry.npmjs.org/@rushstack/terminal/-/terminal-0.15.3.tgz",
|
||||
"integrity": "sha512-DGJ0B2Vm69468kZCJkPj3AH5nN+nR9SPmC0rFHtzsS4lBQ7/dgOwtwVxYP7W9JPDMuRBkJ4KHmWKr036eJsj9g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@rushstack/node-core-library": "5.13.1",
|
||||
"supports-color": "~8.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/node": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/node": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/terminal/node_modules/supports-color": {
|
||||
"version": "8.1.1",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
|
||||
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"has-flag": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/supports-color?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/ts-command-line": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-5.0.1.tgz",
|
||||
"integrity": "sha512-bsbUucn41UXrQK7wgM8CNM/jagBytEyJqXw/umtI8d68vFm1Jwxh1OtLrlW7uGZgjCWiiPH6ooUNa1aVsuVr3Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@rushstack/terminal": "0.15.3",
|
||||
"@types/argparse": "1.0.38",
|
||||
"argparse": "~1.0.9",
|
||||
"string-argv": "~0.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/ts-command-line/node_modules/argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"sprintf-js": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@seald-io/binary-search-tree": {
|
||||
"version": "1.0.3"
|
||||
@ -1564,6 +1863,13 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/argparse": {
|
||||
"version": "1.0.38",
|
||||
"resolved": "https://registry.npmjs.org/@types/argparse/-/argparse-1.0.38.tgz",
|
||||
"integrity": "sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/body-parser": {
|
||||
"version": "1.19.5",
|
||||
"dev": true,
|
||||
@ -2380,6 +2686,21 @@
|
||||
"url": "https://github.com/sponsors/epoberezkin"
|
||||
}
|
||||
},
|
||||
"node_modules/ajv-draft-04": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz",
|
||||
"integrity": "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"ajv": "^8.5.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"ajv": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/ajv-formats": {
|
||||
"version": "2.1.1",
|
||||
"dev": true,
|
||||
@ -2834,11 +3155,25 @@
|
||||
"node": ">= 12"
|
||||
}
|
||||
},
|
||||
"node_modules/compare-versions": {
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-6.1.1.tgz",
|
||||
"integrity": "sha512-4hm4VPpIecmlg59CHXnRDnqGplJFrbLG4aFEl5vl6cK1u76ws3LLvX7ikFnTDl5vo39sjWD6AaDPYodJp/NNHg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/concat-map": {
|
||||
"version": "0.0.1",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/confbox": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/confbox/-/confbox-0.2.2.tgz",
|
||||
"integrity": "sha512-1NB+BKqhtNipMsov4xI/NnhCKp9XG9NamYp5PVm9klAT0fsrNPjaFICsCFhNhwZJKNh7zB/3q8qXz0E9oaMNtQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/content-disposition": {
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
@ -3788,6 +4123,13 @@
|
||||
"express": "^4.11 || 5 || ^5.0.0-beta.1"
|
||||
}
|
||||
},
|
||||
"node_modules/exsolve": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/exsolve/-/exsolve-1.0.5.tgz",
|
||||
"integrity": "sha512-pz5dvkYYKQ1AHVrgOzBKWeP4u4FRb3a6DNK2ucr0OoNwYIU4QWsJ+NM36LLzORT+z845MzKHHhpXiUF5nvQoJg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fast-copy": {
|
||||
"version": "3.0.2",
|
||||
"license": "MIT"
|
||||
@ -4393,6 +4735,16 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/import-lazy": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-4.0.0.tgz",
|
||||
"integrity": "sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/import-local": {
|
||||
"version": "3.2.0",
|
||||
"dev": true,
|
||||
@ -4709,6 +5061,13 @@
|
||||
"url": "https://github.com/chalk/supports-color?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/jju": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz",
|
||||
"integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/joycon": {
|
||||
"version": "3.1.1",
|
||||
"license": "MIT",
|
||||
@ -4842,6 +5201,24 @@
|
||||
"node": ">=8.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/local-pkg": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-1.1.1.tgz",
|
||||
"integrity": "sha512-WunYko2W1NcdfAFpuLUoucsgULmgDBRkdxHxWQ7mK0cQqwPiy8E1enjuRBrhLtZkB5iScJ1XIPdhVEFK8aOLSg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mlly": "^1.7.4",
|
||||
"pkg-types": "^2.0.1",
|
||||
"quansync": "^0.2.8"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/antfu"
|
||||
}
|
||||
},
|
||||
"node_modules/localforage": {
|
||||
"version": "1.10.0",
|
||||
"license": "Apache-2.0",
|
||||
@ -5045,6 +5422,38 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/mlly": {
|
||||
"version": "1.7.4",
|
||||
"resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.4.tgz",
|
||||
"integrity": "sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"acorn": "^8.14.0",
|
||||
"pathe": "^2.0.1",
|
||||
"pkg-types": "^1.3.0",
|
||||
"ufo": "^1.5.4"
|
||||
}
|
||||
},
|
||||
"node_modules/mlly/node_modules/confbox": {
|
||||
"version": "0.1.8",
|
||||
"resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz",
|
||||
"integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/mlly/node_modules/pkg-types": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz",
|
||||
"integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"confbox": "^0.1.8",
|
||||
"mlly": "^1.7.4",
|
||||
"pathe": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/mrmime": {
|
||||
"version": "2.0.1",
|
||||
"dev": true,
|
||||
@ -5781,6 +6190,18 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/pkg-types": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-2.1.0.tgz",
|
||||
"integrity": "sha512-wmJwA+8ihJixSoHKxZJRBQG1oY8Yr9pGLzRmSsNms0iNWyHHAlZCa7mmKiFR10YPZuz/2k169JiS/inOjBCZ2A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"confbox": "^0.2.1",
|
||||
"exsolve": "^1.0.1",
|
||||
"pathe": "^2.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/possible-typed-array-names": {
|
||||
"version": "1.1.0",
|
||||
"license": "MIT",
|
||||
@ -5929,6 +6350,23 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/quansync": {
|
||||
"version": "0.2.10",
|
||||
"resolved": "https://registry.npmjs.org/quansync/-/quansync-0.2.10.tgz",
|
||||
"integrity": "sha512-t41VRkMYbkHyCYmOvx/6URnN80H7k4X0lLdBMGsz+maAwrJQYB1djpV6vHrQIBE0WBSGqhtEHrK9U3DWWH8v7A==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/antfu"
|
||||
},
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/sxzz"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/quick-format-unescaped": {
|
||||
"version": "4.0.4",
|
||||
"license": "MIT"
|
||||
@ -6594,6 +7032,13 @@
|
||||
"node": ">= 10.x"
|
||||
}
|
||||
},
|
||||
"node_modules/sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/statuses": {
|
||||
"version": "2.0.1",
|
||||
"license": "MIT",
|
||||
@ -6601,6 +7046,16 @@
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/string-argv": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz",
|
||||
"integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.6.19"
|
||||
}
|
||||
},
|
||||
"node_modules/string-width": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||
@ -6959,6 +7414,13 @@
|
||||
"version": "2.1.0",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/ufo": {
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.1.tgz",
|
||||
"integrity": "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/undefsafe": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
|
||||
@ -7134,6 +7596,91 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-dts": {
|
||||
"version": "4.5.4",
|
||||
"resolved": "https://registry.npmjs.org/vite-plugin-dts/-/vite-plugin-dts-4.5.4.tgz",
|
||||
"integrity": "sha512-d4sOM8M/8z7vRXHHq/ebbblfaxENjogAAekcfcDCCwAyvGqnPrc7f4NZbvItS+g4WTgerW0xDwSz5qz11JT3vg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@microsoft/api-extractor": "^7.50.1",
|
||||
"@rollup/pluginutils": "^5.1.4",
|
||||
"@volar/typescript": "^2.4.11",
|
||||
"@vue/language-core": "2.2.0",
|
||||
"compare-versions": "^6.1.1",
|
||||
"debug": "^4.4.0",
|
||||
"kolorist": "^1.8.0",
|
||||
"local-pkg": "^1.0.0",
|
||||
"magic-string": "^0.30.17"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "*",
|
||||
"vite": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"vite": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-dts/node_modules/@vue/language-core": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@vue/language-core/-/language-core-2.2.0.tgz",
|
||||
"integrity": "sha512-O1ZZFaaBGkKbsRfnVH1ifOK1/1BUkyK+3SQsfnh6PmMmD4qJcTU8godCeA96jjDRTL6zgnK7YzCHfaUlH2r0Mw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@volar/language-core": "~2.4.11",
|
||||
"@vue/compiler-dom": "^3.5.0",
|
||||
"@vue/compiler-vue2": "^2.7.16",
|
||||
"@vue/shared": "^3.5.0",
|
||||
"alien-signals": "^0.4.9",
|
||||
"minimatch": "^9.0.3",
|
||||
"muggle-string": "^0.4.1",
|
||||
"path-browserify": "^1.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-dts/node_modules/alien-signals": {
|
||||
"version": "0.4.14",
|
||||
"resolved": "https://registry.npmjs.org/alien-signals/-/alien-signals-0.4.14.tgz",
|
||||
"integrity": "sha512-itUAVzhczTmP2U5yX67xVpsbbOiquusbWVyA9N+sy6+r6YVbFkahXvNCeEPWEOMhwDYwbVbGHFkVL03N9I5g+Q==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/vite-plugin-dts/node_modules/brace-expansion": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
||||
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-dts/node_modules/minimatch": {
|
||||
"version": "9.0.5",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
|
||||
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"brace-expansion": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-inspect": {
|
||||
"version": "0.8.9",
|
||||
"dev": true,
|
||||
@ -7731,6 +8278,7 @@
|
||||
"@codemirror/autocomplete": "^6.18.6",
|
||||
"@codemirror/lang-json": "^6.0.1",
|
||||
"@codemirror/theme-one-dark": "^6.1.2",
|
||||
"chalk": "^5.4.1",
|
||||
"codemirror": "^6.0.1",
|
||||
"core-js": "^3.8.3",
|
||||
"element-plus": "^2.9.9",
|
||||
@ -7773,6 +8321,18 @@
|
||||
"vue-tsc": "^2.2.8"
|
||||
}
|
||||
},
|
||||
"renderer/node_modules/chalk": {
|
||||
"version": "5.4.1",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz",
|
||||
"integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^12.17.0 || ^14.13 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||
}
|
||||
},
|
||||
"renderer/node_modules/openai": {
|
||||
"version": "4.104.0",
|
||||
"license": "Apache-2.0",
|
||||
|
@ -244,9 +244,7 @@
|
||||
"ws": "^8.18.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@esbuild/win32-x64": "^0.25.5",
|
||||
"@rollup/plugin-inject": "^5.0.5",
|
||||
"@rollup/rollup-win32-x64-msvc": "^4.41.1",
|
||||
"@types/node": "^22.15.29",
|
||||
"@types/pako": "^2.0.3",
|
||||
"@types/showdown": "^2.0.0",
|
||||
@ -259,6 +257,7 @@
|
||||
"turbo": "^2.5.3",
|
||||
"typescript": "^5.4.2",
|
||||
"vite": "^6.3.5",
|
||||
"vite-plugin-dts": "^4.5.4",
|
||||
"vite-plugin-static-copy": "^3.0.0",
|
||||
"vite-plugin-vue-devtools": "^7.7.6",
|
||||
"vue-tsc": "^2.2.10",
|
||||
|
@ -19,6 +19,7 @@
|
||||
"@codemirror/autocomplete": "^6.18.6",
|
||||
"@codemirror/lang-json": "^6.0.1",
|
||||
"@codemirror/theme-one-dark": "^6.1.2",
|
||||
"chalk": "^5.4.1",
|
||||
"codemirror": "^6.0.1",
|
||||
"core-js": "^3.8.3",
|
||||
"element-plus": "^2.9.9",
|
||||
|
@ -8,6 +8,8 @@ if (fs.existsSync(targetFile)) {
|
||||
// Replace element-plus with ./tools.js
|
||||
content = content.replace(/'element-plus'/g, "'./tools.js'");
|
||||
content = content.replace(/"element-plus"/g, "\"./tools.js\"");
|
||||
|
||||
content = content.replace(/const chalk = require\("chalk"\);/g, 'const chalk = require("chalk").default;');
|
||||
|
||||
// Replace define_window_default$number.performance with performance
|
||||
content = content.replace(/define_window_default\$\d+\.performance/g, 'performance');
|
||||
|
@ -62,8 +62,6 @@ function deserializeToolCallResponse(toolArgs: string) {
|
||||
|
||||
function handleToolResponse(toolResponse: ToolCallResponse) {
|
||||
if (typeof toolResponse === 'string') {
|
||||
// 如果是 string,说明是错误信息
|
||||
redLog('error happen' + JSON.stringify(toolResponse));
|
||||
|
||||
return {
|
||||
content: [{
|
||||
|
@ -4,7 +4,7 @@ import { type ToolCall, type ChatStorage, getToolSchema, MessageState } from "..
|
||||
import { useMessageBridge, MessageBridge, createMessageBridge } from "@/api/message-bridge";
|
||||
import type { OpenAI } from 'openai';
|
||||
import { llmManager, llms, type BasicLlmDescription } from "@/views/setting/llm";
|
||||
import { pinkLog, redLog } from "@/views/setting/util";
|
||||
import { redLog } from "@/views/setting/util";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { getToolCallIndexAdapter, handleToolCalls, type IToolCallIndex, type ToolCallResult } from "./handle-tool-calls";
|
||||
import { getPlatform } from "@/api/platform";
|
||||
@ -12,6 +12,7 @@ import { getSystemPrompt } from "../chat-box/options/system-prompt";
|
||||
import { mcpSetting } from "@/hook/mcp";
|
||||
import { mcpClientAdapter } from "@/views/connect/core";
|
||||
import type { ToolItem } from "@/hook/type";
|
||||
import chalk from 'chalk';
|
||||
|
||||
export type ChatCompletionChunk = OpenAI.Chat.Completions.ChatCompletionChunk;
|
||||
export type ChatCompletionCreateParamsBase = OpenAI.Chat.Completions.ChatCompletionCreateParams & { id?: string, proxyServer?: string };
|
||||
@ -19,6 +20,7 @@ export interface TaskLoopOptions {
|
||||
maxEpochs?: number;
|
||||
maxJsonParseRetry?: number;
|
||||
adapter?: any;
|
||||
verbose?: 0 | 1 | 2 | 3;
|
||||
}
|
||||
|
||||
export interface IErrorMssage {
|
||||
@ -40,12 +42,12 @@ export class TaskLoop {
|
||||
private streamingToolCalls: Ref<ToolCall[]>;
|
||||
|
||||
private currentChatId = '';
|
||||
private onError: (error: IErrorMssage) => void = (msg) => {};
|
||||
private onChunk: (chunk: ChatCompletionChunk) => void = (chunk) => {};
|
||||
private onDone: () => void = () => {};
|
||||
private onError: (error: IErrorMssage) => void = (msg) => { };
|
||||
private onChunk: (chunk: ChatCompletionChunk) => void = (chunk) => { };
|
||||
private onDone: () => void = () => { };
|
||||
private onToolCall: (toolCall: ToolCall) => ToolCall = toolCall => toolCall;
|
||||
private onToolCalled: (toolCallResult: ToolCallResult) => ToolCallResult = toolCallResult => toolCallResult;
|
||||
private onEpoch: () => void = () => {};
|
||||
private onEpoch: () => void = () => { };
|
||||
private completionUsage: ChatCompletionChunk['usage'] | undefined;
|
||||
private llmConfig?: BasicLlmDescription;
|
||||
|
||||
@ -55,7 +57,12 @@ export class TaskLoop {
|
||||
};
|
||||
|
||||
constructor(
|
||||
private readonly taskOptions: TaskLoopOptions = { maxEpochs: 20, maxJsonParseRetry: 3, adapter: undefined },
|
||||
private readonly taskOptions: TaskLoopOptions = {
|
||||
maxEpochs: 20,
|
||||
maxJsonParseRetry: 3,
|
||||
adapter: undefined,
|
||||
verbose: 0
|
||||
},
|
||||
) {
|
||||
this.streamingContent = ref('');
|
||||
this.streamingToolCalls = ref([]);
|
||||
@ -87,7 +94,7 @@ export class TaskLoop {
|
||||
|
||||
private handleChunkDeltaToolCalls(chunk: ChatCompletionChunk, toolcallIndexAdapter: (toolCall: ToolCall) => IToolCallIndex) {
|
||||
const toolCall = chunk.choices[0]?.delta?.tool_calls?.[0];
|
||||
|
||||
|
||||
if (toolCall) {
|
||||
if (toolCall.index === undefined || toolCall.index === null) {
|
||||
console.warn('tool_call.index is undefined or null');
|
||||
@ -118,12 +125,12 @@ export class TaskLoop {
|
||||
currentCall.function!.name = toolCall.function.name;
|
||||
}
|
||||
if (toolCall.function?.arguments) {
|
||||
currentCall.function!.arguments += toolCall.function.arguments;
|
||||
currentCall.function!.arguments += toolCall.function.arguments;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private handleChunkUsage(chunk: ChatCompletionChunk) {
|
||||
@ -144,12 +151,13 @@ export class TaskLoop {
|
||||
this.handleChunkDeltaContent(chunk);
|
||||
this.handleChunkDeltaToolCalls(chunk, toolcallIndexAdapter);
|
||||
this.handleChunkUsage(chunk);
|
||||
|
||||
this.onChunk(chunk);
|
||||
|
||||
this.consumeChunks(chunk);
|
||||
}, { once: false });
|
||||
|
||||
const doneHandler = this.bridge.addCommandListener('llm/chat/completions/done', data => {
|
||||
this.onDone();
|
||||
|
||||
const doneHandler = this.bridge.addCommandListener('llm/chat/completions/done', data => {
|
||||
this.consumeDones();
|
||||
|
||||
chunkHandler();
|
||||
errorHandler();
|
||||
|
||||
@ -159,7 +167,7 @@ export class TaskLoop {
|
||||
}, { once: true });
|
||||
|
||||
const errorHandler = this.bridge.addCommandListener('llm/chat/completions/error', data => {
|
||||
this.onError({
|
||||
this.consumeErrors({
|
||||
state: MessageState.ReceiveChunkError,
|
||||
msg: data.msg || '请求模型服务时发生错误'
|
||||
});
|
||||
@ -187,16 +195,16 @@ export class TaskLoop {
|
||||
public makeChatData(tabStorage: ChatStorage): ChatCompletionCreateParamsBase | undefined {
|
||||
const baseURL = this.getLlmConfig().baseUrl;
|
||||
const apiKey = this.getLlmConfig().userToken || '';
|
||||
|
||||
|
||||
if (apiKey.trim() === '') {
|
||||
|
||||
|
||||
if (tabStorage.messages.length > 0 && tabStorage.messages[tabStorage.messages.length - 1].role === 'user') {
|
||||
tabStorage.messages.pop();
|
||||
ElMessage.error('请先设置 API Key');
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
const model = this.getLlmConfig().userModel;
|
||||
const temperature = tabStorage.settings.temperature;
|
||||
const tools = getToolSchema(tabStorage.settings.enableTools);
|
||||
@ -209,7 +217,7 @@ export class TaskLoop {
|
||||
// 但是在 UI 模式下,systemPrompt 只是一个 index,需要从后端数据库中获取真实 prompt
|
||||
if (tabStorage.settings.systemPrompt) {
|
||||
const prompt = getSystemPrompt(tabStorage.settings.systemPrompt) || tabStorage.settings.systemPrompt;
|
||||
|
||||
|
||||
userMessages.push({
|
||||
role: 'system',
|
||||
content: prompt
|
||||
@ -260,7 +268,7 @@ export class TaskLoop {
|
||||
public registerOnChunk(handler: (chunk: ChatCompletionChunk) => void) {
|
||||
this.onChunk = handler;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 注册 chat.completion 完成时触发的回调函数
|
||||
* @param handler
|
||||
@ -293,6 +301,100 @@ export class TaskLoop {
|
||||
this.onToolCalled = handler;
|
||||
}
|
||||
|
||||
private consumeErrors(error: IErrorMssage) {
|
||||
const { verbose = 0 } = this.taskOptions;
|
||||
if (verbose > 0) {
|
||||
console.log(
|
||||
chalk.gray(`[${new Date().toLocaleString()}]`),
|
||||
chalk.red('error happen in task loop '),
|
||||
chalk.red(error.msg)
|
||||
);
|
||||
}
|
||||
return this.onError(error);
|
||||
}
|
||||
|
||||
private consumeChunks(chunk: ChatCompletionChunk) {
|
||||
const { verbose = 0 } = this.taskOptions;
|
||||
if (verbose > 1) {
|
||||
console.log(
|
||||
chalk.gray(`[${new Date().toLocaleString()}]`),
|
||||
chalk.blue('receive chunk')
|
||||
);
|
||||
} else if (verbose > 2) {
|
||||
const delta = chunk.choices[0]?.delta;
|
||||
if (delta) {
|
||||
console.log(
|
||||
chalk.gray(`[${new Date().toLocaleString()}]`),
|
||||
chalk.blue('receive chunk'),
|
||||
chalk.bold(JSON.stringify(delta, null, 2))
|
||||
);
|
||||
} else {
|
||||
console.log(
|
||||
chalk.gray(`[${new Date().toLocaleString()}]`),
|
||||
chalk.blue('receive chunk'),
|
||||
chalk.blue('delta is empty')
|
||||
);
|
||||
}
|
||||
}
|
||||
return this.onChunk(chunk);
|
||||
}
|
||||
|
||||
private consumeToolCalls(toolCall: ToolCall) {
|
||||
const { verbose = 0 } = this.taskOptions;
|
||||
|
||||
if (verbose > 0) {
|
||||
console.log(
|
||||
chalk.gray(`[${new Date().toLocaleString()}]`),
|
||||
chalk.blueBright('🔧 calling tool'),
|
||||
chalk.blueBright(toolCall.function!.name)
|
||||
);
|
||||
}
|
||||
|
||||
return this.onToolCall(toolCall);
|
||||
}
|
||||
|
||||
private consumeToolCalleds(result: ToolCallResult) {
|
||||
const { verbose = 0 } = this.taskOptions;
|
||||
if (verbose > 0) {
|
||||
if (result.state === 'success') {
|
||||
console.log(
|
||||
chalk.gray(`[${new Date().toLocaleString()}]`),
|
||||
chalk.green('✓ call tools okey dockey'),
|
||||
chalk.green(result.state)
|
||||
);
|
||||
} else {
|
||||
console.log(
|
||||
chalk.gray(`[${new Date().toLocaleString()}]`),
|
||||
chalk.red('× fail to call tools'),
|
||||
chalk.red(result.content.map(item => item.text).join(', '))
|
||||
);
|
||||
}
|
||||
}
|
||||
return this.onToolCalled(result);
|
||||
}
|
||||
|
||||
private consumeEpochs() {
|
||||
const { verbose = 0 } = this.taskOptions;
|
||||
if (verbose > 0) {
|
||||
console.log(
|
||||
chalk.gray(`[${new Date().toLocaleString()}]`),
|
||||
chalk.blue('task loop enters a new epoch')
|
||||
);
|
||||
}
|
||||
return this.onEpoch();
|
||||
}
|
||||
|
||||
private consumeDones() {
|
||||
const { verbose = 0 } = this.taskOptions;
|
||||
if (verbose > 0) {
|
||||
console.log(
|
||||
chalk.gray(`[${new Date().toLocaleString()}]`),
|
||||
chalk.green('task loop finish a epoch')
|
||||
);
|
||||
}
|
||||
return this.onDone();
|
||||
}
|
||||
|
||||
public setMaxEpochs(maxEpochs: number) {
|
||||
this.taskOptions.maxEpochs = maxEpochs;
|
||||
}
|
||||
@ -356,7 +458,7 @@ export class TaskLoop {
|
||||
|
||||
const platform = getPlatform();
|
||||
if (platform === 'nodejs') {
|
||||
// 等待连接完成
|
||||
// 等待连接完成
|
||||
await this.nodejsStatus.connectionFut;
|
||||
}
|
||||
|
||||
@ -372,11 +474,14 @@ export class TaskLoop {
|
||||
});
|
||||
|
||||
let jsonParseErrorRetryCount = 0;
|
||||
const maxEpochs = this.taskOptions.maxEpochs || 20;
|
||||
const {
|
||||
maxEpochs = 20,
|
||||
verbose = 0
|
||||
} = this.taskOptions || {};
|
||||
|
||||
for (let i = 0; i < maxEpochs; ++ i) {
|
||||
for (let i = 0; i < maxEpochs; ++i) {
|
||||
|
||||
this.onEpoch();
|
||||
this.consumeEpochs();
|
||||
|
||||
// 初始累计清空
|
||||
this.streamingContent.value = '';
|
||||
@ -387,7 +492,7 @@ export class TaskLoop {
|
||||
const chatData = this.makeChatData(tabStorage);
|
||||
|
||||
if (!chatData) {
|
||||
this.onDone();
|
||||
this.consumeDones();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -411,22 +516,31 @@ export class TaskLoop {
|
||||
serverName: this.getLlmConfig().id || 'unknown'
|
||||
}
|
||||
});
|
||||
|
||||
pinkLog('调用工具数量:' + this.streamingToolCalls.value.length);
|
||||
|
||||
if (verbose > 0) {
|
||||
console.log(
|
||||
chalk.gray(`[${new Date().toLocaleString()}]`),
|
||||
chalk.yellow('🤖 llm wants to call these tools'),
|
||||
chalk.yellow(this.streamingToolCalls.value.map(tool => tool.function!.name || '').join(', '))
|
||||
);
|
||||
}
|
||||
|
||||
for (let toolCall of this.streamingToolCalls.value || []) {
|
||||
|
||||
toolCall = this.onToolCall(toolCall);
|
||||
// ready to call tools
|
||||
toolCall = this.consumeToolCalls(toolCall);
|
||||
let toolCallResult = await handleToolCalls(toolCall);
|
||||
toolCallResult = this.onToolCalled(toolCallResult);
|
||||
|
||||
|
||||
// hook : finish call tools
|
||||
toolCallResult = this.consumeToolCalleds(toolCallResult);
|
||||
|
||||
if (toolCallResult.state === MessageState.ParseJsonError) {
|
||||
// 如果是因为解析 JSON 错误,则重新开始
|
||||
tabStorage.messages.pop();
|
||||
jsonParseErrorRetryCount ++;
|
||||
|
||||
jsonParseErrorRetryCount++;
|
||||
|
||||
redLog('解析 JSON 错误 ' + toolCall?.function?.arguments);
|
||||
|
||||
|
||||
// 如果因为 JSON 错误而失败太多,就只能中断了
|
||||
if (jsonParseErrorRetryCount >= (this.taskOptions.maxJsonParseRetry || 3)) {
|
||||
tabStorage.messages.push({
|
||||
@ -455,7 +569,7 @@ export class TaskLoop {
|
||||
}
|
||||
});
|
||||
} else if (toolCallResult.state === MessageState.ToolCall) {
|
||||
|
||||
|
||||
tabStorage.messages.push({
|
||||
role: 'tool',
|
||||
index: toolcallIndexAdapter(toolCall),
|
||||
|
@ -6,6 +6,7 @@ import { loadPanels } from "@/hook/panel";
|
||||
import { getPlatform } from "@/api/platform";
|
||||
import type { PromptsGetResponse, PromptsListResponse, PromptTemplate, Resources, ResourcesListResponse, ResourcesReadResponse, ResourceTemplate, ResourceTemplatesListResponse, ToolCallResponse, ToolItem, ToolsListResponse } from "@/hook/type";
|
||||
import { mcpSetting } from "@/hook/mcp";
|
||||
import chalk from "chalk";
|
||||
|
||||
export const connectionSelectDataViewOption: ConnectionTypeOptionItem[] = [
|
||||
{
|
||||
@ -549,9 +550,16 @@ class McpClientAdapter {
|
||||
const ok = await client.connect();
|
||||
|
||||
if (ok) {
|
||||
console.log(`${client.name} connected successfully ✅`);
|
||||
console.log(
|
||||
chalk.gray(`[${new Date().toLocaleString()}]`),
|
||||
chalk.green(`🚀 [${client.name}] ${client.version} connected`)
|
||||
);
|
||||
} else {
|
||||
console.log(`${client.name} connected failed ❌`);
|
||||
console.log(
|
||||
chalk.gray(`[${new Date().toLocaleString()}]`),
|
||||
chalk.red(`× fail to connect `),
|
||||
chalk.red(JSON.stringify(client.connectionResult.logString, null, 2))
|
||||
);
|
||||
}
|
||||
|
||||
allOk &&= ok;
|
||||
|
@ -1,41 +1,32 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"module": "nodenext",
|
||||
"strict": true,
|
||||
"jsx": "preserve",
|
||||
"moduleResolution": "nodenext",
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"useDefineForClassFields": true,
|
||||
"sourceMap": true,
|
||||
"baseUrl": ".",
|
||||
"types": [
|
||||
"webpack-env"
|
||||
],
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"scripthost"
|
||||
]
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"strict": true,
|
||||
"jsx": "preserve",
|
||||
"moduleResolution": "nodenext",
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"useDefineForClassFields": true,
|
||||
"sourceMap": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["src/*"]
|
||||
},
|
||||
"lib": ["esnext", "dom", "dom.iterable", "scripthost"],
|
||||
"outDir": "dist",
|
||||
"rootDir": "src"
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
"src/**/*.vue",
|
||||
"tests/**/*.ts",
|
||||
"tests/**/*.tsx"
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
"src/**/*.vue",
|
||||
"tests/**/*.ts",
|
||||
"tests/**/*.tsx"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
@ -24,12 +24,13 @@
|
||||
},
|
||||
"homepage": "https://document.kirigaya.cn/blogs/openmcp/main.html",
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "^1.10.2",
|
||||
"@modelcontextprotocol/sdk": "^1.12.1",
|
||||
"@seald-io/nedb": "^4.1.1",
|
||||
"@vue/server-renderer": "^3.5.13",
|
||||
"axios": "^1.7.7",
|
||||
"chalk": "^5.4.1",
|
||||
"bson": "^6.8.0",
|
||||
"openai": "^4.93.0",
|
||||
"openai": "^5.0.1",
|
||||
"pako": "^2.1.0",
|
||||
"tesseract.js": "^6.0.1",
|
||||
"uuid": "^11.1.0",
|
||||
|
2
resources/openmcp-sdk-release/task-loop.d.ts
vendored
2
resources/openmcp-sdk-release/task-loop.d.ts
vendored
@ -8,9 +8,9 @@ export interface TaskLoopOptions {
|
||||
maxEpochs?: number;
|
||||
maxJsonParseRetry?: number;
|
||||
adapter?: any;
|
||||
verbose?: 0 | 1 | 2 | 3;
|
||||
}
|
||||
|
||||
|
||||
export interface SchemaProperty {
|
||||
title: string;
|
||||
type: string;
|
||||
|
10
resources/openmcp-sdk-release/tools.mjs
Normal file
10
resources/openmcp-sdk-release/tools.mjs
Normal file
@ -0,0 +1,10 @@
|
||||
const ElMessage = {
|
||||
error: console.error,
|
||||
warning: console.warn,
|
||||
info: console.info,
|
||||
success: console.log
|
||||
}
|
||||
|
||||
export {
|
||||
ElMessage
|
||||
};
|
@ -5,7 +5,6 @@ import { RestfulResponse } from "../common/index.dto.js";
|
||||
import { ocrDB } from "../hook/db.js";
|
||||
import type { ToolCallContent } from "../mcp/client.dto.js";
|
||||
import { ocrWorkerStorage } from "../mcp/ocr.service.js";
|
||||
import { axiosFetch } from "../hook/axios-fetch.js";
|
||||
import Table from 'cli-table3';
|
||||
|
||||
export let currentStream: AsyncIterable<any> | null = null;
|
||||
@ -39,18 +38,6 @@ export async function streamingChatCompletion(
|
||||
const client = new OpenAI({
|
||||
baseURL,
|
||||
apiKey,
|
||||
fetch: async (input: string | URL | Request, init?: RequestInit) => {
|
||||
|
||||
if (model.startsWith('gemini') && init) {
|
||||
// 该死的 google
|
||||
init.headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${apiKey}`
|
||||
}
|
||||
}
|
||||
|
||||
return await axiosFetch(input, init, { proxyServer });
|
||||
}
|
||||
});
|
||||
|
||||
const seriableTools = (tools.length === 0) ? undefined: tools;
|
||||
|
@ -264,8 +264,6 @@ export async function connectService(
|
||||
);
|
||||
|
||||
console.log(table.toString());
|
||||
|
||||
|
||||
|
||||
// 预处理字符串
|
||||
await preprocessCommand(option, webview);
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { defineConfig, normalizePath } from 'vite';
|
||||
import { resolve } from 'path';
|
||||
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
||||
// import { visualizer } from 'rollup-plugin-visualizer';
|
||||
|
||||
export default defineConfig({
|
||||
define: {
|
||||
@ -26,11 +25,7 @@ export default defineConfig({
|
||||
dest: normalizePath(resolve(__dirname, '../openmcp-sdk'))
|
||||
}
|
||||
]
|
||||
}),
|
||||
// visualizer({
|
||||
// open: true,
|
||||
// filename: 'stats.html'
|
||||
// })
|
||||
})
|
||||
],
|
||||
build: {
|
||||
target: 'node18',
|
||||
@ -45,22 +40,24 @@ export default defineConfig({
|
||||
rollupOptions: {
|
||||
external: [
|
||||
'vue',
|
||||
'chalk',
|
||||
'element-plus',
|
||||
],
|
||||
output: {
|
||||
globals: {
|
||||
vue: 'Vue',
|
||||
vue: 'vue',
|
||||
chalk: 'chalk',
|
||||
'element-plus': './tools.js'
|
||||
}
|
||||
},
|
||||
esModule: true
|
||||
}
|
||||
},
|
||||
minify: false,
|
||||
sourcemap: false, // 禁用sourcemap生成
|
||||
cssCodeSplit: false // 禁用CSS文件生成
|
||||
sourcemap: false
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(__dirname, '..', 'renderer/src'),
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user