@comate/zulu 0.7.1 → 0.7.3
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/node_modules/@comate/plugin-shared-internals/dist/index.d.ts +1 -0
- package/comate-engine/server.js +3 -3
- package/dist/bundle/index.js +2 -2
- package/package.json +1 -1
- package/comate-engine/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
- package/comate-engine/plugins/aiscan/assets/icon.svg +0 -12
- package/comate-engine/plugins/aiscan/dist/index.js +0 -54426
- package/comate-engine/plugins/aiscan/package.json +0 -67
- package/comate-engine/plugins/appdev/assets/icon.png +0 -0
- package/comate-engine/plugins/appdev/dist/help.md +0 -12
- package/comate-engine/plugins/appdev/dist/index.d.ts +0 -2
- package/comate-engine/plugins/appdev/dist/index.js +0 -194
- package/comate-engine/plugins/appdev/dist/providers/err.d.ts +0 -8
- package/comate-engine/plugins/appdev/dist/providers/err.js +0 -37
- package/comate-engine/plugins/appdev/dist/providers/fallback.d.ts +0 -5
- package/comate-engine/plugins/appdev/dist/providers/fallback.js +0 -28
- package/comate-engine/plugins/appdev/dist/providers/help.d.ts +0 -8
- package/comate-engine/plugins/appdev/dist/providers/help.js +0 -19
- package/comate-engine/plugins/appdev/dist/providers/medusa.d.ts +0 -8
- package/comate-engine/plugins/appdev/dist/providers/medusa.js +0 -39
- package/comate-engine/plugins/appdev/dist/providers/qa.d.ts +0 -8
- package/comate-engine/plugins/appdev/dist/providers/qa.js +0 -33
- package/comate-engine/plugins/appdev/package.json +0 -67
- package/comate-engine/plugins/bfc/assets/bfc-icon.png +0 -0
- package/comate-engine/plugins/bfc/dist/config/config.d.ts +0 -4
- package/comate-engine/plugins/bfc/dist/config/config.js +0 -4
- package/comate-engine/plugins/bfc/dist/help.md +0 -11
- package/comate-engine/plugins/bfc/dist/index.d.ts +0 -2
- package/comate-engine/plugins/bfc/dist/index.js +0 -452
- package/comate-engine/plugins/bfc/dist/providers/bfcInstructMode.d.ts +0 -8
- package/comate-engine/plugins/bfc/dist/providers/bfcInstructMode.js +0 -77
- package/comate-engine/plugins/bfc/dist/providers/genAbnormalCode.d.ts +0 -8
- package/comate-engine/plugins/bfc/dist/providers/genAbnormalCode.js +0 -71
- package/comate-engine/plugins/bfc/dist/providers/genBfcCode.d.ts +0 -8
- package/comate-engine/plugins/bfc/dist/providers/genBfcCode.js +0 -74
- package/comate-engine/plugins/bfc/dist/providers/getBatchCases.d.ts +0 -10
- package/comate-engine/plugins/bfc/dist/providers/getBatchCases.js +0 -71
- package/comate-engine/plugins/bfc/dist/providers/help.d.ts +0 -8
- package/comate-engine/plugins/bfc/dist/providers/help.js +0 -19
- package/comate-engine/plugins/bfc/dist/service/generateService.d.ts +0 -14
- package/comate-engine/plugins/bfc/dist/service/generateService.js +0 -27
- package/comate-engine/plugins/bfc/package.json +0 -85
- package/comate-engine/plugins/bpm/assets/bpm.png +0 -0
- package/comate-engine/plugins/bpm/dist/index.js +0 -313
- package/comate-engine/plugins/bpm/package.json +0 -65
- package/comate-engine/plugins/casebuilder/assets/icon.svg +0 -1
- package/comate-engine/plugins/casebuilder/dist/help.md +0 -33
- package/comate-engine/plugins/casebuilder/dist/index.js +0 -837
- package/comate-engine/plugins/casebuilder/package.json +0 -80
- package/comate-engine/plugins/centrino/assets/icon.png +0 -0
- package/comate-engine/plugins/centrino/dist/help.md +0 -30
- package/comate-engine/plugins/centrino/dist/index.js +0 -1046
- package/comate-engine/plugins/centrino/package.json +0 -68
- package/comate-engine/plugins/cnap/assets/cnap.png +0 -0
- package/comate-engine/plugins/cnap/dist/help.md +0 -11
- package/comate-engine/plugins/cnap/dist/index.js +0 -171
- package/comate-engine/plugins/cnap/package.json +0 -65
- package/comate-engine/plugins/demo-timer/assets/icon.svg +0 -2
- package/comate-engine/plugins/demo-timer/dist/index.js +0 -463
- package/comate-engine/plugins/demo-timer/package.json +0 -73
- package/comate-engine/plugins/dev-tools/assets/icon.png +0 -0
- package/comate-engine/plugins/dev-tools/dist/help.md +0 -18
- package/comate-engine/plugins/dev-tools/dist/index.js +0 -166160
- package/comate-engine/plugins/dev-tools/package.json +0 -95
- package/comate-engine/plugins/devaux/assets/icon.svg +0 -1
- package/comate-engine/plugins/devaux/dist/help.md +0 -41
- package/comate-engine/plugins/devaux/dist/index.js +0 -75551
- 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 +0 -82
- package/comate-engine/plugins/f2c/assets/icon.svg +0 -11
- package/comate-engine/plugins/f2c/dist/help.md +0 -13
- package/comate-engine/plugins/f2c/dist/index.js +0 -101649
- package/comate-engine/plugins/f2c/package.json +0 -56
- package/comate-engine/plugins/fcnap/assets/icon.png +0 -0
- package/comate-engine/plugins/fcnap/dist/help.md +0 -9
- package/comate-engine/plugins/fcnap/dist/index.js +0 -105
- package/comate-engine/plugins/fcnap/package.json +0 -50
- package/comate-engine/plugins/front-end-skills/assets/icon.svg +0 -1
- package/comate-engine/plugins/front-end-skills/dist/help.md +0 -17
- package/comate-engine/plugins/front-end-skills/dist/index.js +0 -8172
- package/comate-engine/plugins/front-end-skills/package.json +0 -79
- package/comate-engine/plugins/gdp/assets/icon.png +0 -0
- package/comate-engine/plugins/gdp/dist/help.md +0 -11
- package/comate-engine/plugins/gdp/dist/index.js +0 -70806
- package/comate-engine/plugins/gdp/package.json +0 -80
- package/comate-engine/plugins/git/assets/git.svg +0 -1
- package/comate-engine/plugins/git/assets/icon.svg +0 -1
- package/comate-engine/plugins/git/dist/help.md +0 -7
- package/comate-engine/plugins/git/dist/index.js +0 -32765
- package/comate-engine/plugins/git/package.json +0 -91
- package/comate-engine/plugins/harmonyos/assets/harmonyos.png +0 -0
- package/comate-engine/plugins/harmonyos/dist/index.js +0 -78
- package/comate-engine/plugins/harmonyos/package.json +0 -37
- package/comate-engine/plugins/iapi/assets/icon.png +0 -0
- package/comate-engine/plugins/iapi/dist/help.md +0 -13
- package/comate-engine/plugins/iapi/dist/index.js +0 -458
- 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 +0 -102
- package/comate-engine/plugins/icafe/assets/icafe.svg +0 -1
- package/comate-engine/plugins/icafe/dist/help.md +0 -5
- package/comate-engine/plugins/icafe/dist/index.js +0 -885
- package/comate-engine/plugins/icafe/package.json +0 -74
- package/comate-engine/plugins/ievalue/assets/iEValue.svg +0 -10
- package/comate-engine/plugins/ievalue/dist/index.js +0 -2920
- package/comate-engine/plugins/ievalue/package.json +0 -88
- package/comate-engine/plugins/ipipe/assets/iPipePlugin.png +0 -0
- package/comate-engine/plugins/ipipe/dist/help.md +0 -15
- package/comate-engine/plugins/ipipe/dist/index.js +0 -7268
- package/comate-engine/plugins/ipipe/package.json +0 -62
- package/comate-engine/plugins/jarvis/assets/icon.svg +0 -1
- package/comate-engine/plugins/jarvis/dist/help.md +0 -17
- package/comate-engine/plugins/jarvis/dist/index.js +0 -140473
- package/comate-engine/plugins/jarvis/package.json +0 -93
- package/comate-engine/plugins/mapsearch/assets/mapsearchicon.png +0 -0
- package/comate-engine/plugins/mapsearch/dist/help.md +0 -4
- package/comate-engine/plugins/mapsearch/dist/index.js +0 -145
- package/comate-engine/plugins/mapsearch/package.json +0 -53
- 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 +0 -31
- package/comate-engine/plugins/paddle/dist/index.js +0 -1011
- package/comate-engine/plugins/paddle/package.json +0 -129
- package/comate-engine/plugins/robot/assets/Robot.png +0 -0
- package/comate-engine/plugins/robot/dist/index.js +0 -476
- package/comate-engine/plugins/robot/package.json +0 -91
- package/comate-engine/plugins/security/assets/comate.png +0 -0
- package/comate-engine/plugins/security/dist/index.js +0 -18434
- package/comate-engine/plugins/security/package.json +0 -82
- package/comate-engine/plugins/smartapp/assets/icon.png +0 -0
- package/comate-engine/plugins/smartapp/dist/help.md +0 -4
- package/comate-engine/plugins/smartapp/dist/index.js +0 -113
- package/comate-engine/plugins/smartapp/package.json +0 -54
- package/comate-engine/plugins/testmate/assets/icon.svg +0 -1
- package/comate-engine/plugins/testmate/dist/help.md +0 -62
- package/comate-engine/plugins/testmate/dist/index.js +0 -21483
- package/comate-engine/plugins/testmate/package.json +0 -85
- package/comate-engine/plugins/tor/assets/TorPlugin.png +0 -0
- package/comate-engine/plugins/tor/dist/help.md +0 -22
- package/comate-engine/plugins/tor/dist/index.js +0 -807
- package/comate-engine/plugins/tor/package.json +0 -99
- package/comate-engine/plugins/weiyun/assets/icon.png +0 -0
- package/comate-engine/plugins/weiyun/dist/help.md +0 -11
- package/comate-engine/plugins/weiyun/dist/index.js +0 -100495
- package/comate-engine/plugins/weiyun/package.json +0 -55
- package/comate-engine/plugins/workcard/assets/favicon.png +0 -0
- package/comate-engine/plugins/workcard/dist/help.md +0 -30
- package/comate-engine/plugins/workcard/dist/index.js +0 -547
- package/comate-engine/plugins/workcard/package.json +0 -102
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"private": true,
|
|
3
|
-
"name": "@comate-plugin/paddle",
|
|
4
|
-
"version": "0.8.0",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"clean": "rm -rf dist",
|
|
8
|
-
"dev": "cpd dev",
|
|
9
|
-
"build": "tsc && cpd build"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {},
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"@comate/plugin-cli": "^0.9.2",
|
|
14
|
-
"@comate/plugin-host": "^0.9.2",
|
|
15
|
-
"@comate/plugin-shared-internals": "^0.9.2",
|
|
16
|
-
"typescript": "^5.3.2"
|
|
17
|
-
},
|
|
18
|
-
"comate": {
|
|
19
|
-
"name": "paddle",
|
|
20
|
-
"version": "1.0.0",
|
|
21
|
-
"icon": "./assets/icon.png",
|
|
22
|
-
"entry": "./dist/index.js",
|
|
23
|
-
"displayName": "飞桨",
|
|
24
|
-
"description": "PaddlePaddle深度学习编程助手,支持智能问答、代码编写",
|
|
25
|
-
"keyword": [],
|
|
26
|
-
"files": [
|
|
27
|
-
"dist",
|
|
28
|
-
"assets"
|
|
29
|
-
],
|
|
30
|
-
"capabilities": [
|
|
31
|
-
{
|
|
32
|
-
"type": "Skill",
|
|
33
|
-
"name": "paddle-help",
|
|
34
|
-
"displayName": "插件介绍",
|
|
35
|
-
"description": "插件介绍",
|
|
36
|
-
"placeholder": "无需输入内容,回车获得插件介绍"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"type": "Skill",
|
|
40
|
-
"name": "code-generate",
|
|
41
|
-
"displayName": "代码生成",
|
|
42
|
-
"description": "深度学习与飞桨框架的智能编程助手",
|
|
43
|
-
"placeholder": "请描述你的飞桨代码需求",
|
|
44
|
-
"tipConfig": {
|
|
45
|
-
"tip": "你可参考如下代码来编程",
|
|
46
|
-
"tipCodeBlock": {
|
|
47
|
-
"type": "selected",
|
|
48
|
-
"showTipWhileEmpty": false
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"type": "Skill",
|
|
54
|
-
"name": "code-convert",
|
|
55
|
-
"displayName": "代码转换",
|
|
56
|
-
"description": "将其他深度学习框架(例如Pytorch、Tensorflow、Keras等)的代码转换为飞桨的代码",
|
|
57
|
-
"placeholder": "默认当前文件、或#选择路径、或输入相对路径、或框选代码",
|
|
58
|
-
"querySelector": {
|
|
59
|
-
"language": [
|
|
60
|
-
"python"
|
|
61
|
-
],
|
|
62
|
-
"activeFileContent": [
|
|
63
|
-
"import torch",
|
|
64
|
-
"from torch",
|
|
65
|
-
"torch."
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"type": "Skill",
|
|
71
|
-
"name": "code-explain",
|
|
72
|
-
"displayName": "代码解释",
|
|
73
|
-
"description": "解释深度学习与飞桨框架的代码",
|
|
74
|
-
"placeholder": "框选代码后回车或点击发送",
|
|
75
|
-
"tipConfig": {
|
|
76
|
-
"tip": "请解释如下代码",
|
|
77
|
-
"tipCodeBlock": {
|
|
78
|
-
"type": "selected",
|
|
79
|
-
"showTipWhileEmpty": false
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"type": "Skill",
|
|
85
|
-
"name": "chat",
|
|
86
|
-
"displayName": "",
|
|
87
|
-
"description": "智能解答深度学习与飞桨框架的问题",
|
|
88
|
-
"querySelector": {
|
|
89
|
-
"language": [
|
|
90
|
-
"python",
|
|
91
|
-
"cpp",
|
|
92
|
-
"c",
|
|
93
|
-
"go"
|
|
94
|
-
],
|
|
95
|
-
"activeFileContent": [
|
|
96
|
-
"import paddle",
|
|
97
|
-
"from paddle",
|
|
98
|
-
"paddle_inference_api.h",
|
|
99
|
-
"paddle/fluid/inference/goapi",
|
|
100
|
-
"paddle.",
|
|
101
|
-
"paddle_infer::"
|
|
102
|
-
]
|
|
103
|
-
},
|
|
104
|
-
"tipConfig": {
|
|
105
|
-
"tip": "",
|
|
106
|
-
"tipCodeBlock": {
|
|
107
|
-
"type": "selected",
|
|
108
|
-
"showTipWhileEmpty": false
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
"type": "Fallback",
|
|
114
|
-
"name": "fallback",
|
|
115
|
-
"description": "智能解答深度学习与飞桨框架的问题",
|
|
116
|
-
"tipConfig": {
|
|
117
|
-
"tip": "",
|
|
118
|
-
"tipCodeBlock": {
|
|
119
|
-
"type": "selected",
|
|
120
|
-
"showTipWhileEmpty": false
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
],
|
|
125
|
-
"configSchema": {
|
|
126
|
-
"sections": []
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
Binary file
|
|
@@ -1,476 +0,0 @@
|
|
|
1
|
-
import { FallbackProvider, TaskProgressChunkStream, SkillProvider } from '@comate/plugin-host';
|
|
2
|
-
|
|
3
|
-
// 测试环境
|
|
4
|
-
// export const baseUrl = "http://10.57.222.155:8080"
|
|
5
|
-
// 线上环境
|
|
6
|
-
const baseUrl = "http://10.11.63.140:8080";
|
|
7
|
-
// 各个能力接口地址
|
|
8
|
-
const defaultAbilityUrl = `${baseUrl}/comate/robot/defaultAbility`;
|
|
9
|
-
const messageReceivingUrl = `${baseUrl}/comate/robot/messageReceiving`;
|
|
10
|
-
const createGroupUrl = `${baseUrl}/comate/robot/createGroup`;
|
|
11
|
-
const groupMembersManageUrl = `${baseUrl}/comate/robot/groupMembersManage`;
|
|
12
|
-
const messagePushUrl = `${baseUrl}/comate/robot/messagePush`;
|
|
13
|
-
const getGroupInfoUrl = `${baseUrl}/comate/robot/getGroupInfo`;
|
|
14
|
-
const getAppAccessTokenUrl = `${baseUrl}/comate/robot/getAppAccessToken`;
|
|
15
|
-
const meetingAbilityUrl = `${baseUrl}/comate/robot/meetingAbility`;
|
|
16
|
-
const calendarAbilityUrl = `${baseUrl}/comate/robot/calendarAbility`;
|
|
17
|
-
// 接口人
|
|
18
|
-
const administrators = "rongsong";
|
|
19
|
-
|
|
20
|
-
class HelpFallbackProvider extends FallbackProvider {
|
|
21
|
-
static{
|
|
22
|
-
this.description = '默认能力';
|
|
23
|
-
}
|
|
24
|
-
async *handleQuery() {
|
|
25
|
-
const query = this.currentContext.query;
|
|
26
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
27
|
-
const user = userDetail && userDetail.name || '未知用户';
|
|
28
|
-
const stream = new TaskProgressChunkStream();
|
|
29
|
-
try {
|
|
30
|
-
// 1. 调用你自己的 API(通过 fetch 或其他方式)
|
|
31
|
-
const response = await fetch(defaultAbilityUrl, {
|
|
32
|
-
method: 'POST',
|
|
33
|
-
headers: {
|
|
34
|
-
'Content-Type': 'application/json'
|
|
35
|
-
},
|
|
36
|
-
body: JSON.stringify({
|
|
37
|
-
query: query,
|
|
38
|
-
user: user
|
|
39
|
-
})
|
|
40
|
-
});
|
|
41
|
-
// 2. 流式读取响应(以SSE或chunked格式读取)
|
|
42
|
-
const reader = response.body?.getReader();
|
|
43
|
-
const decoder = new TextDecoder('utf-8');
|
|
44
|
-
if (reader) {
|
|
45
|
-
while(true){
|
|
46
|
-
const { value, done } = await reader.read();
|
|
47
|
-
if (done) break;
|
|
48
|
-
const data = decoder.decode(value, {
|
|
49
|
-
stream: true
|
|
50
|
-
});
|
|
51
|
-
yield stream.flush(data);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
} catch (error) {
|
|
55
|
-
yield stream.flushReplaceLast(`请求出错,请联系接口人@${administrators}或稍后再试。${error}`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const fetchWithTimeout = (url, options, timeout = 120000)=>{
|
|
61
|
-
return Promise.race([
|
|
62
|
-
fetch(url, options),
|
|
63
|
-
new Promise((_, reject)=>setTimeout(()=>reject(new Error('Fetch timeout')), timeout))
|
|
64
|
-
]);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
class MessageReceivingProvider extends SkillProvider {
|
|
68
|
-
static{
|
|
69
|
-
this.skillName = '接收消息服务';
|
|
70
|
-
}
|
|
71
|
-
static{
|
|
72
|
-
this.displayName = '接收消息服务';
|
|
73
|
-
}
|
|
74
|
-
static{
|
|
75
|
-
this.description = '接收所有群消息的流程和代码示例等';
|
|
76
|
-
}
|
|
77
|
-
static{
|
|
78
|
-
this.parameters = {
|
|
79
|
-
type: 'object',
|
|
80
|
-
properties: {}
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
async *execute() {
|
|
84
|
-
const stream = new TaskProgressChunkStream();
|
|
85
|
-
try {
|
|
86
|
-
const myHeaders = new Headers();
|
|
87
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
88
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
89
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
90
|
-
const raw = JSON.stringify({
|
|
91
|
-
query: this.currentContext.query,
|
|
92
|
-
user: realUserName
|
|
93
|
-
});
|
|
94
|
-
const options = {
|
|
95
|
-
method: 'POST',
|
|
96
|
-
headers: {
|
|
97
|
-
'Content-Type': 'application/json'
|
|
98
|
-
},
|
|
99
|
-
body: raw
|
|
100
|
-
};
|
|
101
|
-
const response = await fetchWithTimeout(messageReceivingUrl, options);
|
|
102
|
-
const result = await response.json();
|
|
103
|
-
yield stream.flushReplaceLast(result.data.content); // markdown字符串
|
|
104
|
-
} catch (error) {
|
|
105
|
-
yield stream.flushReplaceLast(`请求出错,请联系接口人@${administrators}或稍后再试。${error}`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
class CreateGroupProvider extends SkillProvider {
|
|
111
|
-
static{
|
|
112
|
-
this.skillName = '创建群聊';
|
|
113
|
-
}
|
|
114
|
-
static{
|
|
115
|
-
this.displayName = '创建群聊';
|
|
116
|
-
}
|
|
117
|
-
static{
|
|
118
|
-
this.description = '获取一键创建群聊的流程和代码示例';
|
|
119
|
-
}
|
|
120
|
-
static{
|
|
121
|
-
this.parameters = {
|
|
122
|
-
type: 'object',
|
|
123
|
-
properties: {}
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
async *execute() {
|
|
127
|
-
const stream = new TaskProgressChunkStream();
|
|
128
|
-
try {
|
|
129
|
-
const myHeaders = new Headers();
|
|
130
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
131
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
132
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
133
|
-
const raw = JSON.stringify({
|
|
134
|
-
query: this.currentContext.query,
|
|
135
|
-
user: realUserName
|
|
136
|
-
});
|
|
137
|
-
const options = {
|
|
138
|
-
method: 'POST',
|
|
139
|
-
headers: {
|
|
140
|
-
'Content-Type': 'application/json'
|
|
141
|
-
},
|
|
142
|
-
body: raw
|
|
143
|
-
};
|
|
144
|
-
const response = await fetchWithTimeout(createGroupUrl, options);
|
|
145
|
-
const result = await response.json();
|
|
146
|
-
yield stream.flushReplaceLast(result.data.content); // markdown字符串
|
|
147
|
-
} catch (error) {
|
|
148
|
-
yield stream.flushReplaceLast(`请求出错,请联系接口人@${administrators}或稍后再试。${error}`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
class GetGroupInfoProvider extends SkillProvider {
|
|
154
|
-
static{
|
|
155
|
-
this.skillName = '查询群聊基本信息';
|
|
156
|
-
}
|
|
157
|
-
static{
|
|
158
|
-
this.displayName = '查询群聊基本信息';
|
|
159
|
-
}
|
|
160
|
-
static{
|
|
161
|
-
this.description = '查询群聊基本信息的流程和代码示例';
|
|
162
|
-
}
|
|
163
|
-
static{
|
|
164
|
-
this.parameters = {
|
|
165
|
-
type: 'object',
|
|
166
|
-
properties: {}
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
async *execute() {
|
|
170
|
-
const stream = new TaskProgressChunkStream();
|
|
171
|
-
try {
|
|
172
|
-
const myHeaders = new Headers();
|
|
173
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
174
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
175
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
176
|
-
const raw = JSON.stringify({
|
|
177
|
-
query: this.currentContext.query,
|
|
178
|
-
user: realUserName
|
|
179
|
-
});
|
|
180
|
-
const options = {
|
|
181
|
-
method: 'POST',
|
|
182
|
-
headers: {
|
|
183
|
-
'Content-Type': 'application/json'
|
|
184
|
-
},
|
|
185
|
-
body: raw
|
|
186
|
-
};
|
|
187
|
-
const response = await fetchWithTimeout(getGroupInfoUrl, options);
|
|
188
|
-
const result = await response.json();
|
|
189
|
-
yield stream.flushReplaceLast(result.data.content); // markdown字符串
|
|
190
|
-
} catch (error) {
|
|
191
|
-
yield stream.flushReplaceLast(`请求出错,请联系接口人@${administrators}或稍后再试。${error}`);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
class MessagePushProvider extends SkillProvider {
|
|
197
|
-
static{
|
|
198
|
-
this.skillName = '推送消息';
|
|
199
|
-
}
|
|
200
|
-
static{
|
|
201
|
-
this.displayName = '推送消息';
|
|
202
|
-
}
|
|
203
|
-
static{
|
|
204
|
-
this.description = '主动推送消息流程和代码示例等';
|
|
205
|
-
}
|
|
206
|
-
static{
|
|
207
|
-
this.parameters = {
|
|
208
|
-
type: 'object',
|
|
209
|
-
properties: {}
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
async *execute() {
|
|
213
|
-
const stream = new TaskProgressChunkStream();
|
|
214
|
-
try {
|
|
215
|
-
const myHeaders = new Headers();
|
|
216
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
217
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
218
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
219
|
-
const raw = JSON.stringify({
|
|
220
|
-
query: this.currentContext.query,
|
|
221
|
-
user: realUserName
|
|
222
|
-
});
|
|
223
|
-
const options = {
|
|
224
|
-
method: 'POST',
|
|
225
|
-
headers: {
|
|
226
|
-
'Content-Type': 'application/json'
|
|
227
|
-
},
|
|
228
|
-
body: raw
|
|
229
|
-
};
|
|
230
|
-
const response = await fetchWithTimeout(messagePushUrl, options);
|
|
231
|
-
const result = await response.json();
|
|
232
|
-
yield stream.flushReplaceLast(result.data.content); // markdown字符串
|
|
233
|
-
} catch (error) {
|
|
234
|
-
yield stream.flushReplaceLast(`请求出错,请联系接口人@${administrators}或稍后再试。${error}`);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
class IntroductionProvider extends SkillProvider {
|
|
240
|
-
static{
|
|
241
|
-
this.skillName = '插件介绍';
|
|
242
|
-
}
|
|
243
|
-
static{
|
|
244
|
-
this.displayName = '插件介绍';
|
|
245
|
-
}
|
|
246
|
-
static{
|
|
247
|
-
this.description = '插件介绍';
|
|
248
|
-
}
|
|
249
|
-
static{
|
|
250
|
-
this.parameters = {
|
|
251
|
-
type: 'object',
|
|
252
|
-
properties: {}
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
async *execute() {
|
|
256
|
-
const query = this.currentContext.query;
|
|
257
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
258
|
-
const user = userDetail && userDetail.name || '未知用户';
|
|
259
|
-
const stream = new TaskProgressChunkStream();
|
|
260
|
-
try {
|
|
261
|
-
// 1. 调用你自己的 API(通过 fetch 或其他方式)
|
|
262
|
-
const response = await fetch(defaultAbilityUrl, {
|
|
263
|
-
method: 'POST',
|
|
264
|
-
headers: {
|
|
265
|
-
'Content-Type': 'application/json'
|
|
266
|
-
},
|
|
267
|
-
body: JSON.stringify({
|
|
268
|
-
query: query,
|
|
269
|
-
user: user
|
|
270
|
-
})
|
|
271
|
-
});
|
|
272
|
-
// 2. 流式读取响应(以SSE或chunked格式读取)
|
|
273
|
-
const reader = response.body?.getReader();
|
|
274
|
-
const decoder = new TextDecoder('utf-8');
|
|
275
|
-
if (reader) {
|
|
276
|
-
while(true){
|
|
277
|
-
const { value, done } = await reader.read();
|
|
278
|
-
if (done) break;
|
|
279
|
-
const data = decoder.decode(value, {
|
|
280
|
-
stream: true
|
|
281
|
-
});
|
|
282
|
-
yield stream.flush(data);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
} catch (error) {
|
|
286
|
-
yield stream.flushReplaceLast(`请求出错,请联系接口人@${administrators}或稍后再试。${error}`);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
class GetAppAccessTokenProvider extends SkillProvider {
|
|
292
|
-
static{
|
|
293
|
-
this.skillName = '获取app_access_token';
|
|
294
|
-
}
|
|
295
|
-
static{
|
|
296
|
-
this.displayName = '获取app_access_token';
|
|
297
|
-
}
|
|
298
|
-
static{
|
|
299
|
-
this.description = '获取app_access_token代码示例等';
|
|
300
|
-
}
|
|
301
|
-
static{
|
|
302
|
-
this.parameters = {
|
|
303
|
-
type: 'object',
|
|
304
|
-
properties: {}
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
async *execute() {
|
|
308
|
-
const stream = new TaskProgressChunkStream();
|
|
309
|
-
try {
|
|
310
|
-
const myHeaders = new Headers();
|
|
311
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
312
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
313
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
314
|
-
const raw = JSON.stringify({
|
|
315
|
-
query: this.currentContext.query,
|
|
316
|
-
user: realUserName
|
|
317
|
-
});
|
|
318
|
-
const options = {
|
|
319
|
-
method: 'POST',
|
|
320
|
-
headers: {
|
|
321
|
-
'Content-Type': 'application/json'
|
|
322
|
-
},
|
|
323
|
-
body: raw
|
|
324
|
-
};
|
|
325
|
-
const response = await fetchWithTimeout(getAppAccessTokenUrl, options);
|
|
326
|
-
const result = await response.json();
|
|
327
|
-
yield stream.flushReplaceLast(result.data.content); // markdown字符串
|
|
328
|
-
} catch (error) {
|
|
329
|
-
yield stream.flushReplaceLast(`请求出错,请联系接口人@${administrators}或稍后再试。${error}`);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
class GroupMembersManageProvider extends SkillProvider {
|
|
335
|
-
static{
|
|
336
|
-
this.skillName = '群成员管理';
|
|
337
|
-
}
|
|
338
|
-
static{
|
|
339
|
-
this.displayName = '群成员管理';
|
|
340
|
-
}
|
|
341
|
-
static{
|
|
342
|
-
this.description = '群成员管理的流程和代码示例等';
|
|
343
|
-
}
|
|
344
|
-
static{
|
|
345
|
-
this.parameters = {
|
|
346
|
-
type: 'object',
|
|
347
|
-
properties: {}
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
async *execute() {
|
|
351
|
-
const stream = new TaskProgressChunkStream();
|
|
352
|
-
try {
|
|
353
|
-
const myHeaders = new Headers();
|
|
354
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
355
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
356
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
357
|
-
const raw = JSON.stringify({
|
|
358
|
-
query: this.currentContext.query,
|
|
359
|
-
user: realUserName
|
|
360
|
-
});
|
|
361
|
-
const options = {
|
|
362
|
-
method: 'POST',
|
|
363
|
-
headers: {
|
|
364
|
-
'Content-Type': 'application/json'
|
|
365
|
-
},
|
|
366
|
-
body: raw
|
|
367
|
-
};
|
|
368
|
-
const response = await fetchWithTimeout(groupMembersManageUrl, options);
|
|
369
|
-
const result = await response.json();
|
|
370
|
-
yield stream.flushReplaceLast(result.data.content); // markdown字符串
|
|
371
|
-
} catch (error) {
|
|
372
|
-
yield stream.flushReplaceLast(`请求出错,请联系接口人@${administrators}或稍后再试。${error}`);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
class MeetingAbilityProvider extends SkillProvider {
|
|
378
|
-
static{
|
|
379
|
-
this.skillName = '会议开放能力(自动呼叫等)_代码生成';
|
|
380
|
-
}
|
|
381
|
-
static{
|
|
382
|
-
this.displayName = '会议开放能力(自动呼叫等)_代码生成';
|
|
383
|
-
}
|
|
384
|
-
static{
|
|
385
|
-
this.description = '提供会议开放能力(自动呼叫等)相关流程和代码示例等';
|
|
386
|
-
}
|
|
387
|
-
static{
|
|
388
|
-
this.parameters = {
|
|
389
|
-
type: 'object',
|
|
390
|
-
properties: {}
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
async *execute() {
|
|
394
|
-
const stream = new TaskProgressChunkStream();
|
|
395
|
-
try {
|
|
396
|
-
const myHeaders = new Headers();
|
|
397
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
398
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
399
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
400
|
-
const raw = JSON.stringify({
|
|
401
|
-
query: this.currentContext.query,
|
|
402
|
-
user: realUserName
|
|
403
|
-
});
|
|
404
|
-
const options = {
|
|
405
|
-
method: 'POST',
|
|
406
|
-
headers: {
|
|
407
|
-
'Content-Type': 'application/json'
|
|
408
|
-
},
|
|
409
|
-
body: raw
|
|
410
|
-
};
|
|
411
|
-
const response = await fetchWithTimeout(meetingAbilityUrl, options);
|
|
412
|
-
const result = await response.json();
|
|
413
|
-
yield stream.flushReplaceLast(result.data.content); // markdown字符串
|
|
414
|
-
} catch (error) {
|
|
415
|
-
yield stream.flushReplaceLast(`请求出错,请联系接口人@${administrators}或稍后再试。${error}`);
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
class CalendarAbilityProvider extends SkillProvider {
|
|
421
|
-
static{
|
|
422
|
-
this.skillName = '日程开放能力(日程增删改)_代码生成';
|
|
423
|
-
}
|
|
424
|
-
static{
|
|
425
|
-
this.displayName = '日程开放能力(日程增删改)_代码生成';
|
|
426
|
-
}
|
|
427
|
-
static{
|
|
428
|
-
this.description = '提供日程开放能力(日程增删改)相关流程和代码示例等';
|
|
429
|
-
}
|
|
430
|
-
static{
|
|
431
|
-
this.parameters = {
|
|
432
|
-
type: 'object',
|
|
433
|
-
properties: {}
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
async *execute() {
|
|
437
|
-
const stream = new TaskProgressChunkStream();
|
|
438
|
-
try {
|
|
439
|
-
const myHeaders = new Headers();
|
|
440
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
441
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
442
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
443
|
-
const raw = JSON.stringify({
|
|
444
|
-
query: this.currentContext.query,
|
|
445
|
-
user: realUserName
|
|
446
|
-
});
|
|
447
|
-
const options = {
|
|
448
|
-
method: 'POST',
|
|
449
|
-
headers: {
|
|
450
|
-
'Content-Type': 'application/json'
|
|
451
|
-
},
|
|
452
|
-
body: raw
|
|
453
|
-
};
|
|
454
|
-
const response = await fetchWithTimeout(calendarAbilityUrl, options);
|
|
455
|
-
const result = await response.json();
|
|
456
|
-
yield stream.flushReplaceLast(result.data.content); // markdown字符串
|
|
457
|
-
} catch (error) {
|
|
458
|
-
yield stream.flushReplaceLast(`请求出错,请联系接口人@${administrators}或稍后再试。${error}`);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
function setup({ registry }) {
|
|
464
|
-
registry.registerFallbackProvider('fallback', HelpFallbackProvider, true);
|
|
465
|
-
registry.registerSkillProvider('messageReceiving', MessageReceivingProvider);
|
|
466
|
-
registry.registerSkillProvider('createGroup', CreateGroupProvider);
|
|
467
|
-
registry.registerSkillProvider('getGroupInfo', GetGroupInfoProvider);
|
|
468
|
-
registry.registerSkillProvider('messagePush', MessagePushProvider);
|
|
469
|
-
registry.registerSkillProvider('introduction', IntroductionProvider);
|
|
470
|
-
registry.registerSkillProvider('getAppAccessToken', GetAppAccessTokenProvider);
|
|
471
|
-
registry.registerSkillProvider('groupMembersManage', GroupMembersManageProvider);
|
|
472
|
-
registry.registerSkillProvider('meetingAbility', MeetingAbilityProvider);
|
|
473
|
-
registry.registerSkillProvider('calendarAbility', CalendarAbilityProvider);
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
export { setup };
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"private": true,
|
|
3
|
-
"name": "@comate-plugin/robot",
|
|
4
|
-
"version": "0.8.0",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"clean": "rm -rf dist",
|
|
8
|
-
"dev": "cpd dev",
|
|
9
|
-
"build": "tsc && cpd build"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {},
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"@comate/plugin-cli": "^0.9.2",
|
|
14
|
-
"@comate/plugin-host": "^0.9.2",
|
|
15
|
-
"typescript": "^5.3.2"
|
|
16
|
-
},
|
|
17
|
-
"comate": {
|
|
18
|
-
"name": "robot",
|
|
19
|
-
"version": "1.0.0",
|
|
20
|
-
"icon": "./assets/Robot.png",
|
|
21
|
-
"entry": "./dist/index.js",
|
|
22
|
-
"displayName": "如流机器人",
|
|
23
|
-
"description": "快速接入如流新机器人,体验接收群聊消息、一键拉群等新开放能力~",
|
|
24
|
-
"keyword": [],
|
|
25
|
-
"capabilities": [
|
|
26
|
-
{
|
|
27
|
-
"type": "Fallback",
|
|
28
|
-
"name": "fallback",
|
|
29
|
-
"displayName": "默认能力",
|
|
30
|
-
"description": "未指定能力时,兜底的处理能力"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"type": "Skill",
|
|
34
|
-
"name": "introduction",
|
|
35
|
-
"displayName": "插件介绍&知识问答",
|
|
36
|
-
"description": "插件介绍&知识问答"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"type": "Skill",
|
|
40
|
-
"name": "getAppAccessToken",
|
|
41
|
-
"displayName": "获取app_access_token_代码生成",
|
|
42
|
-
"description": "获取app_access_token代码示例等"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"type": "Skill",
|
|
46
|
-
"name": "groupMembersManage",
|
|
47
|
-
"displayName": "群成员管理(查询/新增/删除)_代码生成",
|
|
48
|
-
"description": "群成员管理(查询/新增/删除)的代码示例等"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"type": "Skill",
|
|
52
|
-
"name": "messageReceiving",
|
|
53
|
-
"displayName": "消息接收回调服务框架_代码生成",
|
|
54
|
-
"description": "获取接收所有群消息的流程和代码示例等"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"type": "Skill",
|
|
58
|
-
"name": "messagePush",
|
|
59
|
-
"displayName": "推送消息_代码生成",
|
|
60
|
-
"description": "主动推送消息流程和代码示例等"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"type": "Skill",
|
|
64
|
-
"name": "getGroupInfo",
|
|
65
|
-
"displayName": "获取群聊基本信息_代码生成",
|
|
66
|
-
"description": "获取群聊基本信息流程和代码示例等"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"type": "Skill",
|
|
70
|
-
"name": "createGroup",
|
|
71
|
-
"displayName": "创建群聊_代码生成",
|
|
72
|
-
"description": "创建群聊流程和代码示例等"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"type": "Skill",
|
|
76
|
-
"name": "meetingAbility",
|
|
77
|
-
"displayName": "会议开放能力(自动呼叫等)_代码生成",
|
|
78
|
-
"description": "提供会议开放能力(自动呼叫等)相关流程和代码示例等"
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"type": "Skill",
|
|
82
|
-
"name": "calendarAbility",
|
|
83
|
-
"displayName": "日程开放能力(日程增删改)_代码生成",
|
|
84
|
-
"description": "提供日程开放能力(日程增删改)相关流程和代码示例等"
|
|
85
|
-
}
|
|
86
|
-
],
|
|
87
|
-
"configSchema": {
|
|
88
|
-
"sections": []
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
Binary file
|