@comate/zulu 0.0.9 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -0
- package/comate-engine/bin/comate.js +10 -0
- package/comate-engine/fallbackServer.js +1 -0
- package/comate-engine/node_modules/@comate/plugin-engine/dist/index.d.ts +188 -0
- package/comate-engine/node_modules/@comate/plugin-engine/dist/index.js +36 -0
- package/comate-engine/node_modules/@comate/plugin-engine/package.json +49 -0
- package/comate-engine/node_modules/@comate/plugin-host/bin.js +44 -0
- package/comate-engine/node_modules/@comate/plugin-host/dist/index.js +1 -0
- package/comate-engine/node_modules/@comate/plugin-host/dist/main.d.ts +14 -0
- package/comate-engine/node_modules/@comate/plugin-host/dist/main.js +9 -0
- package/comate-engine/node_modules/@comate/plugin-host/dist/user-Btg63hPI.js +36 -0
- package/comate-engine/node_modules/@comate/plugin-host/package.json +47 -0
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.d.ts +2849 -0
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.js +36 -0
- package/comate-engine/node_modules/@comate/plugin-shared-internals/package.json +72 -0
- package/comate-engine/node_modules/@comate/preview-proxy/bin/preview.js +13 -0
- package/comate-engine/node_modules/@comate/preview-proxy/dist/index.js +350 -0
- package/comate-engine/node_modules/@comate/preview-proxy/package.json +83 -0
- package/comate-engine/node_modules/@comate/preview-proxy/static/comate-preview-injector.css +1 -0
- package/comate-engine/node_modules/@comate/preview-proxy/static/comate-preview-injector.js +2 -0
- package/comate-engine/node_modules/@comate/preview-proxy/static/comate-preview-injector.js.LICENSE.txt +58 -0
- package/comate-engine/node_modules/compare-versions/LICENSE +21 -0
- package/comate-engine/node_modules/compare-versions/README.md +133 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/compare.d.ts +19 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/compare.js +44 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/compare.js.map +1 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/compareVersions.d.ts +8 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/compareVersions.js +29 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/compareVersions.js.map +1 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/index.d.ts +5 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/index.js +5 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/index.js.map +1 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/satisfies.d.ts +14 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/satisfies.js +66 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/satisfies.js.map +1 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/utils.d.ts +7 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/utils.js +37 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/utils.js.map +1 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/validate.d.ts +28 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/validate.js +31 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/validate.js.map +1 -0
- package/comate-engine/node_modules/compare-versions/lib/umd/index.js +216 -0
- package/comate-engine/node_modules/compare-versions/lib/umd/index.js.map +1 -0
- package/comate-engine/node_modules/compare-versions/package.json +45 -0
- package/comate-engine/node_modules/compare-versions/src/compare.ts +54 -0
- package/comate-engine/node_modules/compare-versions/src/compareVersions.ts +31 -0
- package/comate-engine/node_modules/compare-versions/src/index.ts +5 -0
- package/comate-engine/node_modules/compare-versions/src/satisfies.ts +69 -0
- package/comate-engine/node_modules/compare-versions/src/utils.ts +50 -0
- package/comate-engine/node_modules/compare-versions/src/validate.ts +36 -0
- package/comate-engine/node_modules/pkce-challenge/LICENSE +21 -0
- package/comate-engine/node_modules/pkce-challenge/README.md +55 -0
- package/comate-engine/node_modules/pkce-challenge/dist/index.browser.d.ts +19 -0
- package/comate-engine/node_modules/pkce-challenge/dist/index.browser.js +72 -0
- package/comate-engine/node_modules/pkce-challenge/dist/index.node.cjs +80 -0
- package/comate-engine/node_modules/pkce-challenge/dist/index.node.d.cts +19 -0
- package/comate-engine/node_modules/pkce-challenge/dist/index.node.d.ts +19 -0
- package/comate-engine/node_modules/pkce-challenge/dist/index.node.js +75 -0
- package/comate-engine/node_modules/pkce-challenge/package.json +58 -0
- package/comate-engine/node_modules/web-streams-polyfill/LICENSE +22 -0
- package/comate-engine/node_modules/web-streams-polyfill/README.md +119 -0
- package/comate-engine/node_modules/web-streams-polyfill/dist/polyfill.es5.js +8 -0
- package/comate-engine/node_modules/web-streams-polyfill/dist/polyfill.js +8 -0
- package/comate-engine/node_modules/web-streams-polyfill/dist/ponyfill.es5.js +8 -0
- package/comate-engine/node_modules/web-streams-polyfill/dist/ponyfill.es5.mjs +8 -0
- package/comate-engine/node_modules/web-streams-polyfill/dist/ponyfill.js +8 -0
- package/comate-engine/node_modules/web-streams-polyfill/dist/ponyfill.mjs +8 -0
- package/comate-engine/node_modules/web-streams-polyfill/package.json +98 -0
- package/comate-engine/node_modules/web-streams-polyfill/types/polyfill.d.ts +28 -0
- package/comate-engine/node_modules/web-streams-polyfill/types/ponyfill.d.ts +809 -0
- package/comate-engine/node_modules/web-streams-polyfill/types/tsdoc-metadata.json +11 -0
- package/comate-engine/package.json +94 -0
- package/comate-engine/plugins/aiscan/assets/icon.svg +12 -0
- package/comate-engine/plugins/aiscan/dist/index.js +53861 -0
- package/comate-engine/plugins/aiscan/package.json +67 -0
- package/comate-engine/plugins/appdev/assets/icon.png +0 -0
- package/comate-engine/plugins/appdev/dist/help.md +12 -0
- package/comate-engine/plugins/appdev/dist/index.d.ts +2 -0
- package/comate-engine/plugins/appdev/dist/index.js +194 -0
- package/comate-engine/plugins/appdev/dist/providers/err.d.ts +8 -0
- package/comate-engine/plugins/appdev/dist/providers/err.js +37 -0
- package/comate-engine/plugins/appdev/dist/providers/fallback.d.ts +5 -0
- package/comate-engine/plugins/appdev/dist/providers/fallback.js +28 -0
- package/comate-engine/plugins/appdev/dist/providers/help.d.ts +8 -0
- package/comate-engine/plugins/appdev/dist/providers/help.js +19 -0
- package/comate-engine/plugins/appdev/dist/providers/medusa.d.ts +8 -0
- package/comate-engine/plugins/appdev/dist/providers/medusa.js +39 -0
- package/comate-engine/plugins/appdev/dist/providers/qa.d.ts +8 -0
- package/comate-engine/plugins/appdev/dist/providers/qa.js +33 -0
- package/comate-engine/plugins/appdev/package.json +67 -0
- package/comate-engine/plugins/bfc/assets/bfc-icon.png +0 -0
- package/comate-engine/plugins/bfc/dist/config/config.d.ts +4 -0
- package/comate-engine/plugins/bfc/dist/config/config.js +4 -0
- package/comate-engine/plugins/bfc/dist/help.md +11 -0
- package/comate-engine/plugins/bfc/dist/index.d.ts +2 -0
- package/comate-engine/plugins/bfc/dist/index.js +452 -0
- package/comate-engine/plugins/bfc/dist/providers/bfcInstructMode.d.ts +8 -0
- package/comate-engine/plugins/bfc/dist/providers/bfcInstructMode.js +77 -0
- package/comate-engine/plugins/bfc/dist/providers/genAbnormalCode.d.ts +8 -0
- package/comate-engine/plugins/bfc/dist/providers/genAbnormalCode.js +71 -0
- package/comate-engine/plugins/bfc/dist/providers/genBfcCode.d.ts +8 -0
- package/comate-engine/plugins/bfc/dist/providers/genBfcCode.js +74 -0
- package/comate-engine/plugins/bfc/dist/providers/getBatchCases.d.ts +10 -0
- package/comate-engine/plugins/bfc/dist/providers/getBatchCases.js +71 -0
- package/comate-engine/plugins/bfc/dist/providers/help.d.ts +8 -0
- package/comate-engine/plugins/bfc/dist/providers/help.js +19 -0
- package/comate-engine/plugins/bfc/dist/service/generateService.d.ts +14 -0
- package/comate-engine/plugins/bfc/dist/service/generateService.js +27 -0
- package/comate-engine/plugins/bfc/package.json +85 -0
- package/comate-engine/plugins/bpm/assets/bpm.png +0 -0
- package/comate-engine/plugins/bpm/dist/index.js +313 -0
- package/comate-engine/plugins/bpm/package.json +65 -0
- package/comate-engine/plugins/casebuilder/assets/icon.svg +1 -0
- package/comate-engine/plugins/casebuilder/dist/help.md +33 -0
- package/comate-engine/plugins/casebuilder/dist/index.js +837 -0
- package/comate-engine/plugins/casebuilder/package.json +80 -0
- package/comate-engine/plugins/centrino/assets/icon.png +0 -0
- package/comate-engine/plugins/centrino/dist/help.md +30 -0
- package/comate-engine/plugins/centrino/dist/index.js +1046 -0
- package/comate-engine/plugins/centrino/package.json +68 -0
- package/comate-engine/plugins/cnap/assets/cnap.png +0 -0
- package/comate-engine/plugins/cnap/dist/help.md +11 -0
- package/comate-engine/plugins/cnap/dist/index.js +171 -0
- package/comate-engine/plugins/cnap/package.json +65 -0
- package/comate-engine/plugins/demo-feature/assets/icon.svg +1 -0
- package/comate-engine/plugins/demo-feature/dist/help.md +1 -0
- package/comate-engine/plugins/demo-feature/dist/index.d.ts +2 -0
- package/comate-engine/plugins/demo-feature/dist/index.js +36008 -0
- package/comate-engine/plugins/demo-feature/dist/providers/codeQuery.d.ts +12 -0
- package/comate-engine/plugins/demo-feature/dist/providers/codeQuery.js +23 -0
- package/comate-engine/plugins/demo-feature/dist/providers/codeSearch.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/codeSearch.js +26 -0
- package/comate-engine/plugins/demo-feature/dist/providers/config.d.ts +13 -0
- package/comate-engine/plugins/demo-feature/dist/providers/config.js +25 -0
- package/comate-engine/plugins/demo-feature/dist/providers/context.d.ts +10 -0
- package/comate-engine/plugins/demo-feature/dist/providers/context.js +49 -0
- package/comate-engine/plugins/demo-feature/dist/providers/debugAgent.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/debugAgent.js +65 -0
- package/comate-engine/plugins/demo-feature/dist/providers/explainCode.d.ts +9 -0
- package/comate-engine/plugins/demo-feature/dist/providers/explainCode.js +24 -0
- package/comate-engine/plugins/demo-feature/dist/providers/fallback.d.ts +5 -0
- package/comate-engine/plugins/demo-feature/dist/providers/fallback.js +23 -0
- package/comate-engine/plugins/demo-feature/dist/providers/file.d.ts +13 -0
- package/comate-engine/plugins/demo-feature/dist/providers/file.js +36 -0
- package/comate-engine/plugins/demo-feature/dist/providers/help.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/help.js +19 -0
- package/comate-engine/plugins/demo-feature/dist/providers/information.d.ts +13 -0
- package/comate-engine/plugins/demo-feature/dist/providers/information.js +23 -0
- package/comate-engine/plugins/demo-feature/dist/providers/knowledge.d.ts +15 -0
- package/comate-engine/plugins/demo-feature/dist/providers/knowledge.js +71 -0
- package/comate-engine/plugins/demo-feature/dist/providers/log.d.ts +12 -0
- package/comate-engine/plugins/demo-feature/dist/providers/log.js +21 -0
- package/comate-engine/plugins/demo-feature/dist/providers/onlyCode.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/onlyCode.js +23 -0
- package/comate-engine/plugins/demo-feature/dist/providers/pluginConfig.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/pluginConfig.js +47 -0
- package/comate-engine/plugins/demo-feature/dist/providers/prompt.d.ts +7 -0
- package/comate-engine/plugins/demo-feature/dist/providers/prompt.js +7 -0
- package/comate-engine/plugins/demo-feature/dist/providers/ragProvider.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/ragProvider.js +17 -0
- package/comate-engine/plugins/demo-feature/dist/providers/render.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/render.js +75 -0
- package/comate-engine/plugins/demo-feature/dist/providers/renderJsx.d.ts +10 -0
- package/comate-engine/plugins/demo-feature/dist/providers/renderJsx.js +173 -0
- package/comate-engine/plugins/demo-feature/dist/providers/section.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/section.js +136 -0
- package/comate-engine/plugins/demo-feature/dist/providers/selectedKnowledge.d.ts +12 -0
- package/comate-engine/plugins/demo-feature/dist/providers/selectedKnowledge.js +17 -0
- package/comate-engine/plugins/demo-feature/dist/providers/streaming.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/streaming.js +29 -0
- package/comate-engine/plugins/demo-feature/dist/providers/userDetail.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/userDetail.js +28 -0
- package/comate-engine/plugins/demo-feature/package.json +214 -0
- package/comate-engine/plugins/demo-timer/assets/icon.svg +2 -0
- package/comate-engine/plugins/demo-timer/dist/index.js +463 -0
- package/comate-engine/plugins/demo-timer/package.json +73 -0
- package/comate-engine/plugins/dev-tools/assets/icon.png +0 -0
- package/comate-engine/plugins/dev-tools/dist/help.md +18 -0
- package/comate-engine/plugins/dev-tools/dist/index.js +166160 -0
- package/comate-engine/plugins/dev-tools/package.json +95 -0
- package/comate-engine/plugins/devaux/assets/icon.svg +1 -0
- package/comate-engine/plugins/devaux/dist/help.md +41 -0
- package/comate-engine/plugins/devaux/dist/index.js +73829 -0
- package/comate-engine/plugins/devaux/dist/static/tree-sitter-cpp.wasm +0 -0
- package/comate-engine/plugins/devaux/dist/static/tree-sitter-go.wasm +0 -0
- package/comate-engine/plugins/devaux/dist/static/tree-sitter.wasm +0 -0
- package/comate-engine/plugins/devaux/dist/tree-sitter.wasm +0 -0
- package/comate-engine/plugins/devaux/package.json +83 -0
- package/comate-engine/plugins/f2c/assets/icon.svg +11 -0
- package/comate-engine/plugins/f2c/dist/help.md +13 -0
- package/comate-engine/plugins/f2c/dist/index.js +64551 -0
- package/comate-engine/plugins/f2c/package.json +56 -0
- package/comate-engine/plugins/fcnap/assets/icon.png +0 -0
- package/comate-engine/plugins/fcnap/dist/help.md +9 -0
- package/comate-engine/plugins/fcnap/dist/index.js +105 -0
- package/comate-engine/plugins/fcnap/package.json +50 -0
- package/comate-engine/plugins/front-end-skills/assets/icon.svg +1 -0
- package/comate-engine/plugins/front-end-skills/dist/help.md +17 -0
- package/comate-engine/plugins/front-end-skills/dist/index.js +8172 -0
- package/comate-engine/plugins/front-end-skills/package.json +79 -0
- package/comate-engine/plugins/gdp/assets/icon.png +0 -0
- package/comate-engine/plugins/gdp/dist/help.md +11 -0
- package/comate-engine/plugins/gdp/dist/index.js +53065 -0
- package/comate-engine/plugins/gdp/package.json +79 -0
- package/comate-engine/plugins/git/assets/git.svg +1 -0
- package/comate-engine/plugins/git/assets/icon.svg +1 -0
- package/comate-engine/plugins/git/dist/help.md +7 -0
- package/comate-engine/plugins/git/dist/index.js +32675 -0
- package/comate-engine/plugins/git/package.json +91 -0
- package/comate-engine/plugins/harmonyos/assets/harmonyos.png +0 -0
- package/comate-engine/plugins/harmonyos/dist/index.js +78 -0
- package/comate-engine/plugins/harmonyos/package.json +37 -0
- package/comate-engine/plugins/iapi/assets/icon.png +0 -0
- package/comate-engine/plugins/iapi/dist/help.md +13 -0
- package/comate-engine/plugins/iapi/dist/index.js +458 -0
- package/comate-engine/plugins/iapi/dist/static/lang/tree-sitter-go.wasm +0 -0
- package/comate-engine/plugins/iapi/dist/static/lang/tree-sitter-java.wasm +0 -0
- package/comate-engine/plugins/iapi/dist/static/tree-sitter-go.wasm +0 -0
- package/comate-engine/plugins/iapi/dist/static/tree-sitter-java.wasm +0 -0
- package/comate-engine/plugins/iapi/dist/tree-sitter.wasm +0 -0
- package/comate-engine/plugins/iapi/package.json +102 -0
- package/comate-engine/plugins/icafe/assets/icafe.svg +1 -0
- package/comate-engine/plugins/icafe/dist/help.md +5 -0
- package/comate-engine/plugins/icafe/dist/index.js +885 -0
- package/comate-engine/plugins/icafe/package.json +74 -0
- package/comate-engine/plugins/ievalue/assets/iEValue.svg +10 -0
- package/comate-engine/plugins/ievalue/dist/index.js +2920 -0
- package/comate-engine/plugins/ievalue/package.json +88 -0
- package/comate-engine/plugins/ipipe/assets/iPipePlugin.png +0 -0
- package/comate-engine/plugins/ipipe/dist/help.md +15 -0
- package/comate-engine/plugins/ipipe/dist/index.js +7264 -0
- package/comate-engine/plugins/ipipe/package.json +62 -0
- package/comate-engine/plugins/jarvis/assets/icon.svg +1 -0
- package/comate-engine/plugins/jarvis/dist/help.md +17 -0
- package/comate-engine/plugins/jarvis/dist/index.js +140416 -0
- package/comate-engine/plugins/jarvis/package.json +93 -0
- package/comate-engine/plugins/mapsearch/assets/mapsearchicon.png +0 -0
- package/comate-engine/plugins/mapsearch/dist/help.md +4 -0
- package/comate-engine/plugins/mapsearch/dist/index.js +145 -0
- package/comate-engine/plugins/mapsearch/package.json +53 -0
- package/comate-engine/plugins/paddle/assets/icon.png +0 -0
- package/comate-engine/plugins/paddle/assets/paconvert-3.0.1-py3-none-any.whl +0 -0
- package/comate-engine/plugins/paddle/dist/help.md +31 -0
- package/comate-engine/plugins/paddle/dist/index.js +1011 -0
- package/comate-engine/plugins/paddle/package.json +129 -0
- package/comate-engine/plugins/robot/assets/Robot.png +0 -0
- package/comate-engine/plugins/robot/dist/index.js +288 -0
- package/comate-engine/plugins/robot/package.json +67 -0
- package/comate-engine/plugins/security/assets/comate.png +0 -0
- package/comate-engine/plugins/security/dist/index.js +18393 -0
- package/comate-engine/plugins/security/package.json +82 -0
- package/comate-engine/plugins/smartapp/assets/icon.png +0 -0
- package/comate-engine/plugins/smartapp/dist/help.md +4 -0
- package/comate-engine/plugins/smartapp/dist/index.js +113 -0
- package/comate-engine/plugins/smartapp/package.json +54 -0
- package/comate-engine/plugins/springer/assets/icon.png +0 -0
- package/comate-engine/plugins/springer/dist/help.md +4 -0
- package/comate-engine/plugins/springer/dist/index.js +94525 -0
- package/comate-engine/plugins/springer/package.json +71 -0
- package/comate-engine/plugins/testmate/assets/icon.svg +1 -0
- package/comate-engine/plugins/testmate/dist/help.md +62 -0
- package/comate-engine/plugins/testmate/dist/index.js +21483 -0
- package/comate-engine/plugins/testmate/package.json +85 -0
- package/comate-engine/plugins/tor/assets/TorPlugin.png +0 -0
- package/comate-engine/plugins/tor/dist/help.md +22 -0
- package/comate-engine/plugins/tor/dist/index.js +807 -0
- package/comate-engine/plugins/tor/package.json +99 -0
- package/comate-engine/plugins/weiyun/assets/icon.png +0 -0
- package/comate-engine/plugins/weiyun/dist/help.md +11 -0
- package/comate-engine/plugins/weiyun/dist/index.js +100491 -0
- package/comate-engine/plugins/weiyun/package.json +55 -0
- package/comate-engine/plugins/wenku/assets/icon.svg +1 -0
- package/comate-engine/plugins/wenku/dist/index.js +249 -0
- package/comate-engine/plugins/wenku/package.json +55 -0
- package/comate-engine/plugins/workcard/assets/favicon.png +0 -0
- package/comate-engine/plugins/workcard/dist/help.md +30 -0
- package/comate-engine/plugins/workcard/dist/index.js +490 -0
- package/comate-engine/plugins/workcard/package.json +95 -0
- package/comate-engine/plugins/xiaomi-aiot/assets/icon.png +0 -0
- package/comate-engine/plugins/xiaomi-aiot/dist/help.md +6 -0
- package/comate-engine/plugins/xiaomi-aiot/dist/index.js +37466 -0
- package/comate-engine/plugins/xiaomi-aiot/package.json +63 -0
- package/comate-engine/server.d.ts +3 -0
- package/comate-engine/server.js +474 -0
- package/dist/bundle/index.js +29 -58174
- package/package.json +2 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
|
|
2
|
+
interface Args {
|
|
3
|
+
query: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class CodeQueryProvider extends SkillProvider<Args> {
|
|
6
|
+
static skillName: string;
|
|
7
|
+
static displayName: string;
|
|
8
|
+
static description: string;
|
|
9
|
+
static parameters: FunctionParameterDefinition;
|
|
10
|
+
execute(): AsyncIterableIterator<TaskProgressChunk>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SkillProvider, StringChunkStream, } from '@comate/plugin-host';
|
|
2
|
+
export class CodeQueryProvider extends SkillProvider {
|
|
3
|
+
static skillName = 'codeQuery';
|
|
4
|
+
static displayName = '代码检索';
|
|
5
|
+
static description = '代码检索';
|
|
6
|
+
static parameters = {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {},
|
|
9
|
+
};
|
|
10
|
+
async *execute() {
|
|
11
|
+
const { query } = this.currentContext;
|
|
12
|
+
const stream = new StringChunkStream();
|
|
13
|
+
try {
|
|
14
|
+
const texts = await this.retriever.codeFromQuery(query, {
|
|
15
|
+
knowledgeSets: [{ uuid: '9d54a9ca-01fd-4547-bf31-27d5cd3e98e2', type: 'NORMAL' }],
|
|
16
|
+
});
|
|
17
|
+
yield stream.flushReplaceLast(texts?.[0] || '无内容');
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
yield stream.flushReplaceLast('代码检索失败');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
|
|
2
|
+
export declare class CodeSearchProvider extends SkillProvider {
|
|
3
|
+
static skillName: string;
|
|
4
|
+
static displayName: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
static parameters: FunctionParameterDefinition;
|
|
7
|
+
execute(): AsyncIterableIterator<TaskProgressChunk>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@comate/plugin-host/jsx-runtime";
|
|
2
|
+
/* eslint-disable max-len */
|
|
3
|
+
import { ElementChunkStream, SkillProvider, } from '@comate/plugin-host';
|
|
4
|
+
export class CodeSearchProvider extends SkillProvider {
|
|
5
|
+
static skillName = 'codeSearch';
|
|
6
|
+
static displayName = '本地代码检索';
|
|
7
|
+
static description = '三方插件支持代码检索调用demo';
|
|
8
|
+
static parameters = {
|
|
9
|
+
type: 'object',
|
|
10
|
+
properties: {},
|
|
11
|
+
};
|
|
12
|
+
async *execute() {
|
|
13
|
+
const stream = new ElementChunkStream();
|
|
14
|
+
const payload = {
|
|
15
|
+
queries: ['梳理代码架构'],
|
|
16
|
+
needRecreateIndex: true,
|
|
17
|
+
maxDuration: 5,
|
|
18
|
+
};
|
|
19
|
+
yield stream.flushReplaceLast(_jsx("loading", { children: "\u5F00\u59CB\u68C0\u7D22\u4EE3\u7801..." }));
|
|
20
|
+
const chunks = await this.llm.getCodeSearchResult(payload);
|
|
21
|
+
const chunkContent = chunks?.map(block => {
|
|
22
|
+
return (_jsx("code-block", { language: "javascript", closed: true, children: block.content }));
|
|
23
|
+
});
|
|
24
|
+
yield stream.flushReplaceLast(_jsx("p", { children: chunkContent }));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
|
|
2
|
+
interface Args {
|
|
3
|
+
key: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class ConfigProvider extends SkillProvider<Args> {
|
|
6
|
+
static skillName: string;
|
|
7
|
+
static displayName: string;
|
|
8
|
+
static description: string;
|
|
9
|
+
static parameters: FunctionParameterDefinition;
|
|
10
|
+
execute(): AsyncIterableIterator<TaskProgressChunk>;
|
|
11
|
+
defaultArgumentValue(): Args;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SkillProvider, TaskProgressChunkStream, } from '@comate/plugin-host';
|
|
2
|
+
export class ConfigProvider extends SkillProvider {
|
|
3
|
+
static skillName = 'config';
|
|
4
|
+
static displayName = '配置';
|
|
5
|
+
static description = '获取配置';
|
|
6
|
+
static parameters = {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {},
|
|
9
|
+
};
|
|
10
|
+
async *execute() {
|
|
11
|
+
const stream = new TaskProgressChunkStream();
|
|
12
|
+
try {
|
|
13
|
+
const modelKey = this.modelKey;
|
|
14
|
+
const configValue = await this.config.getAsString(this.currentContext.query);
|
|
15
|
+
yield stream.flush(`插件配置: ${configValue}\n`);
|
|
16
|
+
yield stream.flush(`当前模型: ${modelKey}`);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
yield stream.flushReplaceLast('获取配置失败');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
defaultArgumentValue() {
|
|
23
|
+
return { key: 'all' };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
|
|
2
|
+
export declare class ContextProvider extends SkillProvider {
|
|
3
|
+
static skillName: string;
|
|
4
|
+
static displayName: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
static parameters: FunctionParameterDefinition;
|
|
7
|
+
private readonly cwd;
|
|
8
|
+
constructor(init: any);
|
|
9
|
+
execute(): AsyncIterableIterator<TaskProgressChunk>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { SkillProvider, StringChunkStream, } from '@comate/plugin-host';
|
|
2
|
+
const contextExplain = {
|
|
3
|
+
query: '用户在对话界面输入的内容',
|
|
4
|
+
selectedCode: '当前编辑器中用户选中的代码块',
|
|
5
|
+
activeFileContent: '当前编辑器中打开的文件的全部内容',
|
|
6
|
+
activeFileLineContent: '当前编辑器中光标所在行的内容',
|
|
7
|
+
activeFilePath: '当前编辑器中打开的文件路径,是一个相对于项目的相对路径',
|
|
8
|
+
activeFileName: '与activeFilePath类似,但只有最后文件名部分,不包含文件目录',
|
|
9
|
+
activeFileLanguage: '当前编辑器打开的文件的编程语言',
|
|
10
|
+
};
|
|
11
|
+
export class ContextProvider extends SkillProvider {
|
|
12
|
+
static skillName = 'context';
|
|
13
|
+
static displayName = '工作现场';
|
|
14
|
+
static description = '工作现场信息';
|
|
15
|
+
static parameters = {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {},
|
|
18
|
+
required: [],
|
|
19
|
+
};
|
|
20
|
+
cwd = '';
|
|
21
|
+
constructor(init) {
|
|
22
|
+
super(init);
|
|
23
|
+
this.cwd = init.cwd;
|
|
24
|
+
}
|
|
25
|
+
async *execute() {
|
|
26
|
+
const stream = new StringChunkStream();
|
|
27
|
+
const context = this.currentContext;
|
|
28
|
+
const host = await this.retriever.hostInfo();
|
|
29
|
+
const path = process.env.PATH;
|
|
30
|
+
try {
|
|
31
|
+
yield stream.flushReplaceLast([
|
|
32
|
+
'```JSON',
|
|
33
|
+
JSON.stringify(host, null, 2),
|
|
34
|
+
`cwd: ${this.cwd}`,
|
|
35
|
+
`path: ${path}`,
|
|
36
|
+
`sessionUuid: ${this.sessionUuid}`,
|
|
37
|
+
'```',
|
|
38
|
+
'```JSON',
|
|
39
|
+
JSON.stringify(context, null, 2),
|
|
40
|
+
JSON.stringify(contextExplain, null, 2),
|
|
41
|
+
'```',
|
|
42
|
+
]
|
|
43
|
+
.join('\n'));
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
yield stream.flushReplaceLast('获取用户信息失败');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
|
|
2
|
+
export declare class DebugAgentProvider extends SkillProvider {
|
|
3
|
+
static skillName: string;
|
|
4
|
+
static displayName: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
static parameters: FunctionParameterDefinition;
|
|
7
|
+
execute(): AsyncIterableIterator<TaskProgressChunk>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@comate/plugin-host/jsx-runtime";
|
|
2
|
+
/* eslint-disable max-len */
|
|
3
|
+
import { ElementChunkStream, SkillProvider, } from '@comate/plugin-host';
|
|
4
|
+
const mockDebugAgentResponse = {
|
|
5
|
+
errorReason: "Null pointer exception",
|
|
6
|
+
contexts: [
|
|
7
|
+
{
|
|
8
|
+
fileName: "main.js",
|
|
9
|
+
lineNumber: 10,
|
|
10
|
+
functionSignature: "function test()",
|
|
11
|
+
codeBlock: "const obj = null; obj.test();",
|
|
12
|
+
message: "Null pointer exception at line 10",
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
content: "You are trying to access a property on a null object",
|
|
16
|
+
blocks: [
|
|
17
|
+
{
|
|
18
|
+
type: 'text',
|
|
19
|
+
content: 'Always check if the object is not null before accessing its properties.'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: 'code',
|
|
23
|
+
content: 'if (obj !== null) { obj.test(); }',
|
|
24
|
+
replaceToFileData: {
|
|
25
|
+
filePath: 'main.js',
|
|
26
|
+
from: 'obj.test();',
|
|
27
|
+
to: 'if (obj !== null) { obj.test(); }',
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'text',
|
|
32
|
+
content: 'Always check if the object is not null before accessing its properties.'
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
};
|
|
36
|
+
export class DebugAgentProvider extends SkillProvider {
|
|
37
|
+
static skillName = 'debugAgent';
|
|
38
|
+
static displayName = 'debug智能体能力';
|
|
39
|
+
static description = 'debug智能体能力调用demo';
|
|
40
|
+
static parameters = {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: {},
|
|
43
|
+
};
|
|
44
|
+
async *execute() {
|
|
45
|
+
const stream = new ElementChunkStream();
|
|
46
|
+
const payload = {
|
|
47
|
+
query: 'test',
|
|
48
|
+
code: `# icode.baidu.com/baidu/ep-qa/ut-golang-demo
|
|
49
|
+
./main.go:38:22: undefined: intArray`,
|
|
50
|
+
};
|
|
51
|
+
const chunks = this.llm.askForDebugAgentProcess(payload);
|
|
52
|
+
for await (const chunk of chunks) {
|
|
53
|
+
const chunkContent = chunk.blocks?.map(block => {
|
|
54
|
+
if (block.type === 'text') {
|
|
55
|
+
return _jsx("markdown", { children: block.content });
|
|
56
|
+
}
|
|
57
|
+
if (block.type === 'code' && block.replaceToFileData?.to) {
|
|
58
|
+
return (_jsx("code-block", { language: "javascript", actions: ['showFileReplaceDiff', 'replaceToFile'], replaceToFileData: block.replaceToFileData, closed: true, children: block.replaceToFileData?.to }));
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
});
|
|
62
|
+
yield stream.flushReplaceLast(_jsx("p", { children: chunkContent }));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FunctionParameterDefinition, SkillProvider, FileSystem, TaskProgressChunk } from '@comate/plugin-host';
|
|
2
|
+
export declare class ExplainCodeProvider extends SkillProvider {
|
|
3
|
+
static skillName: string;
|
|
4
|
+
static displayName: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
static parameters: FunctionParameterDefinition;
|
|
7
|
+
workspaceFileSystem?: FileSystem;
|
|
8
|
+
execute(): AsyncIterableIterator<TaskProgressChunk>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SkillProvider, StringChunkStream, } from '@comate/plugin-host';
|
|
2
|
+
export class ExplainCodeProvider extends SkillProvider {
|
|
3
|
+
static skillName = 'explainCode';
|
|
4
|
+
static displayName = '代码解释';
|
|
5
|
+
static description = '代码解释';
|
|
6
|
+
static parameters = {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {},
|
|
9
|
+
required: [],
|
|
10
|
+
};
|
|
11
|
+
workspaceFileSystem;
|
|
12
|
+
async *execute() {
|
|
13
|
+
const stream = new StringChunkStream();
|
|
14
|
+
try {
|
|
15
|
+
const content = await this.llm.explainCode(this.currentContext.selectedCode, {
|
|
16
|
+
filePath: this.currentContext.activeFilePath,
|
|
17
|
+
});
|
|
18
|
+
yield stream.flushReplaceLast(content);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
yield stream.flushReplaceLast('获取文件失败');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FallbackProvider, TaskProgressChunkStream } from '@comate/plugin-host';
|
|
2
|
+
const DESCRIPTION = `
|
|
3
|
+
'该插件用来展示 Comate+ 能力,目前支持以下能力:
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
* 获取用户信息
|
|
7
|
+
* 获取插件当前配置
|
|
8
|
+
* 获取工作现场基本信息
|
|
9
|
+
* 读取文件内容
|
|
10
|
+
* 打印日志
|
|
11
|
+
* 渲染\`MD\`表格
|
|
12
|
+
* 向大模型提问
|
|
13
|
+
* 知识检索
|
|
14
|
+
|
|
15
|
+
您可以选择上述能力进行体验,也可以通过调整输入内容来体验不同的能力。
|
|
16
|
+
`;
|
|
17
|
+
export class CustomFallbackProvider extends FallbackProvider {
|
|
18
|
+
static description = '能力解释';
|
|
19
|
+
async *handleQuery() {
|
|
20
|
+
const stream = new TaskProgressChunkStream();
|
|
21
|
+
yield stream.flush(DESCRIPTION);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FunctionParameterDefinition, SkillProvider, FileSystem, TaskProgressChunk } from '@comate/plugin-host';
|
|
2
|
+
interface Args {
|
|
3
|
+
fileName: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class FileProvider extends SkillProvider<Args> {
|
|
6
|
+
static skillName: string;
|
|
7
|
+
static displayName: string;
|
|
8
|
+
static description: string;
|
|
9
|
+
static parameters: FunctionParameterDefinition;
|
|
10
|
+
workspaceFileSystem?: FileSystem;
|
|
11
|
+
execute({ fileName }: Args): AsyncIterableIterator<TaskProgressChunk>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SkillProvider, TaskProgressChunkStream, } from '@comate/plugin-host';
|
|
2
|
+
export class FileProvider extends SkillProvider {
|
|
3
|
+
static skillName = 'file';
|
|
4
|
+
static displayName = '操作文件';
|
|
5
|
+
static description = '操作文件';
|
|
6
|
+
static parameters = {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
fileName: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
description: '文件名或者文件路径',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
required: [],
|
|
15
|
+
};
|
|
16
|
+
workspaceFileSystem;
|
|
17
|
+
async *execute({ fileName }) {
|
|
18
|
+
const stream = new TaskProgressChunkStream();
|
|
19
|
+
try {
|
|
20
|
+
const workspaceFileSystem = await this.requestWorkspaceFileSystem();
|
|
21
|
+
if (workspaceFileSystem) {
|
|
22
|
+
this.workspaceFileSystem = workspaceFileSystem;
|
|
23
|
+
const fileDetail = await this.workspaceFileSystem.readFile(fileName);
|
|
24
|
+
yield stream.flushReplaceLast([
|
|
25
|
+
`\`\`\`${this.currentContext.activeFileLanguage}`,
|
|
26
|
+
fileDetail,
|
|
27
|
+
'```',
|
|
28
|
+
]
|
|
29
|
+
.join('\n'));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
yield stream.flushReplaceLast('获取文件失败');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
|
|
2
|
+
export declare class HelpSkillProvider extends SkillProvider {
|
|
3
|
+
static skillName: string;
|
|
4
|
+
static displayName: '插件介绍';
|
|
5
|
+
static description: string;
|
|
6
|
+
static parameters: FunctionParameterDefinition;
|
|
7
|
+
execute(): AsyncIterableIterator<TaskProgressChunk>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SkillProvider, TaskProgressChunkStream, } from '@comate/plugin-host';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { dirname } from 'path';
|
|
5
|
+
export class HelpSkillProvider extends SkillProvider {
|
|
6
|
+
static skillName = 'demo-feature-help';
|
|
7
|
+
static displayName;
|
|
8
|
+
static description = '插件介绍';
|
|
9
|
+
static parameters = {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {},
|
|
12
|
+
};
|
|
13
|
+
async *execute() {
|
|
14
|
+
const stream = new TaskProgressChunkStream();
|
|
15
|
+
const filename = fileURLToPath(import.meta.url);
|
|
16
|
+
const content = readFileSync(`${dirname(filename)}/help.md`, 'utf8');
|
|
17
|
+
yield stream.flush(content);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
|
|
2
|
+
interface Args {
|
|
3
|
+
query: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class InformationProvider extends SkillProvider<Args> {
|
|
6
|
+
static skillName: string;
|
|
7
|
+
static displayName: string;
|
|
8
|
+
static description: string;
|
|
9
|
+
static parameters: FunctionParameterDefinition;
|
|
10
|
+
execute(): AsyncIterableIterator<TaskProgressChunk>;
|
|
11
|
+
defaultArgumentValue(): Args;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SkillProvider, TaskProgressChunkStream, } from '@comate/plugin-host';
|
|
2
|
+
export class InformationProvider extends SkillProvider {
|
|
3
|
+
static skillName = 'information';
|
|
4
|
+
static displayName = '知识检索';
|
|
5
|
+
static description = '知识检索';
|
|
6
|
+
static parameters = {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {},
|
|
9
|
+
};
|
|
10
|
+
async *execute() {
|
|
11
|
+
const stream = new TaskProgressChunkStream();
|
|
12
|
+
try {
|
|
13
|
+
const texts = await this.retriever.knowledgeFromQuery(this.currentContext.query);
|
|
14
|
+
yield stream.flushReplaceLast(texts?.[0] || '无内容');
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
yield stream.flushReplaceLast('知识检索失败');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
defaultArgumentValue() {
|
|
21
|
+
return { query: '任意知识' };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FunctionParameterDefinition, SkillProvider } from '@comate/plugin-host';
|
|
2
|
+
import { TaskProgressChunk } from '@comate/plugin-shared-internals';
|
|
3
|
+
interface Args {
|
|
4
|
+
query: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class KnowledgeProvider extends SkillProvider<Args> {
|
|
7
|
+
static skillName: string;
|
|
8
|
+
static displayName: string;
|
|
9
|
+
static description: string;
|
|
10
|
+
static parameters: FunctionParameterDefinition;
|
|
11
|
+
execute(): AsyncIterableIterator<TaskProgressChunk>;
|
|
12
|
+
defaultArgumentValue(): Args;
|
|
13
|
+
private trimKnowledge;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { SkillProvider, TaskProgressChunkStream, TextModel, } from '@comate/plugin-host';
|
|
2
|
+
import { formatPrompt } from '@comate/plugin-shared-internals';
|
|
3
|
+
import dedent from 'dedent';
|
|
4
|
+
const defaultLlmPromptTemplate = dedent `
|
|
5
|
+
根据我提供的知识,回答我的问题,知识是:
|
|
6
|
+
|
|
7
|
+
{{knowledge}}
|
|
8
|
+
|
|
9
|
+
我的问题是:{{userQuery}}
|
|
10
|
+
`;
|
|
11
|
+
const defaultKnowledgeQueryTemplate = '{{userQuery}}';
|
|
12
|
+
export class KnowledgeProvider extends SkillProvider {
|
|
13
|
+
static skillName = 'knowledge';
|
|
14
|
+
static displayName = '知识增强';
|
|
15
|
+
static description = '知识增强';
|
|
16
|
+
static parameters = {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {},
|
|
19
|
+
};
|
|
20
|
+
async *execute() {
|
|
21
|
+
const stream = new TaskProgressChunkStream();
|
|
22
|
+
const userQuery = this.currentContext.query;
|
|
23
|
+
try {
|
|
24
|
+
const knowledgeUuid = await this.config.getAsString('knowledgeUuid');
|
|
25
|
+
const knowledgeQueryTemplate = await this.config.getAsString('knowledgeQueryTemplate');
|
|
26
|
+
const knowledgePrompt = formatPrompt(knowledgeQueryTemplate || defaultKnowledgeQueryTemplate, { userQuery });
|
|
27
|
+
const texts = await this.retriever.knowledgeFromQuery(knowledgePrompt, {
|
|
28
|
+
knowledgeSets: knowledgeUuid ? [{ uuid: knowledgeUuid, type: 'NORMAL' }] : undefined,
|
|
29
|
+
});
|
|
30
|
+
yield stream.flush(`共检索到${texts.length}条知识:\n\n`);
|
|
31
|
+
yield stream.flush('---\n\n');
|
|
32
|
+
for (const text of texts) {
|
|
33
|
+
yield stream.flush(text.split('\n').map(v => '> ' + v).join('\n') + '\n\n');
|
|
34
|
+
yield stream.flush('---\n\n');
|
|
35
|
+
}
|
|
36
|
+
const knowledge = this.trimKnowledge(texts);
|
|
37
|
+
if (knowledge.length < texts.length) {
|
|
38
|
+
yield stream.flush(`因文本超长,知识检索结果已截断,共截取前${knowledge.length}条\n\n`);
|
|
39
|
+
}
|
|
40
|
+
yield stream.flush('正在请求大模型,这可能需要较长的时间,请耐心等候……\n\n');
|
|
41
|
+
const llmPromptTemplate = await this.config.getAsString('llmPromptTemplate');
|
|
42
|
+
const prompt = this.llm.createPrompt(llmPromptTemplate || defaultLlmPromptTemplate, { knowledge: knowledge.join('\n\n'), userQuery });
|
|
43
|
+
const textModel = await this.config.getAsString('model');
|
|
44
|
+
const content = await this.llm.askForText(prompt, {
|
|
45
|
+
model: textModel || TextModel.Default,
|
|
46
|
+
});
|
|
47
|
+
yield stream.flush('---\n\n');
|
|
48
|
+
yield stream.flush(content || '大模型未返回内容,可能是提示词超长的原因');
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
yield stream.fail('知识增强调用失败');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
defaultArgumentValue() {
|
|
55
|
+
return { query: '任意知识' };
|
|
56
|
+
}
|
|
57
|
+
trimKnowledge(list) {
|
|
58
|
+
const state = {
|
|
59
|
+
length: 0,
|
|
60
|
+
};
|
|
61
|
+
const output = [];
|
|
62
|
+
for (const item of list) {
|
|
63
|
+
if (state.length + item.length > 2000) {
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
output.push(item);
|
|
67
|
+
state.length += item.length;
|
|
68
|
+
}
|
|
69
|
+
return output;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
|
|
2
|
+
interface Args {
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class LogProvider extends SkillProvider<Args> {
|
|
6
|
+
static skillName: string;
|
|
7
|
+
static displayName: string;
|
|
8
|
+
static description: string;
|
|
9
|
+
static parameters: FunctionParameterDefinition;
|
|
10
|
+
execute({ message }: Args): AsyncIterableIterator<TaskProgressChunk>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SkillProvider, TaskProgressChunkStream, } from '@comate/plugin-host';
|
|
2
|
+
export class LogProvider extends SkillProvider {
|
|
3
|
+
static skillName = 'log';
|
|
4
|
+
static displayName = '打印日志';
|
|
5
|
+
static description = '打印日志';
|
|
6
|
+
static parameters = {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
message: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
description: '日志内容任何字符文本都可以',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
required: [],
|
|
15
|
+
};
|
|
16
|
+
async *execute({ message }) {
|
|
17
|
+
const stream = new TaskProgressChunkStream();
|
|
18
|
+
this.logger.info('这里是用户的query:' + message);
|
|
19
|
+
yield stream.flushReplaceLast(message);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
|
|
2
|
+
export declare class OnlyCodeProvider extends SkillProvider {
|
|
3
|
+
static skillName: string;
|
|
4
|
+
static displayName: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
static parameters: FunctionParameterDefinition;
|
|
7
|
+
execute(): AsyncIterableIterator<TaskProgressChunk>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SkillProvider, StringChunkStream, } from '@comate/plugin-host';
|
|
2
|
+
export class OnlyCodeProvider extends SkillProvider {
|
|
3
|
+
static skillName = 'onlyCode';
|
|
4
|
+
static displayName = '返回代码';
|
|
5
|
+
static description = '只返回代码';
|
|
6
|
+
static parameters = {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {},
|
|
9
|
+
required: [],
|
|
10
|
+
};
|
|
11
|
+
async *execute() {
|
|
12
|
+
const stream = new StringChunkStream();
|
|
13
|
+
const { query } = this.currentContext;
|
|
14
|
+
try {
|
|
15
|
+
const prompt = this.llm.createPrompt('给我一个快排', { query });
|
|
16
|
+
const content = await this.llm.askForCode(prompt);
|
|
17
|
+
yield stream.flushReplaceLast(content);
|
|
18
|
+
}
|
|
19
|
+
catch (ex) {
|
|
20
|
+
console.error(ex);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ConfigProvider } from '@comate/plugin-host';
|
|
2
|
+
import { Model } from '@comate/plugin-shared-internals';
|
|
3
|
+
export declare class PluginConfigProvider extends ConfigProvider {
|
|
4
|
+
static skillName: string;
|
|
5
|
+
static displayName: string;
|
|
6
|
+
static description: string;
|
|
7
|
+
getModelList(): Promise<Model[]>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ConfigProvider } from '@comate/plugin-host';
|
|
2
|
+
const mockModelList = [
|
|
3
|
+
{
|
|
4
|
+
modelId: 'GPT-4',
|
|
5
|
+
modelName: 'GPT-4',
|
|
6
|
+
displayName: 'GPT-4',
|
|
7
|
+
isDefault: true,
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
modelId: 'GPT-4 Turbo',
|
|
11
|
+
modelName: 'GPT-4 Turbo',
|
|
12
|
+
displayName: 'GPT-4 Turbo',
|
|
13
|
+
isDefault: false,
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
modelId: 'Deepseek R1',
|
|
17
|
+
modelName: 'Deepseek R1',
|
|
18
|
+
displayName: 'Deepseek R1',
|
|
19
|
+
isDefault: false,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
modelId: 'Gemini Pro',
|
|
23
|
+
modelName: 'Gemini Pro',
|
|
24
|
+
displayName: 'Gemini Pro',
|
|
25
|
+
isDefault: false,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
modelId: 'Claude LLM',
|
|
29
|
+
modelName: 'Claude LLM',
|
|
30
|
+
displayName: 'Claude LLM',
|
|
31
|
+
isDefault: false,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
modelId: 'ERNIE Bot',
|
|
35
|
+
modelName: 'ERNIE Bot',
|
|
36
|
+
displayName: 'ERNIE Bot',
|
|
37
|
+
isDefault: false,
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
export class PluginConfigProvider extends ConfigProvider {
|
|
41
|
+
static skillName = 'pluginConfig';
|
|
42
|
+
static displayName = '插件配置';
|
|
43
|
+
static description = '动态获取插件配置';
|
|
44
|
+
async getModelList() {
|
|
45
|
+
return mockModelList;
|
|
46
|
+
}
|
|
47
|
+
}
|