@comate/zulu 0.0.9 → 0.0.11
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/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 +91 -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,885 @@
|
|
|
1
|
+
import { FallbackProvider, TaskProgressChunkStream, SkillProvider, ElementChunkStream, StringChunkStream, TextModel } from '@comate/plugin-host';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { dirname } from 'path';
|
|
5
|
+
|
|
6
|
+
const DESCRIPTION = `
|
|
7
|
+
该插件目前支持以下能力:
|
|
8
|
+
- 查询卡片(自然语言查询,输入为空时默认查询「最近14天我负责未完成的卡片」)
|
|
9
|
+
- 查询卡片 按标题查询(按照iCafe卡片标题搜索卡片,输入为空时默认查询「最近14天我负责未完成的卡片」)
|
|
10
|
+
|
|
11
|
+
您可以选择上述能力进行体验,也可以通过调整输入内容来体验不同的能力。
|
|
12
|
+
`;
|
|
13
|
+
class HelpFallbackProvider extends FallbackProvider {
|
|
14
|
+
static{
|
|
15
|
+
this.description = '能力解释';
|
|
16
|
+
}
|
|
17
|
+
async *handleQuery() {
|
|
18
|
+
const stream = new TaskProgressChunkStream();
|
|
19
|
+
yield stream.fail(DESCRIPTION);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function jsx(type, props) {
|
|
24
|
+
// 按照React的逻辑,`boolean`、`null`、`undefined`是不会显示出来的
|
|
25
|
+
const children = Array.isArray(props.children) ? props.children.filter((v)=>v != null && typeof v !== 'boolean') : props.children;
|
|
26
|
+
return {
|
|
27
|
+
type,
|
|
28
|
+
...props,
|
|
29
|
+
children
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const SEARCH_DATA_URL = 'http://uflow.weiyun.baidu.com/workflow/api/flow/v1/trigger-webhook/4d9c73fc7e9042bab69257f921b3aff5';
|
|
34
|
+
const CREATE_DATA_URL = 'http://uflow.weiyun.baidu.com/workflow/api/flow/v1/trigger-webhook/2fcdc9d762a34b589e0d5f888464c523';
|
|
35
|
+
const CREATE_CARD_URL = 'http://uflow.weiyun.baidu.com/workflow/api/flow/v1/trigger-webhook/fd01e0c98f1a454792d7430869d35e9a';
|
|
36
|
+
|
|
37
|
+
class searchcmdProvider extends SkillProvider {
|
|
38
|
+
static{
|
|
39
|
+
this.skillName = 'searchBySelf';
|
|
40
|
+
}
|
|
41
|
+
static{
|
|
42
|
+
this.displayName = '查询iCafe卡片';
|
|
43
|
+
}
|
|
44
|
+
static{
|
|
45
|
+
this.description = '查询iCafe卡片';
|
|
46
|
+
}
|
|
47
|
+
static{
|
|
48
|
+
this.parameters = {
|
|
49
|
+
type: 'object',
|
|
50
|
+
properties: {}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
async *execute() {
|
|
54
|
+
const stream = new ElementChunkStream();
|
|
55
|
+
const userDetail = await this.currentUser.requestDetail();
|
|
56
|
+
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
57
|
+
const codePath = this.currentContext.activeFilePath;
|
|
58
|
+
const host = await this.retriever.hostInfo();
|
|
59
|
+
// 用户在输入框输入的问题
|
|
60
|
+
let queryInfo = this.currentContext.query;
|
|
61
|
+
if (!queryInfo) {
|
|
62
|
+
queryInfo = '最近14天我负责的未完成的卡片';
|
|
63
|
+
}
|
|
64
|
+
const tips = `正在为您查询卡片,当前查询条件为「${queryInfo}」,若修改查询条件,可在输入框中自定义`;
|
|
65
|
+
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("loading", {
|
|
66
|
+
children: tips
|
|
67
|
+
}));
|
|
68
|
+
const raw = JSON.stringify({
|
|
69
|
+
query: queryInfo,
|
|
70
|
+
task_engine_userId: realUserName,
|
|
71
|
+
codePath: codePath,
|
|
72
|
+
source: host.appName,
|
|
73
|
+
cmdType: 'searchBySelf'
|
|
74
|
+
});
|
|
75
|
+
const options = {
|
|
76
|
+
method: 'POST',
|
|
77
|
+
headers: {
|
|
78
|
+
'Content-Type': 'application/json'
|
|
79
|
+
},
|
|
80
|
+
body: raw
|
|
81
|
+
};
|
|
82
|
+
try {
|
|
83
|
+
const response = await fetch(SEARCH_DATA_URL, options);
|
|
84
|
+
const result = await response.json();
|
|
85
|
+
const contentArrayDetails = result.content.cardReturnList;
|
|
86
|
+
let icafeLinkMore = result.content.icafeLinkMore;
|
|
87
|
+
const length = contentArrayDetails.length;
|
|
88
|
+
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("span", {
|
|
89
|
+
children: "查询成功,结果如下:"
|
|
90
|
+
}));
|
|
91
|
+
const icafeLinkMoreBack = 'https://console.cloud.baidu-int.com/devops/icafe/workspace';
|
|
92
|
+
if (icafeLinkMore === '') {
|
|
93
|
+
icafeLinkMore = icafeLinkMoreBack;
|
|
94
|
+
}
|
|
95
|
+
if (length !== 0) {
|
|
96
|
+
for(let i = 0; i < length; i++){
|
|
97
|
+
const cardPart = contentArrayDetails[i];
|
|
98
|
+
const cardIdAndTile = cardPart.cardIdAndTile;
|
|
99
|
+
const cardType = cardPart.cardType;
|
|
100
|
+
const cardStatus = cardPart.cardStatus;
|
|
101
|
+
const cardPlan = cardPart.cardPlan;
|
|
102
|
+
const cardDetailUrl = cardPart.cardDetailUrl;
|
|
103
|
+
const sequenceId = cardPart.sequenceId;
|
|
104
|
+
const title = cardPart.title;
|
|
105
|
+
const other_context = cardType + ' | ' + cardStatus + ' | ' + cardPlan;
|
|
106
|
+
const commit_context = 'git commit -m \'' + cardIdAndTile + '\'';
|
|
107
|
+
const tooltipText = '点击输入指令到终端:' + commit_context;
|
|
108
|
+
const markdownStr = ``;
|
|
109
|
+
yield stream.flush(/*#__PURE__*/ jsx("p", {
|
|
110
|
+
children: /*#__PURE__*/ jsx("blockquote", {
|
|
111
|
+
children: [
|
|
112
|
+
/*#__PURE__*/ jsx("p", {
|
|
113
|
+
children: /*#__PURE__*/ jsx("flex", {
|
|
114
|
+
betweenCentered: true,
|
|
115
|
+
gap: "m",
|
|
116
|
+
children: [
|
|
117
|
+
/*#__PURE__*/ jsx("flex", {
|
|
118
|
+
gap: "m",
|
|
119
|
+
children: /*#__PURE__*/ jsx("a", {
|
|
120
|
+
href: cardDetailUrl,
|
|
121
|
+
children: sequenceId
|
|
122
|
+
})
|
|
123
|
+
}),
|
|
124
|
+
/*#__PURE__*/ jsx("flex", {
|
|
125
|
+
flexEndCentered: true,
|
|
126
|
+
gap: "m",
|
|
127
|
+
children: [
|
|
128
|
+
/*#__PURE__*/ jsx("command-button", {
|
|
129
|
+
commandName: "commitMessage:confirmIssue",
|
|
130
|
+
action: "copy",
|
|
131
|
+
tooltipText: "点击复制: 卡片ID+标题",
|
|
132
|
+
actionData: cardIdAndTile,
|
|
133
|
+
data: "yes",
|
|
134
|
+
children: "复制"
|
|
135
|
+
}),
|
|
136
|
+
/*#__PURE__*/ jsx("command-button", {
|
|
137
|
+
commandName: "commitMessage:confirmIssue",
|
|
138
|
+
action: "insertIntoTerminal",
|
|
139
|
+
tooltipText: tooltipText,
|
|
140
|
+
actionData: commit_context,
|
|
141
|
+
data: "yes",
|
|
142
|
+
children: "绑卡"
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
})
|
|
148
|
+
}),
|
|
149
|
+
title,
|
|
150
|
+
/*#__PURE__*/ jsx("p", {
|
|
151
|
+
children: other_context
|
|
152
|
+
})
|
|
153
|
+
]
|
|
154
|
+
})
|
|
155
|
+
}));
|
|
156
|
+
if (i === length - 1) {
|
|
157
|
+
yield stream.flush(/*#__PURE__*/ jsx("flex", {
|
|
158
|
+
flexEndCentered: true,
|
|
159
|
+
children: /*#__PURE__*/ jsx("a", {
|
|
160
|
+
href: icafeLinkMore,
|
|
161
|
+
children: "↗去iCafe查看更多"
|
|
162
|
+
})
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
yield stream.flush(/*#__PURE__*/ jsx("p", {
|
|
168
|
+
children: /*#__PURE__*/ jsx("flex", {
|
|
169
|
+
children: [
|
|
170
|
+
"您暂时没有待处理的任务~ | ",
|
|
171
|
+
/*#__PURE__*/ jsx("a", {
|
|
172
|
+
href: icafeLinkMore,
|
|
173
|
+
children: "↗去iCafe查看更多"
|
|
174
|
+
})
|
|
175
|
+
]
|
|
176
|
+
})
|
|
177
|
+
}));
|
|
178
|
+
}
|
|
179
|
+
} catch (ex) {
|
|
180
|
+
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("p", {
|
|
181
|
+
children: [
|
|
182
|
+
"请求出错,请联系负责人wangjie66或稍后再试。",
|
|
183
|
+
ex instanceof Error ? ex.message : ''
|
|
184
|
+
]
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
class findbyTitleProvider extends SkillProvider {
|
|
191
|
+
static{
|
|
192
|
+
this.skillName = 'findByTitle';
|
|
193
|
+
}
|
|
194
|
+
static{
|
|
195
|
+
this.displayName = '标题包含XXX的卡片';
|
|
196
|
+
}
|
|
197
|
+
static{
|
|
198
|
+
this.description = '查询iCafe卡片';
|
|
199
|
+
}
|
|
200
|
+
static{
|
|
201
|
+
this.parameters = {
|
|
202
|
+
type: 'object',
|
|
203
|
+
properties: {}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
async *execute() {
|
|
207
|
+
const stream = new ElementChunkStream();
|
|
208
|
+
const userDetail = await this.currentUser.requestDetail();
|
|
209
|
+
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
210
|
+
const codePath = this.currentContext.activeFilePath;
|
|
211
|
+
const host = await this.retriever.hostInfo();
|
|
212
|
+
const queryDefault = '我负责的关键字包含needReplaceTitle的卡片';
|
|
213
|
+
// 用户在输入框输入的问题
|
|
214
|
+
let queryInfo = this.currentContext.query;
|
|
215
|
+
if (!queryInfo) {
|
|
216
|
+
queryInfo = '最近14天我负责的未完成的卡片';
|
|
217
|
+
} else {
|
|
218
|
+
queryInfo = queryDefault.replace('needReplaceTitle', queryInfo);
|
|
219
|
+
}
|
|
220
|
+
const tips = `正在为您查询卡片,当前查询条件为「${queryInfo}」,若修改查询条件,可在输入框中自定义`;
|
|
221
|
+
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("loading", {
|
|
222
|
+
children: tips
|
|
223
|
+
}));
|
|
224
|
+
const raw = JSON.stringify({
|
|
225
|
+
query: queryInfo,
|
|
226
|
+
task_engine_userId: realUserName,
|
|
227
|
+
codePath: codePath,
|
|
228
|
+
source: host.appName,
|
|
229
|
+
cmdType: 'findByTitle'
|
|
230
|
+
});
|
|
231
|
+
const options = {
|
|
232
|
+
method: 'POST',
|
|
233
|
+
headers: {
|
|
234
|
+
'Content-Type': 'application/json'
|
|
235
|
+
},
|
|
236
|
+
body: raw
|
|
237
|
+
};
|
|
238
|
+
try {
|
|
239
|
+
const response = await fetch(SEARCH_DATA_URL, options);
|
|
240
|
+
const result = await response.json();
|
|
241
|
+
const contentArrayDetails = result.content.cardReturnList;
|
|
242
|
+
let icafeLinkMore = result.content.icafeLinkMore;
|
|
243
|
+
const length = contentArrayDetails.length;
|
|
244
|
+
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("span", {
|
|
245
|
+
children: "查询成功,结果如下:"
|
|
246
|
+
}));
|
|
247
|
+
const icafeLinkMoreBack = 'https://console.cloud.baidu-int.com/devops/icafe/workspace';
|
|
248
|
+
if (icafeLinkMore === '') {
|
|
249
|
+
icafeLinkMore = icafeLinkMoreBack;
|
|
250
|
+
}
|
|
251
|
+
if (length !== 0) {
|
|
252
|
+
for(let i = 0; i < length; i++){
|
|
253
|
+
const cardPart = contentArrayDetails[i];
|
|
254
|
+
const cardIdAndTile = cardPart.cardIdAndTile;
|
|
255
|
+
const cardType = cardPart.cardType;
|
|
256
|
+
const cardStatus = cardPart.cardStatus;
|
|
257
|
+
const cardPlan = cardPart.cardPlan;
|
|
258
|
+
const cardDetailUrl = cardPart.cardDetailUrl;
|
|
259
|
+
const sequenceId = cardPart.sequenceId;
|
|
260
|
+
const title = cardPart.title;
|
|
261
|
+
const other_context = cardType + ' | ' + cardStatus + ' | ' + cardPlan;
|
|
262
|
+
const commit_context = 'git commit -m \'' + cardIdAndTile + '\'';
|
|
263
|
+
const tooltipText = '点击输入指令到终端:' + commit_context;
|
|
264
|
+
const markdownStr = ``;
|
|
265
|
+
yield stream.flush(/*#__PURE__*/ jsx("p", {
|
|
266
|
+
children: /*#__PURE__*/ jsx("blockquote", {
|
|
267
|
+
children: [
|
|
268
|
+
/*#__PURE__*/ jsx("p", {
|
|
269
|
+
children: /*#__PURE__*/ jsx("flex", {
|
|
270
|
+
betweenCentered: true,
|
|
271
|
+
gap: "m",
|
|
272
|
+
children: [
|
|
273
|
+
/*#__PURE__*/ jsx("flex", {
|
|
274
|
+
gap: "m",
|
|
275
|
+
children: /*#__PURE__*/ jsx("a", {
|
|
276
|
+
href: cardDetailUrl,
|
|
277
|
+
children: sequenceId
|
|
278
|
+
})
|
|
279
|
+
}),
|
|
280
|
+
/*#__PURE__*/ jsx("flex", {
|
|
281
|
+
flexEndCentered: true,
|
|
282
|
+
gap: "m",
|
|
283
|
+
children: [
|
|
284
|
+
/*#__PURE__*/ jsx("command-button", {
|
|
285
|
+
commandName: "commitMessage:confirmIssue",
|
|
286
|
+
action: "copy",
|
|
287
|
+
tooltipText: "点击复制: 卡片ID+标题",
|
|
288
|
+
actionData: cardIdAndTile,
|
|
289
|
+
data: "yes",
|
|
290
|
+
children: "复制"
|
|
291
|
+
}),
|
|
292
|
+
/*#__PURE__*/ jsx("command-button", {
|
|
293
|
+
commandName: "commitMessage:confirmIssue",
|
|
294
|
+
action: "insertIntoTerminal",
|
|
295
|
+
tooltipText: tooltipText,
|
|
296
|
+
actionData: commit_context,
|
|
297
|
+
data: "yes",
|
|
298
|
+
children: "绑卡"
|
|
299
|
+
})
|
|
300
|
+
]
|
|
301
|
+
})
|
|
302
|
+
]
|
|
303
|
+
})
|
|
304
|
+
}),
|
|
305
|
+
title,
|
|
306
|
+
/*#__PURE__*/ jsx("p", {
|
|
307
|
+
children: other_context
|
|
308
|
+
})
|
|
309
|
+
]
|
|
310
|
+
})
|
|
311
|
+
}));
|
|
312
|
+
if (i === length - 1) {
|
|
313
|
+
yield stream.flush(/*#__PURE__*/ jsx("flex", {
|
|
314
|
+
flexEndCentered: true,
|
|
315
|
+
children: /*#__PURE__*/ jsx("a", {
|
|
316
|
+
href: icafeLinkMore,
|
|
317
|
+
children: "↗去iCafe查看更多"
|
|
318
|
+
})
|
|
319
|
+
}));
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
} else {
|
|
323
|
+
yield stream.flush(/*#__PURE__*/ jsx("p", {
|
|
324
|
+
children: /*#__PURE__*/ jsx("flex", {
|
|
325
|
+
children: [
|
|
326
|
+
"您暂时没有待处理的任务~ | ",
|
|
327
|
+
/*#__PURE__*/ jsx("a", {
|
|
328
|
+
href: icafeLinkMore,
|
|
329
|
+
children: "↗去iCafe查看更多"
|
|
330
|
+
})
|
|
331
|
+
]
|
|
332
|
+
})
|
|
333
|
+
}));
|
|
334
|
+
}
|
|
335
|
+
} catch (ex) {
|
|
336
|
+
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("p", {
|
|
337
|
+
children: [
|
|
338
|
+
"请求出错,请联系负责人wangjie66或稍后再试。",
|
|
339
|
+
ex instanceof Error ? ex.message : ''
|
|
340
|
+
]
|
|
341
|
+
}));
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
defaultArgumentValue() {
|
|
345
|
+
return {
|
|
346
|
+
query: '任意代码'
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
class createCardProvider extends SkillProvider {
|
|
352
|
+
static{
|
|
353
|
+
this.skillName = 'createCard';
|
|
354
|
+
}
|
|
355
|
+
static{
|
|
356
|
+
this.displayName = '新建卡片';
|
|
357
|
+
}
|
|
358
|
+
static{
|
|
359
|
+
this.description = '新建iCafe卡片';
|
|
360
|
+
}
|
|
361
|
+
static{
|
|
362
|
+
this.parameters = {
|
|
363
|
+
type: 'object',
|
|
364
|
+
properties: {}
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
get elementChunkStream() {
|
|
368
|
+
if (!this._elementChunkStream) {
|
|
369
|
+
this._elementChunkStream = new ElementChunkStream();
|
|
370
|
+
}
|
|
371
|
+
return this._elementChunkStream;
|
|
372
|
+
}
|
|
373
|
+
async *execute() {
|
|
374
|
+
const stream = new ElementChunkStream();
|
|
375
|
+
const userDetail = await this.currentUser.requestDetail();
|
|
376
|
+
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
377
|
+
const codePath = this.currentContext.activeFilePath;
|
|
378
|
+
const host = await this.retriever.hostInfo();
|
|
379
|
+
const spaceCodes = [];
|
|
380
|
+
// 用户在输入框输入的问题
|
|
381
|
+
let queryInfo = this.currentContext.query;
|
|
382
|
+
if (!queryInfo) {
|
|
383
|
+
queryInfo = '创建卡片';
|
|
384
|
+
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("flex", {
|
|
385
|
+
gap: "m",
|
|
386
|
+
children: /*#__PURE__*/ jsx("p", {
|
|
387
|
+
children: "请输入卡片标题"
|
|
388
|
+
})
|
|
389
|
+
}));
|
|
390
|
+
} else {
|
|
391
|
+
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("loading", {
|
|
392
|
+
children: "所属空间数据加载中..."
|
|
393
|
+
}));
|
|
394
|
+
console.log('queryInfo:', queryInfo);
|
|
395
|
+
const raw = JSON.stringify({
|
|
396
|
+
query: queryInfo,
|
|
397
|
+
task_engine_userId: realUserName,
|
|
398
|
+
codePath: codePath,
|
|
399
|
+
source: host.appName,
|
|
400
|
+
cmdType: 'createCard'
|
|
401
|
+
});
|
|
402
|
+
const options = {
|
|
403
|
+
method: 'POST',
|
|
404
|
+
headers: {
|
|
405
|
+
'Content-Type': 'application/json'
|
|
406
|
+
},
|
|
407
|
+
body: raw
|
|
408
|
+
};
|
|
409
|
+
try {
|
|
410
|
+
const response = await fetch(CREATE_DATA_URL, options);
|
|
411
|
+
const result = await response.json();
|
|
412
|
+
const contentArrayDetails = result.content;
|
|
413
|
+
let icafeLinkMore = result.content.icafeLinkMore;
|
|
414
|
+
const length = contentArrayDetails.length;
|
|
415
|
+
yield this.elementChunkStream.flushReplaceLast(/*#__PURE__*/ jsx("flex", {
|
|
416
|
+
gap: "m",
|
|
417
|
+
children: /*#__PURE__*/ jsx("p", {
|
|
418
|
+
children: [
|
|
419
|
+
"卡片标题: ",
|
|
420
|
+
queryInfo
|
|
421
|
+
]
|
|
422
|
+
})
|
|
423
|
+
}));
|
|
424
|
+
if (length !== 0) {
|
|
425
|
+
for(let i = 0; i < length; i++){
|
|
426
|
+
const cardPart = contentArrayDetails[i];
|
|
427
|
+
const spaceCode = cardPart.spaceCode;
|
|
428
|
+
spaceCodes.push(spaceCode);
|
|
429
|
+
}
|
|
430
|
+
yield this._dealFiledsShow(spaceCodes, "请选择所属空间");
|
|
431
|
+
// 等待用户选择
|
|
432
|
+
const userSelectedSpace = await new Promise((resolve)=>{
|
|
433
|
+
this.selectionPromiseResolve = resolve;
|
|
434
|
+
});
|
|
435
|
+
console.log('用户选择空间是:', userSelectedSpace);
|
|
436
|
+
for(let i = 0; i < length; i++){
|
|
437
|
+
const cardPart = contentArrayDetails[i];
|
|
438
|
+
const spaceCode = cardPart.spaceCode;
|
|
439
|
+
if (spaceCode === userSelectedSpace) {
|
|
440
|
+
this.userSpace = cardPart.id;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
for(let i = 0; i < length; i++){
|
|
444
|
+
const cardPart = contentArrayDetails[i];
|
|
445
|
+
if (userSelectedSpace == cardPart.spaceCode) {
|
|
446
|
+
const cardTypeList = cardPart.cardTypeList;
|
|
447
|
+
const cardTypeId = cardPart.cardTypeIdList;
|
|
448
|
+
yield this._dealFiledsShow(cardTypeList, "请选择所属空间卡片类型");
|
|
449
|
+
const userSelectedCardType = await new Promise((resolve)=>{
|
|
450
|
+
this.selectionPromiseResolve = resolve;
|
|
451
|
+
});
|
|
452
|
+
// 获取用户选择的索引
|
|
453
|
+
const selectedCardTypeIndex = cardTypeList.indexOf(userSelectedCardType);
|
|
454
|
+
this.userCardType = cardTypeId[selectedCardTypeIndex];
|
|
455
|
+
const cardPlan = cardPart.plan;
|
|
456
|
+
const planId = cardPart.planId;
|
|
457
|
+
console.log(planId);
|
|
458
|
+
yield this._dealPlanShow(cardPlan, "请选择计划");
|
|
459
|
+
const userSelectedCardPlan = await new Promise((resolve)=>{
|
|
460
|
+
this.selectionPromiseResolve = resolve;
|
|
461
|
+
});
|
|
462
|
+
// 获取用户选择计划对应的索引
|
|
463
|
+
const selectedPlanIndex = cardPlan.indexOf(userSelectedCardPlan);
|
|
464
|
+
this.userPlan = planId[selectedPlanIndex];
|
|
465
|
+
}
|
|
466
|
+
console.log(i);
|
|
467
|
+
}
|
|
468
|
+
yield this.elementChunkStream.flush(/*#__PURE__*/ jsx("flex", {
|
|
469
|
+
flexEndCentered: true,
|
|
470
|
+
gap: "m",
|
|
471
|
+
children: /*#__PURE__*/ jsx("command-button", {
|
|
472
|
+
commandName: "commitMessage:confirmIssue",
|
|
473
|
+
data: {
|
|
474
|
+
title: queryInfo,
|
|
475
|
+
userSelectedCardType: this.userCardType,
|
|
476
|
+
userSelectedCardPlan: this.userPlan,
|
|
477
|
+
task_engine_userId: realUserName,
|
|
478
|
+
spaceId: this.userSpace,
|
|
479
|
+
source: host.appName,
|
|
480
|
+
cmdType: 'createCard'
|
|
481
|
+
},
|
|
482
|
+
replyText: "卡片数据已提交",
|
|
483
|
+
variant: "primary",
|
|
484
|
+
children: "创建卡片"
|
|
485
|
+
})
|
|
486
|
+
}));
|
|
487
|
+
yield this.elementChunkStream.flush(/*#__PURE__*/ jsx("hr", {}));
|
|
488
|
+
} else {
|
|
489
|
+
yield stream.flush(/*#__PURE__*/ jsx("p", {
|
|
490
|
+
children: /*#__PURE__*/ jsx("flex", {
|
|
491
|
+
children: [
|
|
492
|
+
"您暂时没有待处理的任务~ | ",
|
|
493
|
+
/*#__PURE__*/ jsx("a", {
|
|
494
|
+
href: icafeLinkMore,
|
|
495
|
+
children: "↗去iCafe查看更多"
|
|
496
|
+
})
|
|
497
|
+
]
|
|
498
|
+
})
|
|
499
|
+
}));
|
|
500
|
+
}
|
|
501
|
+
} catch (ex) {
|
|
502
|
+
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("p", {
|
|
503
|
+
children: [
|
|
504
|
+
"请求出错,请联系负责人wangjie66或稍后再试。",
|
|
505
|
+
ex instanceof Error ? ex.message : ''
|
|
506
|
+
]
|
|
507
|
+
}));
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
defaultArgumentValue() {
|
|
512
|
+
return {
|
|
513
|
+
query: '任意代码'
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
async *handleCommand(commandName, data) {
|
|
517
|
+
const stream = new ElementChunkStream();
|
|
518
|
+
if (commandName === "commitMessage:submit") {
|
|
519
|
+
this.selectionPromiseResolve?.(data);
|
|
520
|
+
yield this._dealSubmitData(data, "已选择");
|
|
521
|
+
}
|
|
522
|
+
// 处理 "commitMessage:confirmIssue" 命令(点击创建卡片按钮)
|
|
523
|
+
if (commandName === "commitMessage:confirmIssue") {
|
|
524
|
+
const { title, userSelectedCardType, userSelectedCardPlan, task_engine_userId, spaceId, source, cmdType } = data;
|
|
525
|
+
// 构造请求数据
|
|
526
|
+
const raw = JSON.stringify({
|
|
527
|
+
title,
|
|
528
|
+
userSelectedCardType,
|
|
529
|
+
userSelectedCardPlan,
|
|
530
|
+
task_engine_userId,
|
|
531
|
+
spaceId,
|
|
532
|
+
source,
|
|
533
|
+
cmdType
|
|
534
|
+
});
|
|
535
|
+
// 调用接口
|
|
536
|
+
try {
|
|
537
|
+
const response = await fetch(CREATE_CARD_URL, {
|
|
538
|
+
method: 'POST',
|
|
539
|
+
headers: {
|
|
540
|
+
'Content-Type': 'application/json'
|
|
541
|
+
},
|
|
542
|
+
body: raw
|
|
543
|
+
});
|
|
544
|
+
const result = await response.json();
|
|
545
|
+
// 显示成功或失败信息
|
|
546
|
+
if (response.ok) {
|
|
547
|
+
// 从返回值中提取需要的数据
|
|
548
|
+
const cardDetail = result.data.content;
|
|
549
|
+
console.log("cardDetail", cardDetail);
|
|
550
|
+
const cardUrl = cardDetail.url;
|
|
551
|
+
const cardTitle = cardDetail.title;
|
|
552
|
+
const sequenceId = cardDetail.cardId;
|
|
553
|
+
const spaceCardTitle = cardDetail.spaceCardTitle;
|
|
554
|
+
const cardStatus = cardDetail.cardStatus;
|
|
555
|
+
const planName = cardDetail.planName;
|
|
556
|
+
const cardType = cardDetail.cardType;
|
|
557
|
+
const spaceCode = cardDetail.spaceCode;
|
|
558
|
+
console.log("spaceCardTitle", spaceCardTitle);
|
|
559
|
+
console.log("cardTitle", cardTitle);
|
|
560
|
+
const other_context = cardType + ' | ' + cardStatus + ' | ' + planName;
|
|
561
|
+
const commit_context = 'git commit -m \'' + spaceCardTitle + '\'';
|
|
562
|
+
const tooltipText = '点击输入指令到终端: ' + commit_context;
|
|
563
|
+
const spaceCardId = spaceCode + '-' + sequenceId;
|
|
564
|
+
// 渲染卡片创建成功的信息和链接
|
|
565
|
+
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("span", {
|
|
566
|
+
children: "卡片创建成功!"
|
|
567
|
+
}));
|
|
568
|
+
yield stream.flush(/*#__PURE__*/ jsx("p", {
|
|
569
|
+
children: /*#__PURE__*/ jsx("blockquote", {
|
|
570
|
+
children: [
|
|
571
|
+
/*#__PURE__*/ jsx("p", {
|
|
572
|
+
children: /*#__PURE__*/ jsx("flex", {
|
|
573
|
+
betweenCentered: true,
|
|
574
|
+
gap: "m",
|
|
575
|
+
children: [
|
|
576
|
+
/*#__PURE__*/ jsx("flex", {
|
|
577
|
+
gap: "m",
|
|
578
|
+
children: /*#__PURE__*/ jsx("a", {
|
|
579
|
+
href: cardUrl,
|
|
580
|
+
children: spaceCardId
|
|
581
|
+
})
|
|
582
|
+
}),
|
|
583
|
+
/*#__PURE__*/ jsx("flex", {
|
|
584
|
+
flexEndCentered: true,
|
|
585
|
+
gap: "m",
|
|
586
|
+
children: [
|
|
587
|
+
/*#__PURE__*/ jsx("command-button", {
|
|
588
|
+
commandName: "commitMessage:confirmIssue",
|
|
589
|
+
action: "copy",
|
|
590
|
+
tooltipText: "点击复制: 卡片ID+标题",
|
|
591
|
+
actionData: spaceCardTitle,
|
|
592
|
+
data: "yes",
|
|
593
|
+
children: "复制"
|
|
594
|
+
}),
|
|
595
|
+
/*#__PURE__*/ jsx("command-button", {
|
|
596
|
+
commandName: "commitMessage:confirmIssue",
|
|
597
|
+
action: "insertIntoTerminal",
|
|
598
|
+
tooltipText: tooltipText,
|
|
599
|
+
actionData: commit_context,
|
|
600
|
+
data: "yes",
|
|
601
|
+
children: "绑卡"
|
|
602
|
+
})
|
|
603
|
+
]
|
|
604
|
+
})
|
|
605
|
+
]
|
|
606
|
+
})
|
|
607
|
+
}),
|
|
608
|
+
title,
|
|
609
|
+
/*#__PURE__*/ jsx("p", {
|
|
610
|
+
children: other_context
|
|
611
|
+
})
|
|
612
|
+
]
|
|
613
|
+
})
|
|
614
|
+
}));
|
|
615
|
+
} else {
|
|
616
|
+
yield stream.flush(/*#__PURE__*/ jsx("p", {
|
|
617
|
+
children: [
|
|
618
|
+
"卡片创建失败:",
|
|
619
|
+
result.message || '未知错误'
|
|
620
|
+
]
|
|
621
|
+
}));
|
|
622
|
+
}
|
|
623
|
+
} catch (ex) {
|
|
624
|
+
yield stream.flush(/*#__PURE__*/ jsx("p", {
|
|
625
|
+
children: [
|
|
626
|
+
"请求出错:",
|
|
627
|
+
ex instanceof Error ? ex.message : '未知错误'
|
|
628
|
+
]
|
|
629
|
+
}));
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
async _dealSubmitData(data, fieldName) {
|
|
634
|
+
return this.elementChunkStream.flush(/*#__PURE__*/ jsx("flex", {
|
|
635
|
+
gap: "s",
|
|
636
|
+
children: /*#__PURE__*/ jsx("flex", {
|
|
637
|
+
children: /*#__PURE__*/ jsx("p", {
|
|
638
|
+
children: [
|
|
639
|
+
fieldName,
|
|
640
|
+
":",
|
|
641
|
+
data
|
|
642
|
+
]
|
|
643
|
+
})
|
|
644
|
+
})
|
|
645
|
+
}));
|
|
646
|
+
}
|
|
647
|
+
async _dealFiledsShow(cardTypeList, fieldName) {
|
|
648
|
+
console.log('[provider] code data', cardTypeList);
|
|
649
|
+
const cardTypeBtns = [];
|
|
650
|
+
for(let i = 0; i < cardTypeList.length; i++){
|
|
651
|
+
const buttons = {
|
|
652
|
+
variant: "text",
|
|
653
|
+
text: cardTypeList[i],
|
|
654
|
+
data: cardTypeList[i],
|
|
655
|
+
commandName: "commitMessage:submit"
|
|
656
|
+
};
|
|
657
|
+
cardTypeBtns.push(buttons);
|
|
658
|
+
}
|
|
659
|
+
const btns = cardTypeBtns.map((btnConfig, index)=>{
|
|
660
|
+
return /*#__PURE__*/ jsx("command-button", {
|
|
661
|
+
commandName: btnConfig.commandName,
|
|
662
|
+
data: btnConfig.data,
|
|
663
|
+
replyText: btnConfig.replyText,
|
|
664
|
+
variant: btnConfig.variant,
|
|
665
|
+
children: btnConfig.text
|
|
666
|
+
});
|
|
667
|
+
});
|
|
668
|
+
return this.elementChunkStream.flush(/*#__PURE__*/ jsx("flex", {
|
|
669
|
+
gap: "s",
|
|
670
|
+
children: [
|
|
671
|
+
/*#__PURE__*/ jsx("flex", {
|
|
672
|
+
children: /*#__PURE__*/ jsx("p", {
|
|
673
|
+
children: [
|
|
674
|
+
fieldName,
|
|
675
|
+
":"
|
|
676
|
+
]
|
|
677
|
+
})
|
|
678
|
+
}),
|
|
679
|
+
/*#__PURE__*/ jsx("flex", {
|
|
680
|
+
children: btns
|
|
681
|
+
})
|
|
682
|
+
]
|
|
683
|
+
}));
|
|
684
|
+
}
|
|
685
|
+
async _dealPlanShow(cardTypeList, fieldName) {
|
|
686
|
+
console.log('[provider] code data', cardTypeList);
|
|
687
|
+
const cardTypeBtns = [];
|
|
688
|
+
for(let i = 0; i < cardTypeList.length; i++){
|
|
689
|
+
const buttons = {
|
|
690
|
+
variant: "text",
|
|
691
|
+
text: cardTypeList[i],
|
|
692
|
+
data: cardTypeList[i],
|
|
693
|
+
commandName: "commitMessage:submit"
|
|
694
|
+
};
|
|
695
|
+
cardTypeBtns.push(buttons);
|
|
696
|
+
}
|
|
697
|
+
const btns = cardTypeBtns.map((btnConfig, index)=>{
|
|
698
|
+
return /*#__PURE__*/ jsx("p", {
|
|
699
|
+
children: /*#__PURE__*/ jsx("flex", {
|
|
700
|
+
gap: "s",
|
|
701
|
+
children: [
|
|
702
|
+
/*#__PURE__*/ jsx("flex", {
|
|
703
|
+
children: /*#__PURE__*/ jsx("p", {
|
|
704
|
+
children: index === 0 ? fieldName + ':' : '\u00A0'.repeat(fieldName.length + 12)
|
|
705
|
+
})
|
|
706
|
+
}),
|
|
707
|
+
/*#__PURE__*/ jsx("flex", {
|
|
708
|
+
children: /*#__PURE__*/ jsx("command-button", {
|
|
709
|
+
commandName: btnConfig.commandName,
|
|
710
|
+
data: btnConfig.data,
|
|
711
|
+
replyText: btnConfig.replyText,
|
|
712
|
+
variant: btnConfig.variant,
|
|
713
|
+
children: btnConfig.text
|
|
714
|
+
})
|
|
715
|
+
})
|
|
716
|
+
]
|
|
717
|
+
})
|
|
718
|
+
});
|
|
719
|
+
});
|
|
720
|
+
return this.elementChunkStream.flush(/*#__PURE__*/ jsx("p", {
|
|
721
|
+
children: btns
|
|
722
|
+
}));
|
|
723
|
+
}
|
|
724
|
+
constructor(...args){
|
|
725
|
+
super(...args), this.selectionPromiseResolve = null, this.userSpace = '', this.userCardType = '', this.userPlan = '';
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
730
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
731
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
732
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
733
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
734
|
+
const dedent = createDedent({});
|
|
735
|
+
function createDedent(options) {
|
|
736
|
+
dedent.withOptions = newOptions => createDedent(_objectSpread(_objectSpread({}, options), newOptions));
|
|
737
|
+
return dedent;
|
|
738
|
+
function dedent(strings, ...values) {
|
|
739
|
+
const raw = typeof strings === "string" ? [strings] : strings.raw;
|
|
740
|
+
const {
|
|
741
|
+
escapeSpecialCharacters = Array.isArray(strings)
|
|
742
|
+
} = options;
|
|
743
|
+
|
|
744
|
+
// first, perform interpolation
|
|
745
|
+
let result = "";
|
|
746
|
+
for (let i = 0; i < raw.length; i++) {
|
|
747
|
+
let next = raw[i];
|
|
748
|
+
if (escapeSpecialCharacters) {
|
|
749
|
+
// handle escaped newlines, backticks, and interpolation characters
|
|
750
|
+
next = next.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{");
|
|
751
|
+
}
|
|
752
|
+
result += next;
|
|
753
|
+
if (i < values.length) {
|
|
754
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
755
|
+
result += values[i];
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
// now strip indentation
|
|
760
|
+
const lines = result.split("\n");
|
|
761
|
+
let mindent = null;
|
|
762
|
+
for (const l of lines) {
|
|
763
|
+
const m = l.match(/^(\s+)\S+/);
|
|
764
|
+
if (m) {
|
|
765
|
+
const indent = m[1].length;
|
|
766
|
+
if (!mindent) {
|
|
767
|
+
// this is the first indented line
|
|
768
|
+
mindent = indent;
|
|
769
|
+
} else {
|
|
770
|
+
mindent = Math.min(mindent, indent);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
if (mindent !== null) {
|
|
775
|
+
const m = mindent; // appease TypeScript
|
|
776
|
+
result = lines
|
|
777
|
+
// https://github.com/typescript-eslint/typescript-eslint/issues/7140
|
|
778
|
+
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
|
|
779
|
+
.map(l => l[0] === " " || l[0] === "\t" ? l.slice(m) : l).join("\n");
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
// dedent eats leading and trailing whitespace too
|
|
783
|
+
result = result.trim();
|
|
784
|
+
if (escapeSpecialCharacters) {
|
|
785
|
+
// handle escaped newlines at the end to ensure they don't get stripped too
|
|
786
|
+
result = result.replace(/\\n/g, "\n");
|
|
787
|
+
}
|
|
788
|
+
return result;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
const promptTemplate = dedent`
|
|
793
|
+
你是一个技术专家,擅长回答iCafe的API相关问题和相关代码编写。根据以下知识回答用户的问题或完成代码编写任务:
|
|
794
|
+
{{trimedKnowledge}}
|
|
795
|
+
解答以下问题:
|
|
796
|
+
{{query}}
|
|
797
|
+
在回答问题时,要遵循前面的知识库,尽量简洁明了地回答问题。
|
|
798
|
+
在编写代码时,请确保最终代码完整不拆分,并尽可能减少文字内容。必要的文字内容应尽可能通过注释形式插入到代码中,而不是直接输出,涉及代码务必返回markdown格式,最后请务必保证所写代码的正确性。
|
|
799
|
+
`;
|
|
800
|
+
class ApiQaSkillProvider extends SkillProvider {
|
|
801
|
+
static{
|
|
802
|
+
this.skillName = 'apiQa';
|
|
803
|
+
}
|
|
804
|
+
static{
|
|
805
|
+
this.displayName = 'API问答';
|
|
806
|
+
}
|
|
807
|
+
static{
|
|
808
|
+
this.description = '根据iCafe API相关知识回答用户提问或完成代码编写任务';
|
|
809
|
+
}
|
|
810
|
+
static{
|
|
811
|
+
this.parameters = {
|
|
812
|
+
type: 'object',
|
|
813
|
+
properties: {}
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
async *execute() {
|
|
817
|
+
const stream = new StringChunkStream();
|
|
818
|
+
const query = this.currentContext.query;
|
|
819
|
+
const knowledge = await this.retriever.knowledgeFromQuery(query, {
|
|
820
|
+
knowledgeSets: [
|
|
821
|
+
{
|
|
822
|
+
uuid: '715046cc-81e2-406b-aecf-db5e63882739',
|
|
823
|
+
type: 'NORMAL'
|
|
824
|
+
}
|
|
825
|
+
]
|
|
826
|
+
});
|
|
827
|
+
const trimedKnowledge = this.trimKnowledge(knowledge, 8);
|
|
828
|
+
const prompt = this.llm.createPrompt(promptTemplate, {
|
|
829
|
+
trimedKnowledge,
|
|
830
|
+
query
|
|
831
|
+
});
|
|
832
|
+
const chunks = this.llm.askForTextStreaming(prompt, {
|
|
833
|
+
model: TextModel.ErnieBot128
|
|
834
|
+
});
|
|
835
|
+
for await (const chunk of chunks){
|
|
836
|
+
yield stream.flush(chunk);
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
trimKnowledge(list, maxCount = 6, maxLength = 10000) {
|
|
840
|
+
const state = {
|
|
841
|
+
length: 0
|
|
842
|
+
};
|
|
843
|
+
const output = [];
|
|
844
|
+
for (const item of list){
|
|
845
|
+
if (state.length + item.length > maxLength || output.length >= maxCount) {
|
|
846
|
+
break;
|
|
847
|
+
}
|
|
848
|
+
output.push(item);
|
|
849
|
+
state.length += item.length;
|
|
850
|
+
}
|
|
851
|
+
return output;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
class HelpSkillProvider extends SkillProvider {
|
|
856
|
+
static{
|
|
857
|
+
this.skillName = 'icafe-help';
|
|
858
|
+
}
|
|
859
|
+
static{
|
|
860
|
+
this.description = '插件介绍';
|
|
861
|
+
}
|
|
862
|
+
static{
|
|
863
|
+
this.parameters = {
|
|
864
|
+
type: 'object',
|
|
865
|
+
properties: {}
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
async *execute() {
|
|
869
|
+
const stream = new TaskProgressChunkStream();
|
|
870
|
+
const filename = fileURLToPath(import.meta.url);
|
|
871
|
+
const content = readFileSync(`${dirname(filename)}/help.md`, 'utf8');
|
|
872
|
+
yield stream.flush(content);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
function setup({ registry }) {
|
|
877
|
+
registry.registerFallbackProvider('fallback', HelpFallbackProvider, true);
|
|
878
|
+
registry.registerSkillProvider('icafe-help', HelpSkillProvider);
|
|
879
|
+
registry.registerSkillProvider('apiQa', ApiQaSkillProvider);
|
|
880
|
+
registry.registerSkillProvider('searchBySelf', searchcmdProvider);
|
|
881
|
+
registry.registerSkillProvider('findByTitle', findbyTitleProvider);
|
|
882
|
+
registry.registerSkillProvider('createCard', createCardProvider);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
export { setup };
|