remove dynamic vue created in ts
This commit is contained in:
parent
e3ccb69b92
commit
528ab45280
349
package-lock.json
generated
349
package-lock.json
generated
@ -32,10 +32,12 @@
|
||||
"copy-webpack-plugin": "^13.0.0",
|
||||
"fork-ts-checker-webpack-plugin": "^9.1.0",
|
||||
"null-loader": "^4.0.1",
|
||||
"rollup-plugin-visualizer": "^6.0.1",
|
||||
"ts-loader": "^9.5.1",
|
||||
"turbo": "^2.5.3",
|
||||
"typescript": "^5.4.2",
|
||||
"vite": "^6.3.5",
|
||||
"vite-plugin-static-copy": "^3.0.0",
|
||||
"vite-plugin-vue-devtools": "^7.7.6",
|
||||
"vue-tsc": "^2.2.10",
|
||||
"webpack": "^5.99.5",
|
||||
@ -1730,6 +1732,16 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/ansi-regex": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"dev": true,
|
||||
@ -2050,6 +2062,21 @@
|
||||
"node": ">=6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/cliui": {
|
||||
"version": "8.0.1",
|
||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
|
||||
"integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"string-width": "^4.2.0",
|
||||
"strip-ansi": "^6.0.1",
|
||||
"wrap-ansi": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/clone-deep": {
|
||||
"version": "4.0.1",
|
||||
"dev": true,
|
||||
@ -2402,6 +2429,13 @@
|
||||
"vue": "^3.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/emoji-regex": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/emojis-list": {
|
||||
"version": "3.0.0",
|
||||
"dev": true,
|
||||
@ -3077,6 +3111,16 @@
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/get-caller-file": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "6.* || 8.* || >= 10.*"
|
||||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.3.0",
|
||||
"license": "MIT",
|
||||
@ -3448,6 +3492,16 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/is-fullwidth-code-point": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/is-generator-function": {
|
||||
"version": "1.1.0",
|
||||
"license": "MIT",
|
||||
@ -4497,6 +4551,19 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/p-map": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.3.tgz",
|
||||
"integrity": "sha512-VkndIv2fIB99swvQoA65bm+fsmt6UNdGeIB0oxBs+WhAhdh08QA04JXpI7rbB9r08/nkbysKoya9rtDERYOYMA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/p-try": {
|
||||
"version": "2.2.0",
|
||||
"dev": true,
|
||||
@ -4936,6 +5003,16 @@
|
||||
"version": "0.13.11",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/require-directory": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/require-from-string": {
|
||||
"version": "2.0.2",
|
||||
"dev": true,
|
||||
@ -5043,6 +5120,94 @@
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/rollup-plugin-visualizer": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/rollup-plugin-visualizer/-/rollup-plugin-visualizer-6.0.1.tgz",
|
||||
"integrity": "sha512-NjlGElvLXCSZSAi3gNRZbfX3qlQbQcJ9TW97c5JpqfVwMhttj9YwEdPwcvbKj91RnMX2PWAjonvSEv6UEYtnRQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"open": "^8.0.0",
|
||||
"picomatch": "^4.0.2",
|
||||
"source-map": "^0.7.4",
|
||||
"yargs": "^17.5.1"
|
||||
},
|
||||
"bin": {
|
||||
"rollup-plugin-visualizer": "dist/bin/cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"rolldown": "1.x",
|
||||
"rollup": "2.x || 3.x || 4.x"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"rolldown": {
|
||||
"optional": true
|
||||
},
|
||||
"rollup": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/rollup-plugin-visualizer/node_modules/define-lazy-prop": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
|
||||
"integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/rollup-plugin-visualizer/node_modules/is-docker": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
|
||||
"integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"is-docker": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/rollup-plugin-visualizer/node_modules/is-wsl": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
|
||||
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"is-docker": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/rollup-plugin-visualizer/node_modules/open": {
|
||||
"version": "8.4.2",
|
||||
"resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz",
|
||||
"integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"define-lazy-prop": "^2.0.0",
|
||||
"is-docker": "^2.1.1",
|
||||
"is-wsl": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/router": {
|
||||
"version": "2.2.0",
|
||||
"license": "MIT",
|
||||
@ -5411,6 +5576,34 @@
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/string-width": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"emoji-regex": "^8.0.0",
|
||||
"is-fullwidth-code-point": "^3.0.0",
|
||||
"strip-ansi": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-ansi": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-bom": {
|
||||
"version": "3.0.0",
|
||||
"dev": true,
|
||||
@ -5961,6 +6154,105 @@
|
||||
"node": ">=14.14"
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-static-copy": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vite-plugin-static-copy/-/vite-plugin-static-copy-3.0.0.tgz",
|
||||
"integrity": "sha512-Uki9pPUQ4ZnoMEdIFabvoh9h6Bh9Q1m3iF7BrZvoiF30reREpJh2gZb4jOnW1/uYFzyRiLCmFSkM+8hwiq1vWQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"chokidar": "^3.5.3",
|
||||
"fs-extra": "^11.3.0",
|
||||
"p-map": "^7.0.3",
|
||||
"picocolors": "^1.1.1",
|
||||
"tinyglobby": "^0.2.13"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.0.0 || >=20.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vite": "^5.0.0 || ^6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-static-copy/node_modules/chokidar": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
|
||||
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"anymatch": "~3.1.2",
|
||||
"braces": "~3.0.2",
|
||||
"glob-parent": "~5.1.2",
|
||||
"is-binary-path": "~2.1.0",
|
||||
"is-glob": "~4.0.1",
|
||||
"normalize-path": "~3.0.0",
|
||||
"readdirp": "~3.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.10.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-static-copy/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/vite-plugin-static-copy/node_modules/glob-parent": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"is-glob": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-static-copy/node_modules/picomatch": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
|
||||
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-static-copy/node_modules/readdirp": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
|
||||
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"picomatch": "^2.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-vue-devtools": {
|
||||
"version": "7.7.6",
|
||||
"dev": true,
|
||||
@ -6292,6 +6584,24 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/wrap-ansi": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
|
||||
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.0.0",
|
||||
"string-width": "^4.1.0",
|
||||
"strip-ansi": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"license": "ISC"
|
||||
@ -6315,11 +6625,50 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/y18n": {
|
||||
"version": "5.0.8",
|
||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
||||
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/yallist": {
|
||||
"version": "3.1.1",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/yargs": {
|
||||
"version": "17.7.2",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
|
||||
"integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cliui": "^8.0.1",
|
||||
"escalade": "^3.1.1",
|
||||
"get-caller-file": "^2.0.5",
|
||||
"require-directory": "^2.1.1",
|
||||
"string-width": "^4.2.3",
|
||||
"y18n": "^5.0.5",
|
||||
"yargs-parser": "^21.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/yargs-parser": {
|
||||
"version": "21.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
|
||||
"integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/yoctocolors": {
|
||||
"version": "2.1.1",
|
||||
"dev": true,
|
||||
|
@ -219,7 +219,7 @@
|
||||
"scripts": {
|
||||
"setup": "npm i && npm run prepare:ocr",
|
||||
"serve": "turbo serve",
|
||||
"build": "turbo build --filter=!@openmcp/electron",
|
||||
"build": "turbo build",
|
||||
"build:electron": "turbo build --filter=@openmcp/electron",
|
||||
"build:all": "turbo build",
|
||||
"vscode:prepublish": "webpack --mode production",
|
||||
@ -252,10 +252,12 @@
|
||||
"copy-webpack-plugin": "^13.0.0",
|
||||
"fork-ts-checker-webpack-plugin": "^9.1.0",
|
||||
"null-loader": "^4.0.1",
|
||||
"rollup-plugin-visualizer": "^6.0.1",
|
||||
"ts-loader": "^9.5.1",
|
||||
"turbo": "^2.5.3",
|
||||
"typescript": "^5.4.2",
|
||||
"vite": "^6.3.5",
|
||||
"vite-plugin-static-copy": "^3.0.0",
|
||||
"vite-plugin-vue-devtools": "^7.7.6",
|
||||
"vue-tsc": "^2.2.10",
|
||||
"webpack": "^5.99.5",
|
||||
|
@ -10,6 +10,8 @@ import { getToolCallIndexAdapter, handleToolCalls, type IToolCallIndex, type Too
|
||||
import { getPlatform } from "@/api/platform";
|
||||
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";
|
||||
|
||||
export type ChatCompletionChunk = OpenAI.Chat.Completions.ChatCompletionChunk;
|
||||
export type ChatCompletionCreateParamsBase = OpenAI.Chat.Completions.ChatCompletionCreateParams & { id?: string, proxyServer?: string };
|
||||
@ -47,6 +49,11 @@ export class TaskLoop {
|
||||
private completionUsage: ChatCompletionChunk['usage'] | undefined;
|
||||
private llmConfig?: BasicLlmDescription;
|
||||
|
||||
// 只会在 nodejs 环境下使用的部分变量
|
||||
private nodejsStatus = {
|
||||
connectionFut: new Promise<void>(resolve => resolve(void 0))
|
||||
};
|
||||
|
||||
constructor(
|
||||
private readonly taskOptions: TaskLoopOptions = { maxEpochs: 20, maxJsonParseRetry: 3, adapter: undefined },
|
||||
) {
|
||||
@ -55,6 +62,9 @@ export class TaskLoop {
|
||||
|
||||
// 根据当前环境决定是否要开启 messageBridge
|
||||
const platform = getPlatform();
|
||||
|
||||
console.log('current platform is', platform);
|
||||
|
||||
if (platform === 'nodejs') {
|
||||
const adapter = taskOptions.adapter;
|
||||
|
||||
@ -63,6 +73,8 @@ export class TaskLoop {
|
||||
}
|
||||
|
||||
createMessageBridge(adapter.emitter);
|
||||
console.log('mcpClientAdapter launch');
|
||||
this.nodejsStatus.connectionFut = mcpClientAdapter.launch();
|
||||
}
|
||||
|
||||
// web 环境下 bridge 会自动加载完成
|
||||
@ -313,14 +325,38 @@ export class TaskLoop {
|
||||
return llms[llmManager.currentModelIndex];
|
||||
}
|
||||
|
||||
public async connectToService() {
|
||||
|
||||
public async listTools() {
|
||||
const platform = getPlatform();
|
||||
if (platform === 'nodejs') {
|
||||
// 等待连接完成
|
||||
await this.nodejsStatus.connectionFut;
|
||||
}
|
||||
|
||||
const allTools = {} as Record<string, ToolItem[]>;
|
||||
for (const client of mcpClientAdapter.clients) {
|
||||
if (!client.connected) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const tools = await client.getTools();
|
||||
const clientName = client.connectionResult.name as string;
|
||||
allTools[clientName] = Array.from(tools.values());
|
||||
}
|
||||
|
||||
return allTools;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 开启循环,异步更新 DOM
|
||||
*/
|
||||
public async start(tabStorage: ChatStorage, userMessage: string) {
|
||||
|
||||
const platform = getPlatform();
|
||||
if (platform === 'nodejs') {
|
||||
// 等待连接完成
|
||||
await this.nodejsStatus.connectionFut;
|
||||
}
|
||||
|
||||
// 添加目前的消息
|
||||
tabStorage.messages.push({
|
||||
role: 'user',
|
||||
|
@ -1,28 +1,21 @@
|
||||
import { watch, reactive } from 'vue';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import Resource from './resource/index.vue';
|
||||
import Chat from './chat/index.vue';
|
||||
import Prompt from './prompt/index.vue';
|
||||
import Tool from './tool/index.vue';
|
||||
import I18n from '@/i18n/index';
|
||||
import { safeSavePanels, savePanels } from '@/hook/panel';
|
||||
|
||||
const { t } = I18n.global;
|
||||
import { safeSavePanels } from '@/hook/panel';
|
||||
|
||||
interface Tab {
|
||||
id: string;
|
||||
name: string;
|
||||
icon: string;
|
||||
type: string;
|
||||
component: any;
|
||||
componentIndex: number;
|
||||
storage: Record<string, any>;
|
||||
}
|
||||
|
||||
export const debugModes = [
|
||||
Resource, Prompt, Tool, Chat
|
||||
]
|
||||
// export const debugModes = [
|
||||
// Resource, Prompt, Tool, Chat
|
||||
// ]
|
||||
|
||||
// TODO: 实现对于 tabs 这个数据的可持久化
|
||||
export const tabs = reactive<{
|
||||
@ -54,6 +47,7 @@ watch(
|
||||
export function createTab(type: string, index: number): Tab {
|
||||
let customName: string | null = null;
|
||||
const id = uuidv4();
|
||||
const { t } = I18n.global;
|
||||
|
||||
return {
|
||||
get name() {
|
||||
@ -69,7 +63,6 @@ export function createTab(type: string, index: number): Tab {
|
||||
type,
|
||||
id,
|
||||
componentIndex: -1,
|
||||
component: undefined,
|
||||
storage: {
|
||||
// 默认打开一个 mcp server 的面板
|
||||
activeNames: [0]
|
||||
@ -83,7 +76,6 @@ export function addNewTab() {
|
||||
tabs.activeIndex = tabs.content.length - 1;
|
||||
}
|
||||
|
||||
|
||||
export function closeTab(index: number) {
|
||||
tabs.content.splice(index, 1);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useMessageBridge } from "@/api/message-bridge";
|
||||
import { pinkLog } from "@/views/setting/util";
|
||||
import { debugModes, tabs } from "@/components/main-panel/panel";
|
||||
import { markRaw, ref, type Reactive } from "vue";
|
||||
import { tabs } from "@/components/main-panel/panel";
|
||||
import { ref, type Reactive } from "vue";
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { mcpClientAdapter, type McpClient } from "@/views/connect/core";
|
||||
|
||||
@ -45,15 +45,12 @@ export async function loadPanels(client: McpClient | Reactive<McpClient>) {
|
||||
|
||||
for (const tab of persistTab.tabs || []) {
|
||||
|
||||
const component = tab.componentIndex >= 0? markRaw(debugModes[tab.componentIndex]) : undefined;
|
||||
|
||||
tabs.content.push({
|
||||
id: uuidv4(),
|
||||
name: tab.name,
|
||||
icon: tab.icon,
|
||||
type: tab.type,
|
||||
componentIndex: tab.componentIndex,
|
||||
component: component,
|
||||
storage: tab.storage
|
||||
});
|
||||
}
|
||||
|
@ -470,6 +470,7 @@ class McpClientAdapter {
|
||||
* @returns
|
||||
*/
|
||||
public async getLaunchSignature(): Promise<IConnectionArgs[]> {
|
||||
|
||||
const bridge = useMessageBridge();
|
||||
const { code, msg } = await bridge.commandRequest(this.platform + '/launch-signature');
|
||||
|
||||
@ -536,7 +537,6 @@ class McpClientAdapter {
|
||||
for (const item of launchSignature) {
|
||||
|
||||
// 创建一个新的客户端
|
||||
// const client = reactive(new McpClient());
|
||||
const client = new McpClient();
|
||||
|
||||
// 同步连接参数
|
||||
@ -549,6 +549,13 @@ class McpClientAdapter {
|
||||
|
||||
// 连接
|
||||
const ok = await client.connect();
|
||||
|
||||
if (ok) {
|
||||
console.log(`${client.name} connected successfully ✅`);
|
||||
} else {
|
||||
console.log(`${client.name} connected failed ❌`);
|
||||
}
|
||||
|
||||
allOk &&= ok;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
v-show="tab === tabs.content[tabs.activeIndex]"
|
||||
v-for="(tab, index) of tabs.content"
|
||||
:key="tab.id"
|
||||
:is="tab.component"
|
||||
:is="debugComponent[tab.componentIndex]"
|
||||
:tab-id="index"
|
||||
/>
|
||||
</div>
|
||||
@ -18,16 +18,24 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent, computed } from 'vue';
|
||||
import Resource from '@/components/main-panel/resource/index.vue';
|
||||
import Chat from '@/components/main-panel/chat/index.vue';
|
||||
import Prompt from '@/components/main-panel/prompt/index.vue';
|
||||
import Tool from '@/components/main-panel/tool/index.vue';
|
||||
|
||||
import Welcome from './welcome.vue';
|
||||
import { tabs } from '@/components/main-panel/panel';
|
||||
import { panelLoaded } from '@/hook/panel';
|
||||
|
||||
const debugComponent = [
|
||||
Resource, Prompt, Tool, Chat
|
||||
]
|
||||
|
||||
defineComponent({ name: 'debug' });
|
||||
|
||||
const haveActiveTab = computed(() => {
|
||||
const activeTab = tabs.activeTab;
|
||||
if (activeTab && activeTab.component) {
|
||||
if (activeTab && activeTab.componentIndex >= 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -22,8 +22,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { debugModes, tabs } from '@/components/main-panel/panel';
|
||||
import { defineComponent, markRaw, computed } from 'vue';
|
||||
import { tabs } from '@/components/main-panel/panel';
|
||||
import { defineComponent, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { welcomeRef } from './welcome';
|
||||
@ -61,8 +61,6 @@ function chooseDebugMode(index: number) {
|
||||
// TODO: 支持更多的 server
|
||||
if (mcpClientAdapter.connected) {
|
||||
const activeTab = tabs.activeTab;
|
||||
activeTab.component = markRaw(debugModes[index]);
|
||||
|
||||
activeTab.componentIndex = index;
|
||||
activeTab.icon = debugOptions[index].icon;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { markRaw, reactive } from 'vue';
|
||||
import { createTab, debugModes, tabs } from '@/components/main-panel/panel';
|
||||
import { reactive } from 'vue';
|
||||
import { createTab, tabs } from '@/components/main-panel/panel';
|
||||
import type { ToolStorage } from '@/components/main-panel/tool/tools';
|
||||
import type { ToolCall } from '@/components/main-panel/chat/chat-box/chat';
|
||||
|
||||
@ -28,7 +28,6 @@ export interface BasicLlmDescription {
|
||||
export function createTest(call: ToolCall) {
|
||||
const tab = createTab('tool', 0);
|
||||
tab.componentIndex = 2;
|
||||
tab.component = markRaw(debugModes[2]);
|
||||
tab.icon = 'icon-tool';
|
||||
tab.name = t("tools");
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
"pako": "^2.1.0",
|
||||
"tesseract.js": "^6.0.1",
|
||||
"uuid": "^11.1.0",
|
||||
"open": "^10.1.2",
|
||||
"ws": "^8.18.1",
|
||||
"https-proxy-agent": "^7.0.6"
|
||||
}
|
||||
|
28
resources/openmcp-sdk-release/task-loop.d.ts
vendored
28
resources/openmcp-sdk-release/task-loop.d.ts
vendored
@ -10,6 +10,28 @@ export interface TaskLoopOptions {
|
||||
adapter?: any;
|
||||
}
|
||||
|
||||
|
||||
export interface SchemaProperty {
|
||||
title: string;
|
||||
type: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface InputSchema {
|
||||
type: string;
|
||||
properties: Record<string, SchemaProperty>;
|
||||
required?: string[];
|
||||
title?: string;
|
||||
$defs?: any;
|
||||
}
|
||||
|
||||
export interface ToolItem {
|
||||
name: string;
|
||||
description: string;
|
||||
inputSchema: InputSchema;
|
||||
anyOf?: any;
|
||||
}
|
||||
|
||||
export type Ref<T> = {
|
||||
value: T;
|
||||
};
|
||||
@ -137,6 +159,12 @@ export class TaskLoop {
|
||||
setMaxEpochs(maxEpochs: number): void;
|
||||
bindStreaming(content: Ref<string>, toolCalls: Ref<ToolCall[]>): void;
|
||||
connectToService(): Promise<void>;
|
||||
|
||||
/**
|
||||
* @description 获取所有可用的工具列表
|
||||
*/
|
||||
listTools(): Promise<Record<string, ToolItem[]>>;
|
||||
|
||||
/**
|
||||
* @description 开启循环,异步更新 DOM
|
||||
*/
|
||||
|
@ -72,6 +72,7 @@ export class VSCodeWebViewLike {
|
||||
export class TaskLoopAdapter {
|
||||
public emitter: EventEmitter;
|
||||
private messageHandlers: Set<MessageHandler>;
|
||||
private connectionOptions: McpOptions[] = [];
|
||||
|
||||
constructor(option?: any) {
|
||||
this.emitter = new EventEmitter(option);
|
||||
@ -83,8 +84,27 @@ export class TaskLoopAdapter {
|
||||
|
||||
// 默认需要将监听的消息导入到 routeMessage 中
|
||||
this.onDidReceiveMessage((message) => {
|
||||
const { command, data } = message;
|
||||
routeMessage(command, data, this);
|
||||
const { command, data } = message;
|
||||
|
||||
switch (command) {
|
||||
case 'nodejs/launch-signature':
|
||||
this.postMessage({
|
||||
command: 'nodejs/launch-signature',
|
||||
data: {
|
||||
code: 200,
|
||||
msg: this.connectionOptions
|
||||
}
|
||||
})
|
||||
break;
|
||||
|
||||
case 'nodejs/update-connection-signature':
|
||||
// sdk 模式下不需要自动保存连接参数
|
||||
break;
|
||||
|
||||
default:
|
||||
routeMessage(command, data, this);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
@ -113,38 +133,14 @@ export class TaskLoopAdapter {
|
||||
* @description 连接到 mcp 服务端
|
||||
* @param mcpOption
|
||||
*/
|
||||
public async connectMcpServer(mcpOption: McpOptions) {
|
||||
const res = await connectService(mcpOption);
|
||||
if (res.code === 200) {
|
||||
console.log('✅ 成功连接 mcp 服务器: ' + res.msg);
|
||||
public addMcp(mcpOption: McpOptions) {
|
||||
|
||||
const uuid = res.msg.uuid;
|
||||
const client = clientMap.get(uuid);
|
||||
const version = client?.getServerVersion();
|
||||
console.log(version);
|
||||
} else {
|
||||
console.error('❌ 连接 mcp 服务器失败:' + res.msg);
|
||||
}
|
||||
}
|
||||
// 0.1.4 新版本开始,此处修改为懒加载连接
|
||||
// 实际的连接移交给前端 mcpAdapter 中进行统一的调度
|
||||
// 调度步骤如下:
|
||||
// getLaunchSignature 先获取访问签名,访问签名通过当前函数 push 到 class 中
|
||||
|
||||
/**
|
||||
* @description 获取 mcp 服务器的工具列表
|
||||
* @returns
|
||||
*/
|
||||
public async listTools() {
|
||||
const tools = [];
|
||||
for (const client of clientMap.values()) {
|
||||
const clientTools = await client?.listTools();
|
||||
if (clientTools?.tools) {
|
||||
const enabledTools = clientTools.tools.map((tool: any) => {
|
||||
const enabledTools = {...tool, enabled: true };
|
||||
return enabledTools;
|
||||
});
|
||||
tools.push(...enabledTools);
|
||||
}
|
||||
}
|
||||
|
||||
return tools;
|
||||
this.connectionOptions.push(mcpOption);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
export { routeMessage } from './common/router.js';
|
||||
export { VSCodeWebViewLike, TaskLoopAdapter } from './hook/adapter.js';
|
||||
export { setVscodeWorkspace, setRunningCWD } from './hook/setting.js';
|
||||
// TODO: 更加规范
|
||||
export { clientMap } from './mcp/connect.service.js';
|
@ -73,7 +73,7 @@ export class OAuthClient {
|
||||
callbackUrl: string;
|
||||
|
||||
constructor() {
|
||||
console.log('🔐 Initializing OAuth client...');
|
||||
// console.log('🔐 Initializing OAuth client...');
|
||||
// 初始化OAuth客户端
|
||||
this.port = Math.floor(Math.random() * (50000 - 40000 + 1)) + 40000;
|
||||
//TODO: 如果端口被占用,重新生成一个端口
|
||||
@ -158,7 +158,7 @@ export class OAuthClient {
|
||||
token_endpoint_auth_method: 'none',
|
||||
};
|
||||
|
||||
console.log('🔐 Creating OAuth provider...');
|
||||
// console.log('🔐 Creating OAuth provider...');
|
||||
const oauthProvider = new InMemoryOAuthClientProvider(
|
||||
this.callbackUrl,
|
||||
clientMetadata,
|
||||
@ -168,7 +168,7 @@ export class OAuthClient {
|
||||
this.openBrowser(redirectUrl.toString());
|
||||
}
|
||||
);
|
||||
console.log('🔐 OAuth provider created');
|
||||
// console.log('🔐 OAuth provider created');
|
||||
return oauthProvider;
|
||||
}
|
||||
|
||||
|
4949
stats.html
Normal file
4949
stats.html
Normal file
File diff suppressed because one or more lines are too long
@ -1,6 +1,7 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import { resolve } from 'path';
|
||||
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
||||
import { visualizer } from 'rollup-plugin-visualizer';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
|
||||
export default defineConfig({
|
||||
@ -11,12 +12,11 @@ export default defineConfig({
|
||||
'userAgent': 2
|
||||
},
|
||||
},
|
||||
'document': {
|
||||
body: {}
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
vue({
|
||||
isProduction: true
|
||||
}),
|
||||
viteStaticCopy({
|
||||
targets: [
|
||||
{
|
||||
@ -24,6 +24,10 @@ export default defineConfig({
|
||||
dest: resolve(__dirname, '../openmcp-sdk')
|
||||
}
|
||||
]
|
||||
}),
|
||||
visualizer({
|
||||
open: true,
|
||||
filename: 'stats.html'
|
||||
})
|
||||
],
|
||||
build: {
|
||||
@ -42,13 +46,13 @@ export default defineConfig({
|
||||
'element-plus': './tools.js'
|
||||
}
|
||||
},
|
||||
minify: true,
|
||||
minify: false,
|
||||
sourcemap: false, // 禁用sourcemap生成
|
||||
cssCodeSplit: false // 禁用CSS文件生成
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(__dirname, '..', 'renderer/src')
|
||||
'@': resolve(__dirname, '..', 'renderer/src'),
|
||||
}
|
||||
}
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user