@comate/zulu 0.2.1-beta.2 → 0.2.2

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.
Files changed (167) hide show
  1. package/README.md +1 -0
  2. package/comate-engine/bin/comate.js +9 -0
  3. package/comate-engine/node_modules/@comate/plugin-engine/dist/index.js +8 -8
  4. package/comate-engine/node_modules/@comate/plugin-host/dist/index.js +1 -1
  5. package/comate-engine/node_modules/@comate/plugin-host/dist/main.js +1 -1
  6. package/comate-engine/node_modules/@comate/plugin-host/dist/user-DQgjkMe9.js +44 -0
  7. package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.d.ts +24 -6
  8. package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.js +8 -8
  9. package/comate-engine/node_modules/@comate/preview-proxy/dist/index.js +59 -72
  10. package/comate-engine/node_modules/@comate/preview-proxy/static/comate-preview-injector.css +1 -1
  11. package/comate-engine/node_modules/@comate/preview-proxy/static/comate-preview-injector.js +1 -1
  12. package/comate-engine/node_modules/better-sqlite3/node_modules/.bin/prebuild-install +2 -2
  13. package/comate-engine/plugins/demo-feature/dist/index.js +337 -30
  14. package/comate-engine/server.js +11 -11
  15. package/dist/bundle/index.js +8 -8
  16. package/package.json +1 -1
  17. package/comate-engine/node_modules/@comate/plugin-host/dist/user-Buhpnssj.js +0 -44
  18. package/comate-engine/plugins/aiscan/assets/icon.svg +0 -12
  19. package/comate-engine/plugins/aiscan/dist/index.js +0 -53861
  20. package/comate-engine/plugins/aiscan/package.json +0 -67
  21. package/comate-engine/plugins/appdev/assets/icon.png +0 -0
  22. package/comate-engine/plugins/appdev/dist/help.md +0 -12
  23. package/comate-engine/plugins/appdev/dist/index.d.ts +0 -2
  24. package/comate-engine/plugins/appdev/dist/index.js +0 -194
  25. package/comate-engine/plugins/appdev/dist/providers/err.d.ts +0 -8
  26. package/comate-engine/plugins/appdev/dist/providers/err.js +0 -37
  27. package/comate-engine/plugins/appdev/dist/providers/fallback.d.ts +0 -5
  28. package/comate-engine/plugins/appdev/dist/providers/fallback.js +0 -28
  29. package/comate-engine/plugins/appdev/dist/providers/help.d.ts +0 -8
  30. package/comate-engine/plugins/appdev/dist/providers/help.js +0 -19
  31. package/comate-engine/plugins/appdev/dist/providers/medusa.d.ts +0 -8
  32. package/comate-engine/plugins/appdev/dist/providers/medusa.js +0 -39
  33. package/comate-engine/plugins/appdev/dist/providers/qa.d.ts +0 -8
  34. package/comate-engine/plugins/appdev/dist/providers/qa.js +0 -33
  35. package/comate-engine/plugins/appdev/package.json +0 -67
  36. package/comate-engine/plugins/bfc/assets/bfc-icon.png +0 -0
  37. package/comate-engine/plugins/bfc/dist/config/config.d.ts +0 -4
  38. package/comate-engine/plugins/bfc/dist/config/config.js +0 -4
  39. package/comate-engine/plugins/bfc/dist/help.md +0 -11
  40. package/comate-engine/plugins/bfc/dist/index.d.ts +0 -2
  41. package/comate-engine/plugins/bfc/dist/index.js +0 -452
  42. package/comate-engine/plugins/bfc/dist/providers/bfcInstructMode.d.ts +0 -8
  43. package/comate-engine/plugins/bfc/dist/providers/bfcInstructMode.js +0 -77
  44. package/comate-engine/plugins/bfc/dist/providers/genAbnormalCode.d.ts +0 -8
  45. package/comate-engine/plugins/bfc/dist/providers/genAbnormalCode.js +0 -71
  46. package/comate-engine/plugins/bfc/dist/providers/genBfcCode.d.ts +0 -8
  47. package/comate-engine/plugins/bfc/dist/providers/genBfcCode.js +0 -74
  48. package/comate-engine/plugins/bfc/dist/providers/getBatchCases.d.ts +0 -10
  49. package/comate-engine/plugins/bfc/dist/providers/getBatchCases.js +0 -71
  50. package/comate-engine/plugins/bfc/dist/providers/help.d.ts +0 -8
  51. package/comate-engine/plugins/bfc/dist/providers/help.js +0 -19
  52. package/comate-engine/plugins/bfc/dist/service/generateService.d.ts +0 -14
  53. package/comate-engine/plugins/bfc/dist/service/generateService.js +0 -27
  54. package/comate-engine/plugins/bfc/package.json +0 -85
  55. package/comate-engine/plugins/bpm/assets/bpm.png +0 -0
  56. package/comate-engine/plugins/bpm/dist/index.js +0 -313
  57. package/comate-engine/plugins/bpm/package.json +0 -65
  58. package/comate-engine/plugins/casebuilder/assets/icon.svg +0 -1
  59. package/comate-engine/plugins/casebuilder/dist/help.md +0 -33
  60. package/comate-engine/plugins/casebuilder/dist/index.js +0 -837
  61. package/comate-engine/plugins/casebuilder/package.json +0 -80
  62. package/comate-engine/plugins/centrino/assets/icon.png +0 -0
  63. package/comate-engine/plugins/centrino/dist/help.md +0 -30
  64. package/comate-engine/plugins/centrino/dist/index.js +0 -1046
  65. package/comate-engine/plugins/centrino/package.json +0 -68
  66. package/comate-engine/plugins/cnap/assets/cnap.png +0 -0
  67. package/comate-engine/plugins/cnap/dist/help.md +0 -11
  68. package/comate-engine/plugins/cnap/dist/index.js +0 -171
  69. package/comate-engine/plugins/cnap/package.json +0 -65
  70. package/comate-engine/plugins/demo-timer/assets/icon.svg +0 -2
  71. package/comate-engine/plugins/demo-timer/dist/index.js +0 -463
  72. package/comate-engine/plugins/demo-timer/package.json +0 -73
  73. package/comate-engine/plugins/dev-tools/assets/icon.png +0 -0
  74. package/comate-engine/plugins/dev-tools/dist/help.md +0 -18
  75. package/comate-engine/plugins/dev-tools/dist/index.js +0 -166160
  76. package/comate-engine/plugins/dev-tools/package.json +0 -95
  77. package/comate-engine/plugins/devaux/assets/icon.svg +0 -1
  78. package/comate-engine/plugins/devaux/dist/help.md +0 -41
  79. package/comate-engine/plugins/devaux/dist/index.js +0 -74138
  80. package/comate-engine/plugins/devaux/dist/static/tree-sitter-cpp.wasm +0 -0
  81. package/comate-engine/plugins/devaux/dist/static/tree-sitter-go.wasm +0 -0
  82. package/comate-engine/plugins/devaux/dist/static/tree-sitter.wasm +0 -0
  83. package/comate-engine/plugins/devaux/dist/tree-sitter.wasm +0 -0
  84. package/comate-engine/plugins/devaux/package.json +0 -83
  85. package/comate-engine/plugins/f2c/assets/icon.svg +0 -11
  86. package/comate-engine/plugins/f2c/dist/help.md +0 -13
  87. package/comate-engine/plugins/f2c/dist/index.js +0 -81787
  88. package/comate-engine/plugins/f2c/package.json +0 -56
  89. package/comate-engine/plugins/fcnap/assets/icon.png +0 -0
  90. package/comate-engine/plugins/fcnap/dist/help.md +0 -9
  91. package/comate-engine/plugins/fcnap/dist/index.js +0 -105
  92. package/comate-engine/plugins/fcnap/package.json +0 -50
  93. package/comate-engine/plugins/front-end-skills/assets/icon.svg +0 -1
  94. package/comate-engine/plugins/front-end-skills/dist/help.md +0 -17
  95. package/comate-engine/plugins/front-end-skills/dist/index.js +0 -8172
  96. package/comate-engine/plugins/front-end-skills/package.json +0 -79
  97. package/comate-engine/plugins/gdp/assets/icon.png +0 -0
  98. package/comate-engine/plugins/gdp/dist/help.md +0 -11
  99. package/comate-engine/plugins/gdp/dist/index.js +0 -53065
  100. package/comate-engine/plugins/gdp/package.json +0 -79
  101. package/comate-engine/plugins/git/assets/git.svg +0 -1
  102. package/comate-engine/plugins/git/assets/icon.svg +0 -1
  103. package/comate-engine/plugins/git/dist/help.md +0 -7
  104. package/comate-engine/plugins/git/dist/index.js +0 -32675
  105. package/comate-engine/plugins/git/package.json +0 -91
  106. package/comate-engine/plugins/harmonyos/assets/harmonyos.png +0 -0
  107. package/comate-engine/plugins/harmonyos/dist/index.js +0 -78
  108. package/comate-engine/plugins/harmonyos/package.json +0 -37
  109. package/comate-engine/plugins/iapi/assets/icon.png +0 -0
  110. package/comate-engine/plugins/iapi/dist/help.md +0 -13
  111. package/comate-engine/plugins/iapi/dist/index.js +0 -458
  112. package/comate-engine/plugins/iapi/dist/static/lang/tree-sitter-go.wasm +0 -0
  113. package/comate-engine/plugins/iapi/dist/static/lang/tree-sitter-java.wasm +0 -0
  114. package/comate-engine/plugins/iapi/dist/static/tree-sitter-go.wasm +0 -0
  115. package/comate-engine/plugins/iapi/dist/static/tree-sitter-java.wasm +0 -0
  116. package/comate-engine/plugins/iapi/dist/tree-sitter.wasm +0 -0
  117. package/comate-engine/plugins/iapi/package.json +0 -102
  118. package/comate-engine/plugins/icafe/assets/icafe.svg +0 -1
  119. package/comate-engine/plugins/icafe/dist/help.md +0 -5
  120. package/comate-engine/plugins/icafe/dist/index.js +0 -885
  121. package/comate-engine/plugins/icafe/package.json +0 -74
  122. package/comate-engine/plugins/ievalue/assets/iEValue.svg +0 -10
  123. package/comate-engine/plugins/ievalue/dist/index.js +0 -2920
  124. package/comate-engine/plugins/ievalue/package.json +0 -88
  125. package/comate-engine/plugins/ipipe/assets/iPipePlugin.png +0 -0
  126. package/comate-engine/plugins/ipipe/dist/help.md +0 -15
  127. package/comate-engine/plugins/ipipe/dist/index.js +0 -7264
  128. package/comate-engine/plugins/ipipe/package.json +0 -62
  129. package/comate-engine/plugins/jarvis/assets/icon.svg +0 -1
  130. package/comate-engine/plugins/jarvis/dist/help.md +0 -17
  131. package/comate-engine/plugins/jarvis/dist/index.js +0 -140416
  132. package/comate-engine/plugins/jarvis/package.json +0 -93
  133. package/comate-engine/plugins/mapsearch/assets/mapsearchicon.png +0 -0
  134. package/comate-engine/plugins/mapsearch/dist/help.md +0 -4
  135. package/comate-engine/plugins/mapsearch/dist/index.js +0 -145
  136. package/comate-engine/plugins/mapsearch/package.json +0 -53
  137. package/comate-engine/plugins/paddle/assets/icon.png +0 -0
  138. package/comate-engine/plugins/paddle/assets/paconvert-3.0.1-py3-none-any.whl +0 -0
  139. package/comate-engine/plugins/paddle/dist/help.md +0 -31
  140. package/comate-engine/plugins/paddle/dist/index.js +0 -1011
  141. package/comate-engine/plugins/paddle/package.json +0 -129
  142. package/comate-engine/plugins/robot/assets/Robot.png +0 -0
  143. package/comate-engine/plugins/robot/dist/index.js +0 -288
  144. package/comate-engine/plugins/robot/package.json +0 -67
  145. package/comate-engine/plugins/security/assets/comate.png +0 -0
  146. package/comate-engine/plugins/security/dist/index.js +0 -18393
  147. package/comate-engine/plugins/security/package.json +0 -82
  148. package/comate-engine/plugins/smartapp/assets/icon.png +0 -0
  149. package/comate-engine/plugins/smartapp/dist/help.md +0 -4
  150. package/comate-engine/plugins/smartapp/dist/index.js +0 -113
  151. package/comate-engine/plugins/smartapp/package.json +0 -54
  152. package/comate-engine/plugins/testmate/assets/icon.svg +0 -1
  153. package/comate-engine/plugins/testmate/dist/help.md +0 -62
  154. package/comate-engine/plugins/testmate/dist/index.js +0 -21483
  155. package/comate-engine/plugins/testmate/package.json +0 -85
  156. package/comate-engine/plugins/tor/assets/TorPlugin.png +0 -0
  157. package/comate-engine/plugins/tor/dist/help.md +0 -22
  158. package/comate-engine/plugins/tor/dist/index.js +0 -807
  159. package/comate-engine/plugins/tor/package.json +0 -99
  160. package/comate-engine/plugins/weiyun/assets/icon.png +0 -0
  161. package/comate-engine/plugins/weiyun/dist/help.md +0 -11
  162. package/comate-engine/plugins/weiyun/dist/index.js +0 -100491
  163. package/comate-engine/plugins/weiyun/package.json +0 -55
  164. package/comate-engine/plugins/workcard/assets/favicon.png +0 -0
  165. package/comate-engine/plugins/workcard/dist/help.md +0 -30
  166. package/comate-engine/plugins/workcard/dist/index.js +0 -490
  167. package/comate-engine/plugins/workcard/package.json +0 -95
@@ -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
- }
@@ -1,288 +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 introductionUrl = `${baseUrl}/comate/robot/introduction`;
10
- const messageReceivingUrl = `${baseUrl}/comate/robot/messageReceiving`;
11
- const createGroupUrl = `${baseUrl}/comate/robot/createGroup`;
12
- const messagePushUrl = `${baseUrl}/comate/robot/messagePush`;
13
- const getGroupInfoUrl = `${baseUrl}/comate/robot/getGroupInfo`;
14
- // 接口人
15
- const administrators = "rongsong";
16
-
17
- class HelpFallbackProvider extends FallbackProvider {
18
- static{
19
- this.description = '默认能力';
20
- }
21
- async *handleQuery() {
22
- const query = this.currentContext.query;
23
- const userDetail = await this.currentUser.requestDetail();
24
- const user = userDetail && userDetail.name || '未知用户';
25
- const stream = new TaskProgressChunkStream();
26
- try {
27
- // 1. 调用你自己的 API(通过 fetch 或其他方式)
28
- const response = await fetch(defaultAbilityUrl, {
29
- method: 'POST',
30
- headers: {
31
- 'Content-Type': 'application/json'
32
- },
33
- body: JSON.stringify({
34
- query: query,
35
- user: user
36
- })
37
- });
38
- // 2. 流式读取响应(以SSE或chunked格式读取)
39
- const reader = response.body?.getReader();
40
- const decoder = new TextDecoder('utf-8');
41
- if (reader) {
42
- while(true){
43
- const { value, done } = await reader.read();
44
- if (done) break;
45
- const data = decoder.decode(value, {
46
- stream: true
47
- });
48
- yield stream.flush(data);
49
- }
50
- }
51
- } catch (error) {
52
- yield stream.flushReplaceLast(`请求出错,请联系接口人@${administrators}或稍后再试。${error}`);
53
- }
54
- }
55
- }
56
-
57
- const fetchWithTimeout = (url, options, timeout = 120000)=>{
58
- return Promise.race([
59
- fetch(url, options),
60
- new Promise((_, reject)=>setTimeout(()=>reject(new Error('Fetch timeout')), timeout))
61
- ]);
62
- };
63
-
64
- class MessageReceivingProvider extends SkillProvider {
65
- static{
66
- this.skillName = '接收消息服务';
67
- }
68
- static{
69
- this.displayName = '接收消息服务';
70
- }
71
- static{
72
- this.description = '接收所有群消息的流程和代码示例等';
73
- }
74
- static{
75
- this.parameters = {
76
- type: 'object',
77
- properties: {}
78
- };
79
- }
80
- async *execute() {
81
- const stream = new TaskProgressChunkStream();
82
- try {
83
- const myHeaders = new Headers();
84
- myHeaders.append('Content-Type', 'application/json');
85
- const userDetail = await this.currentUser.requestDetail();
86
- const realUserName = userDetail && userDetail.name || '未知用户';
87
- const raw = JSON.stringify({
88
- query: this.currentContext.query,
89
- user: realUserName
90
- });
91
- const options = {
92
- method: 'POST',
93
- headers: {
94
- 'Content-Type': 'application/json'
95
- },
96
- body: raw
97
- };
98
- const response = await fetchWithTimeout(messageReceivingUrl, options);
99
- const result = await response.json();
100
- yield stream.flushReplaceLast(result.data.content); // markdown字符串
101
- } catch (error) {
102
- yield stream.flushReplaceLast(`请求出错,请联系接口人@${administrators}或稍后再试。${error}`);
103
- }
104
- }
105
- }
106
-
107
- class CreateGroupProvider extends SkillProvider {
108
- static{
109
- this.skillName = '创建群聊';
110
- }
111
- static{
112
- this.displayName = '创建群聊';
113
- }
114
- static{
115
- this.description = '获取一键创建群聊的流程和代码示例';
116
- }
117
- static{
118
- this.parameters = {
119
- type: 'object',
120
- properties: {}
121
- };
122
- }
123
- async *execute() {
124
- const stream = new TaskProgressChunkStream();
125
- try {
126
- const myHeaders = new Headers();
127
- myHeaders.append('Content-Type', 'application/json');
128
- const userDetail = await this.currentUser.requestDetail();
129
- const realUserName = userDetail && userDetail.name || '未知用户';
130
- const raw = JSON.stringify({
131
- query: this.currentContext.query,
132
- user: realUserName
133
- });
134
- const options = {
135
- method: 'POST',
136
- headers: {
137
- 'Content-Type': 'application/json'
138
- },
139
- body: raw
140
- };
141
- const response = await fetchWithTimeout(createGroupUrl, options);
142
- const result = await response.json();
143
- yield stream.flushReplaceLast(result.data.content); // markdown字符串
144
- } catch (error) {
145
- yield stream.flushReplaceLast(`请求出错,请联系接口人@${administrators}或稍后再试。${error}`);
146
- }
147
- }
148
- }
149
-
150
- class GetGroupInfoProvider extends SkillProvider {
151
- static{
152
- this.skillName = '查询群聊基本信息';
153
- }
154
- static{
155
- this.displayName = '查询群聊基本信息';
156
- }
157
- static{
158
- this.description = '查询群聊基本信息的流程和代码示例';
159
- }
160
- static{
161
- this.parameters = {
162
- type: 'object',
163
- properties: {}
164
- };
165
- }
166
- async *execute() {
167
- const stream = new TaskProgressChunkStream();
168
- try {
169
- const myHeaders = new Headers();
170
- myHeaders.append('Content-Type', 'application/json');
171
- const userDetail = await this.currentUser.requestDetail();
172
- const realUserName = userDetail && userDetail.name || '未知用户';
173
- const raw = JSON.stringify({
174
- query: this.currentContext.query,
175
- user: realUserName
176
- });
177
- const options = {
178
- method: 'POST',
179
- headers: {
180
- 'Content-Type': 'application/json'
181
- },
182
- body: raw
183
- };
184
- const response = await fetchWithTimeout(getGroupInfoUrl, options);
185
- const result = await response.json();
186
- yield stream.flushReplaceLast(result.data.content); // markdown字符串
187
- } catch (error) {
188
- yield stream.flushReplaceLast(`请求出错,请联系接口人@${administrators}或稍后再试。${error}`);
189
- }
190
- }
191
- }
192
-
193
- class MessagePushProvider extends SkillProvider {
194
- static{
195
- this.skillName = '推送消息';
196
- }
197
- static{
198
- this.displayName = '推送消息';
199
- }
200
- static{
201
- this.description = '主动推送消息流程和代码示例等';
202
- }
203
- static{
204
- this.parameters = {
205
- type: 'object',
206
- properties: {}
207
- };
208
- }
209
- async *execute() {
210
- const stream = new TaskProgressChunkStream();
211
- try {
212
- const myHeaders = new Headers();
213
- myHeaders.append('Content-Type', 'application/json');
214
- const userDetail = await this.currentUser.requestDetail();
215
- const realUserName = userDetail && userDetail.name || '未知用户';
216
- const raw = JSON.stringify({
217
- query: this.currentContext.query,
218
- user: realUserName
219
- });
220
- const options = {
221
- method: 'POST',
222
- headers: {
223
- 'Content-Type': 'application/json'
224
- },
225
- body: raw
226
- };
227
- const response = await fetchWithTimeout(messagePushUrl, options);
228
- const result = await response.json();
229
- yield stream.flushReplaceLast(result.data.content); // markdown字符串
230
- } catch (error) {
231
- yield stream.flushReplaceLast(`请求出错,请联系接口人@${administrators}或稍后再试。${error}`);
232
- }
233
- }
234
- }
235
-
236
- class IntroductionProvider extends SkillProvider {
237
- static{
238
- this.skillName = '插件介绍';
239
- }
240
- static{
241
- this.displayName = '插件介绍';
242
- }
243
- static{
244
- this.description = '插件介绍';
245
- }
246
- static{
247
- this.parameters = {
248
- type: 'object',
249
- properties: {}
250
- };
251
- }
252
- async *execute() {
253
- const stream = new TaskProgressChunkStream();
254
- try {
255
- const myHeaders = new Headers();
256
- myHeaders.append('Content-Type', 'application/json');
257
- const userDetail = await this.currentUser.requestDetail();
258
- const realUserName = userDetail && userDetail.name || '未知用户';
259
- const raw = JSON.stringify({
260
- query: this.currentContext.query,
261
- user: realUserName
262
- });
263
- const options = {
264
- method: 'POST',
265
- headers: {
266
- 'Content-Type': 'application/json'
267
- },
268
- body: raw
269
- };
270
- const response = await fetchWithTimeout(introductionUrl, options);
271
- const result = await response.json();
272
- yield stream.flushReplaceLast(result.data.content); // markdown字符串
273
- } catch (error) {
274
- yield stream.flushReplaceLast(`请求出错,请联系接口人@${administrators}或稍后再试。${error}`);
275
- }
276
- }
277
- }
278
-
279
- function setup({ registry }) {
280
- registry.registerFallbackProvider('fallback', HelpFallbackProvider, true);
281
- registry.registerSkillProvider('messageReceiving', MessageReceivingProvider);
282
- registry.registerSkillProvider('createGroup', CreateGroupProvider);
283
- registry.registerSkillProvider('getGroupInfo', GetGroupInfoProvider);
284
- registry.registerSkillProvider('messagePush', MessagePushProvider);
285
- registry.registerSkillProvider('introduction', IntroductionProvider);
286
- }
287
-
288
- export { setup };
@@ -1,67 +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": "messageReceiving",
41
- "displayName": "消息接收回调服务框架_代码生成",
42
- "description": "获取接收所有群消息的流程和代码示例等"
43
- },
44
- {
45
- "type": "Skill",
46
- "name": "messagePush",
47
- "displayName": "推送消息_代码生成",
48
- "description": "主动推送消息流程和代码示例等"
49
- },
50
- {
51
- "type": "Skill",
52
- "name": "getGroupInfo",
53
- "displayName": "获取群聊基本信息_代码生成",
54
- "description": "获取群聊基本信息流程和代码示例等"
55
- },
56
- {
57
- "type": "Skill",
58
- "name": "createGroup",
59
- "displayName": "创建群聊_代码生成",
60
- "description": "创建群聊流程和代码示例等"
61
- }
62
- ],
63
- "configSchema": {
64
- "sections": []
65
- }
66
- }
67
- }