@comate/zulu 0.7.1 → 0.7.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.
- 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/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,807 +0,0 @@
|
|
|
1
|
-
import { SkillProvider, TaskProgressChunkStream, FallbackProvider, ElementChunkStream, StringChunkStream } from '@comate/plugin-host';
|
|
2
|
-
import { readFileSync } from 'fs';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { dirname } from 'path';
|
|
5
|
-
import fs from 'node:fs';
|
|
6
|
-
import path from 'node:path';
|
|
7
|
-
|
|
8
|
-
class HelpSkillProvider extends SkillProvider {
|
|
9
|
-
static{
|
|
10
|
-
this.skillName = 'tor-help';
|
|
11
|
-
}
|
|
12
|
-
static{
|
|
13
|
-
this.description = '插件介绍';
|
|
14
|
-
}
|
|
15
|
-
static{
|
|
16
|
-
this.parameters = {
|
|
17
|
-
type: 'object',
|
|
18
|
-
properties: {}
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
async *execute() {
|
|
22
|
-
const stream = new TaskProgressChunkStream();
|
|
23
|
-
const filename = fileURLToPath(import.meta.url);
|
|
24
|
-
const content = readFileSync(`${dirname(filename)}/help.md`, 'utf8');
|
|
25
|
-
yield stream.flush(content);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const fetchWithTimeout = (url, options, timeout = 60000)=>{
|
|
30
|
-
return Promise.race([
|
|
31
|
-
fetch(url, options),
|
|
32
|
-
new Promise((_, reject)=>setTimeout(()=>reject(new Error('Fetch timeout')), timeout))
|
|
33
|
-
]);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
// 10.11.63.140 vip 地址
|
|
37
|
-
const defaultAbilityUrl = 'http://10.11.63.140:8080/comate/defaultAbility';
|
|
38
|
-
const codeNameCreateUrl = 'http://10.11.63.140:8080/comate/codeNameCreate';
|
|
39
|
-
const errorLogAnalysisUrl = 'http://10.11.63.140:8080/comate/errorLogAnalysis';
|
|
40
|
-
const kuRecentScanUrl = 'http://10.11.134.195:8000/api/v1/ku/recentData';
|
|
41
|
-
const personalCommonAddressUrl = 'http://10.11.63.140:8080/comate/common/address';
|
|
42
|
-
// 搜索文档
|
|
43
|
-
const searchDocApi = 'http://10.11.135.192:8400/comate_plus/search_doc';
|
|
44
|
-
// 知识库环境部署
|
|
45
|
-
const getEnvUrl = 'http://10.11.63.140:8080/comate/kuEnvInfo';
|
|
46
|
-
const deployEnvUrl = 'http://10.11.63.140:8080/api/ku/env_agile';
|
|
47
|
-
// 性能测试用例生成
|
|
48
|
-
const perfTestUrl = 'http://10.11.63.140:8080/comate/perfTest';
|
|
49
|
-
// 搜索监控用例生成
|
|
50
|
-
const monitorCaseUrl = 'http://10.11.134.195:8400/comate/monitor/test';
|
|
51
|
-
// 时间戳工具
|
|
52
|
-
const timestampUrl = 'http://10.11.63.140:8080/comate/timestampTool';
|
|
53
|
-
|
|
54
|
-
class HelpFallbackProvider extends FallbackProvider {
|
|
55
|
-
static{
|
|
56
|
-
this.description = '默认能力';
|
|
57
|
-
}
|
|
58
|
-
async *handleQuery() {
|
|
59
|
-
const stream = new TaskProgressChunkStream();
|
|
60
|
-
try {
|
|
61
|
-
const myHeaders = new Headers();
|
|
62
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
63
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
64
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
65
|
-
const raw = JSON.stringify({
|
|
66
|
-
query: this.currentContext.query,
|
|
67
|
-
user: realUserName
|
|
68
|
-
});
|
|
69
|
-
const options = {
|
|
70
|
-
method: 'POST',
|
|
71
|
-
headers: {
|
|
72
|
-
'Content-Type': 'application/json'
|
|
73
|
-
},
|
|
74
|
-
body: raw
|
|
75
|
-
};
|
|
76
|
-
const response = await fetchWithTimeout(defaultAbilityUrl, options);
|
|
77
|
-
const result = await response.json();
|
|
78
|
-
yield stream.flushReplaceLast(result.data.content); // markdown字符串
|
|
79
|
-
} catch (error) {
|
|
80
|
-
yield stream.flushReplaceLast(`请求出错,请联系负责人@rongsong或稍后再试。${error}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
class CodeNameCreateProvider extends SkillProvider {
|
|
86
|
-
static{
|
|
87
|
-
this.skillName = '代码变量起名';
|
|
88
|
-
}
|
|
89
|
-
static{
|
|
90
|
-
this.displayName = '代码变量起名';
|
|
91
|
-
}
|
|
92
|
-
static{
|
|
93
|
-
this.description = '给代码变量或类快速起名,支持驼峰、下划线等格式';
|
|
94
|
-
}
|
|
95
|
-
static{
|
|
96
|
-
this.parameters = {
|
|
97
|
-
type: 'object',
|
|
98
|
-
properties: {}
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
async *execute() {
|
|
102
|
-
const stream = new TaskProgressChunkStream();
|
|
103
|
-
try {
|
|
104
|
-
const myHeaders = new Headers();
|
|
105
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
106
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
107
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
108
|
-
const raw = JSON.stringify({
|
|
109
|
-
query: this.currentContext.query,
|
|
110
|
-
user: realUserName
|
|
111
|
-
});
|
|
112
|
-
const options = {
|
|
113
|
-
method: 'POST',
|
|
114
|
-
headers: {
|
|
115
|
-
'Content-Type': 'application/json'
|
|
116
|
-
},
|
|
117
|
-
body: raw
|
|
118
|
-
};
|
|
119
|
-
const response = await fetchWithTimeout(codeNameCreateUrl, options);
|
|
120
|
-
const result = await response.json();
|
|
121
|
-
yield stream.flushReplaceLast(result.data.content); // markdown字符串
|
|
122
|
-
} catch (error) {
|
|
123
|
-
yield stream.flushReplaceLast(`请求出错,请联系负责人@rongsong或稍后再试。${error}`);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
class ErrorLogAnalysisProvider extends SkillProvider {
|
|
129
|
-
static{
|
|
130
|
-
this.skillName = '报错日志分析';
|
|
131
|
-
}
|
|
132
|
-
static{
|
|
133
|
-
this.displayName = '报错日志分析';
|
|
134
|
-
}
|
|
135
|
-
static{
|
|
136
|
-
this.description = '分析编码环节错误日志的原因,并给出解决方案';
|
|
137
|
-
}
|
|
138
|
-
static{
|
|
139
|
-
this.parameters = {
|
|
140
|
-
type: 'object',
|
|
141
|
-
properties: {}
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
async *execute() {
|
|
145
|
-
const stream = new TaskProgressChunkStream();
|
|
146
|
-
try {
|
|
147
|
-
const myHeaders = new Headers();
|
|
148
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
149
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
150
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
151
|
-
const raw = JSON.stringify({
|
|
152
|
-
query: this.currentContext.query,
|
|
153
|
-
user: realUserName
|
|
154
|
-
});
|
|
155
|
-
const options = {
|
|
156
|
-
method: 'POST',
|
|
157
|
-
headers: {
|
|
158
|
-
'Content-Type': 'application/json'
|
|
159
|
-
},
|
|
160
|
-
body: raw
|
|
161
|
-
};
|
|
162
|
-
const response = await fetchWithTimeout(errorLogAnalysisUrl, options);
|
|
163
|
-
const result = await response.json();
|
|
164
|
-
yield stream.flushReplaceLast(result.data.content); // markdown字符串
|
|
165
|
-
} catch (error) {
|
|
166
|
-
yield stream.flushReplaceLast(`请求出错,请联系负责人@rongsong或稍后再试。${error}`);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
class kuRecentScanProvider extends SkillProvider {
|
|
172
|
-
static{
|
|
173
|
-
this.skillName = '知识库浏览/收藏/星标数据';
|
|
174
|
-
}
|
|
175
|
-
static{
|
|
176
|
-
this.displayName = '知识库浏览/收藏/星标数据';
|
|
177
|
-
}
|
|
178
|
-
static{
|
|
179
|
-
this.description = '召回最近浏览/星标/关注/收藏的知识库文档,快速追溯需求或接口文档';
|
|
180
|
-
}
|
|
181
|
-
static{
|
|
182
|
-
this.parameters = {
|
|
183
|
-
type: 'object',
|
|
184
|
-
properties: {}
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
async *execute() {
|
|
188
|
-
const stream = new TaskProgressChunkStream();
|
|
189
|
-
try {
|
|
190
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
191
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
192
|
-
const raw = JSON.stringify({
|
|
193
|
-
query: this.currentContext.query,
|
|
194
|
-
name: realUserName
|
|
195
|
-
});
|
|
196
|
-
const options = {
|
|
197
|
-
method: 'POST',
|
|
198
|
-
headers: {
|
|
199
|
-
'Content-Type': 'application/json'
|
|
200
|
-
},
|
|
201
|
-
body: raw
|
|
202
|
-
};
|
|
203
|
-
const response = await fetchWithTimeout(kuRecentScanUrl, options);
|
|
204
|
-
const result = await response.json();
|
|
205
|
-
yield stream.flushReplaceLast(result.data.content); // markdown字符串
|
|
206
|
-
} catch (error) {
|
|
207
|
-
yield stream.flushReplaceLast(`请求出错,请联系负责人@qinqin或稍后再试。${error}`);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
class DocSearchProvider extends SkillProvider {
|
|
213
|
-
static{
|
|
214
|
-
this.skillName = '找知识库文档';
|
|
215
|
-
}
|
|
216
|
-
static{
|
|
217
|
-
this.displayName = '找知识库文档';
|
|
218
|
-
}
|
|
219
|
-
static{
|
|
220
|
-
this.description = '根据分享、浏览/编辑、关联会议等行为找知识库文档';
|
|
221
|
-
}
|
|
222
|
-
static{
|
|
223
|
-
this.parameters = {
|
|
224
|
-
type: 'object',
|
|
225
|
-
properties: {}
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
async *execute() {
|
|
229
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
230
|
-
const userName = userDetail && userDetail.name || '未知用户';
|
|
231
|
-
const query = this.currentContext.query;
|
|
232
|
-
const stream = new TaskProgressChunkStream();
|
|
233
|
-
if (!query) {
|
|
234
|
-
yield stream.flushReplaceLast('找文档功能支持查找1个月内特定人员分享、编辑、创建、浏览、评论、星标的文档,' + '特定会议里的关联或者投屏的文档,特定主题相关的文档等。 \n' + '示例:"找我编辑的文档"、"找[张三]写的关于[comate]的文档"、"找[李四]发给我的文档"');
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
const apiConfig = {
|
|
238
|
-
method: 'POST',
|
|
239
|
-
headers: {
|
|
240
|
-
'Content-Type': 'application/json'
|
|
241
|
-
},
|
|
242
|
-
body: JSON.stringify({
|
|
243
|
-
user: userName,
|
|
244
|
-
query: query
|
|
245
|
-
})
|
|
246
|
-
};
|
|
247
|
-
try {
|
|
248
|
-
const response = await fetch(searchDocApi, apiConfig);
|
|
249
|
-
const result = await response.json();
|
|
250
|
-
this.logger.info(result);
|
|
251
|
-
if (!result || !result.data || !result.data.content) {
|
|
252
|
-
if (result.message) {
|
|
253
|
-
throw new Error(result.message);
|
|
254
|
-
} else {
|
|
255
|
-
throw new Error('result.data is null or result.data.content is empty');
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
yield stream.flushReplaceLast(result.data.content);
|
|
259
|
-
} catch (error) {
|
|
260
|
-
yield stream.flushReplaceLast(`请求出错,请联系负责人@baizhihao 或稍后再试。${error}`);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
function jsx(type, props) {
|
|
266
|
-
// 按照React的逻辑,`boolean`、`null`、`undefined`是不会显示出来的
|
|
267
|
-
const children = Array.isArray(props.children) ? props.children.filter((v)=>v != null && typeof v !== 'boolean') : props.children;
|
|
268
|
-
return {
|
|
269
|
-
type,
|
|
270
|
-
...props,
|
|
271
|
-
children
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
const configFolder = './.comate';
|
|
276
|
-
const torPath = `${configFolder}/ku_env.json`;
|
|
277
|
-
const ipipePath = `${configFolder}/ipipe_params.json`;
|
|
278
|
-
function checkFolderExistsSync(folderPath) {
|
|
279
|
-
try {
|
|
280
|
-
return fs.existsSync(folderPath) && fs.statSync(folderPath).isDirectory();
|
|
281
|
-
} catch (err) {
|
|
282
|
-
return false;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
function checkFileExistsSync(filePath) {
|
|
286
|
-
try {
|
|
287
|
-
return fs.existsSync(filePath) && fs.statSync(filePath).isFile();
|
|
288
|
-
} catch (err) {
|
|
289
|
-
return false;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
function initConfigFile(cwd, configJson, type, mkdir) {
|
|
293
|
-
let configPath = '';
|
|
294
|
-
if (type === 'ipipe') {
|
|
295
|
-
configPath = ipipePath;
|
|
296
|
-
} else {
|
|
297
|
-
configPath = torPath;
|
|
298
|
-
}
|
|
299
|
-
if (mkdir) {
|
|
300
|
-
fs.mkdirSync(path.resolve(cwd, configFolder));
|
|
301
|
-
}
|
|
302
|
-
fs.writeFileSync(path.resolve(cwd, configPath), JSON.stringify(configJson, null, 2));
|
|
303
|
-
}
|
|
304
|
-
function initDeployConfig(cwd, type, configJson) {
|
|
305
|
-
const configPath = type === 'ipipe' ? ipipePath : torPath;
|
|
306
|
-
const absolutePath = path.resolve(cwd, configPath);
|
|
307
|
-
try {
|
|
308
|
-
const isFileExisted = checkFileExistsSync(absolutePath);
|
|
309
|
-
if (isFileExisted) {
|
|
310
|
-
// 如果配置文件存在,刷新下文件内容
|
|
311
|
-
const jsonData = JSON.stringify(configJson, null, 2);
|
|
312
|
-
fs.writeFileSync(absolutePath, jsonData);
|
|
313
|
-
return {
|
|
314
|
-
type: 'success',
|
|
315
|
-
path: configPath
|
|
316
|
-
};
|
|
317
|
-
} else {
|
|
318
|
-
const isFolderExisted = checkFolderExistsSync(path.resolve(cwd, configFolder));
|
|
319
|
-
if (!isFolderExisted) {
|
|
320
|
-
initConfigFile(cwd, configJson, type, true);
|
|
321
|
-
// const fileBuffer = fs.readFileSync(path.resolve(cwd, configPath));
|
|
322
|
-
return {
|
|
323
|
-
type: 'success',
|
|
324
|
-
path: configPath
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
const isFileExisted = checkFileExistsSync(path.resolve(cwd, configPath));
|
|
328
|
-
if (!isFileExisted) {
|
|
329
|
-
initConfigFile(cwd, configJson, type);
|
|
330
|
-
// const fileBuffer = fs.readFileSync(path.resolve(cwd, configPath));
|
|
331
|
-
return {
|
|
332
|
-
type: 'success',
|
|
333
|
-
path: configPath
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
} catch (ex) {
|
|
338
|
-
throw new Error(`获取配置文件失败 ${ex instanceof Error ? ex.message : ex}`);
|
|
339
|
-
}
|
|
340
|
-
return {
|
|
341
|
-
type: 'error',
|
|
342
|
-
path: configPath
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
function getDeployConfig(cwd, type) {
|
|
346
|
-
let configPath = '';
|
|
347
|
-
if (type === 'ipipe') {
|
|
348
|
-
configPath = ipipePath;
|
|
349
|
-
} else {
|
|
350
|
-
configPath = torPath;
|
|
351
|
-
}
|
|
352
|
-
try {
|
|
353
|
-
const fileBuffer = fs.readFileSync(path.resolve(cwd, configPath));
|
|
354
|
-
return {
|
|
355
|
-
type: 'file',
|
|
356
|
-
value: fileBuffer
|
|
357
|
-
};
|
|
358
|
-
} catch (ex) {
|
|
359
|
-
const Message = '获取最新配置文件异常!';
|
|
360
|
-
return {
|
|
361
|
-
type: 'message',
|
|
362
|
-
content: Message
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* 将代码块格式化为Markdown语法中的代码块
|
|
368
|
-
*
|
|
369
|
-
* @param codeLanguage 代码的语言类型,如javascript, typescript等
|
|
370
|
-
* @param code 要格式化的代码内容
|
|
371
|
-
* @returns 返回格式化后的Markdown代码块字符串
|
|
372
|
-
*/ const echoCodeBlock = (codeLanguage, code)=>{
|
|
373
|
-
return `\n\`\`\`${codeLanguage}\n${code}\n\`\`\`\n\n`;
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
class kuEnvDeployProvider extends SkillProvider {
|
|
377
|
-
static{
|
|
378
|
-
this.skillName = '知识库环境部署';
|
|
379
|
-
}
|
|
380
|
-
static{
|
|
381
|
-
this.displayName = '知识库环境部署';
|
|
382
|
-
}
|
|
383
|
-
static{
|
|
384
|
-
this.description = '部署知识库业务模块的开发和测试环境';
|
|
385
|
-
}
|
|
386
|
-
static{
|
|
387
|
-
this.parameters = {
|
|
388
|
-
type: 'object',
|
|
389
|
-
properties: {}
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
constructor(init){
|
|
393
|
-
super(init);
|
|
394
|
-
this.cwd = init.cwd;
|
|
395
|
-
}
|
|
396
|
-
async *execute() {
|
|
397
|
-
const stream = new ElementChunkStream();
|
|
398
|
-
try {
|
|
399
|
-
const myHeaders = new Headers();
|
|
400
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
401
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
402
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
403
|
-
const queryInfo = this.currentContext.query;
|
|
404
|
-
const raw = JSON.stringify({
|
|
405
|
-
query: queryInfo,
|
|
406
|
-
user: realUserName
|
|
407
|
-
});
|
|
408
|
-
const options = {
|
|
409
|
-
method: 'POST',
|
|
410
|
-
headers: myHeaders,
|
|
411
|
-
body: raw
|
|
412
|
-
};
|
|
413
|
-
const response = await fetchWithTimeout(getEnvUrl, options);
|
|
414
|
-
const result = await response.json();
|
|
415
|
-
const code = result.code;
|
|
416
|
-
const message = result.msg;
|
|
417
|
-
if (code != 0) {
|
|
418
|
-
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("p", {
|
|
419
|
-
children: message
|
|
420
|
-
}));
|
|
421
|
-
} else {
|
|
422
|
-
const envInfo = result.data.env_info;
|
|
423
|
-
const env = envInfo.env;
|
|
424
|
-
const module = envInfo.module;
|
|
425
|
-
// 首先查找本地是否存在配置文件,如若存在,直接将查询到的数据覆盖文件;如若不存在,新建文件后写入查询到的数据
|
|
426
|
-
try {
|
|
427
|
-
const data = initDeployConfig(this.cwd, 'tor', envInfo);
|
|
428
|
-
if (data?.type === 'success') {
|
|
429
|
-
const configPath = data.path;
|
|
430
|
-
console.log('configPath: ', configPath);
|
|
431
|
-
yield stream.flush(/*#__PURE__*/ jsx("p", {
|
|
432
|
-
children: [
|
|
433
|
-
"已为你[更新]",
|
|
434
|
-
/*#__PURE__*/ jsx("strong", {
|
|
435
|
-
children: [
|
|
436
|
-
"环境【rd/qa",
|
|
437
|
-
env,
|
|
438
|
-
"】"
|
|
439
|
-
]
|
|
440
|
-
}),
|
|
441
|
-
"和",
|
|
442
|
-
/*#__PURE__*/ jsx("strong", {
|
|
443
|
-
children: [
|
|
444
|
-
"模块【",
|
|
445
|
-
module,
|
|
446
|
-
"】"
|
|
447
|
-
]
|
|
448
|
-
}),
|
|
449
|
-
"的配置文件 ",
|
|
450
|
-
/*#__PURE__*/ jsx("br", {}),
|
|
451
|
-
"请检查和确认配置文件是否需要修改,文件地址:",
|
|
452
|
-
/*#__PURE__*/ jsx("file-link", {
|
|
453
|
-
to: configPath,
|
|
454
|
-
line: 1,
|
|
455
|
-
children: "ku_env.json"
|
|
456
|
-
}),
|
|
457
|
-
' ',
|
|
458
|
-
/*#__PURE__*/ jsx("br", {}),
|
|
459
|
-
"修改并保存后点击【确认】后即可开始部署流程,或点击【取消】来结束此次指令任务"
|
|
460
|
-
]
|
|
461
|
-
}));
|
|
462
|
-
}
|
|
463
|
-
// 用户点击确认后才开始部署,如果点击取消,则不部署
|
|
464
|
-
yield stream.flush(/*#__PURE__*/ jsx("button-group", {
|
|
465
|
-
children: [
|
|
466
|
-
/*#__PURE__*/ jsx("command-button", {
|
|
467
|
-
commandName: "commitMessage:confirmIssue",
|
|
468
|
-
data: "yes",
|
|
469
|
-
replyText: "确认",
|
|
470
|
-
variant: "primary",
|
|
471
|
-
children: "确认"
|
|
472
|
-
}),
|
|
473
|
-
/*#__PURE__*/ jsx("command-button", {
|
|
474
|
-
commandName: "commitMessage:confirmIssue",
|
|
475
|
-
data: "no",
|
|
476
|
-
replyText: "取消",
|
|
477
|
-
children: "取消"
|
|
478
|
-
})
|
|
479
|
-
]
|
|
480
|
-
}));
|
|
481
|
-
} catch (ex) {
|
|
482
|
-
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("p", {
|
|
483
|
-
children: [
|
|
484
|
-
"请求出错,请联系负责人@qinqin或稍后再试。$",
|
|
485
|
-
ex
|
|
486
|
-
]
|
|
487
|
-
}));
|
|
488
|
-
return;
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
} catch (error) {
|
|
492
|
-
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("p", {
|
|
493
|
-
children: [
|
|
494
|
-
"请求出错,请联系负责人@qinqin或稍后再试。$",
|
|
495
|
-
error
|
|
496
|
-
]
|
|
497
|
-
}));
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
// 承接点击事件
|
|
501
|
-
async *handleCommand(commandName, data) {
|
|
502
|
-
const stream = new ElementChunkStream();
|
|
503
|
-
if (commandName === 'commitMessage:confirmIssue') {
|
|
504
|
-
if (data === 'yes') {
|
|
505
|
-
// 部署环境
|
|
506
|
-
let fileBuffer;
|
|
507
|
-
let request;
|
|
508
|
-
const data = getDeployConfig(this.cwd, 'tor');
|
|
509
|
-
if (data?.type === 'file') {
|
|
510
|
-
fileBuffer = data.value;
|
|
511
|
-
request = fileBuffer?.toString();
|
|
512
|
-
}
|
|
513
|
-
const myHeaders = new Headers();
|
|
514
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
515
|
-
const options = {
|
|
516
|
-
method: 'POST',
|
|
517
|
-
headers: myHeaders,
|
|
518
|
-
body: request
|
|
519
|
-
};
|
|
520
|
-
const response = await fetchWithTimeout(deployEnvUrl, options);
|
|
521
|
-
const result = await response.json();
|
|
522
|
-
console.log('response: ', result.data.agile_url);
|
|
523
|
-
if (result.code === '200') {
|
|
524
|
-
yield stream.flush(/*#__PURE__*/ jsx("p", {
|
|
525
|
-
children: /*#__PURE__*/ jsx("a", {
|
|
526
|
-
href: result.data.agile_url,
|
|
527
|
-
children: "已成功触发流水线环境部署,可点击查看~"
|
|
528
|
-
})
|
|
529
|
-
}));
|
|
530
|
-
} else {
|
|
531
|
-
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("p", {
|
|
532
|
-
children: [
|
|
533
|
-
"部署出错,请联系负责人@qinqin或稍后再试。",
|
|
534
|
-
result.message
|
|
535
|
-
]
|
|
536
|
-
}));
|
|
537
|
-
}
|
|
538
|
-
} else {
|
|
539
|
-
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("p", {
|
|
540
|
-
children: "您已取消此次环境部署~"
|
|
541
|
-
}));
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
/**
|
|
548
|
-
* 获取当前时间戳的 Markdown 格式字符串
|
|
549
|
-
*
|
|
550
|
-
* @returns 包含当前秒级和毫秒级时间戳的 Markdown 格式字符串
|
|
551
|
-
*/ function getCurrentTimeStampMd() {
|
|
552
|
-
const currentTime = Date.now();
|
|
553
|
-
const currentTimeMs = Math.floor(currentTime / 1000);
|
|
554
|
-
const messageMd = `当前时间戳\n\n` + `秒(s)时间戳:${echoCodeBlock("markdown", currentTimeMs.toString())}\n\n` + `毫秒(ms)时间戳:${echoCodeBlock("markdown", currentTime.toString())}`;
|
|
555
|
-
return messageMd;
|
|
556
|
-
}
|
|
557
|
-
class TimestampToolProvider extends SkillProvider {
|
|
558
|
-
static{
|
|
559
|
-
this.skillName = "时间戳工具";
|
|
560
|
-
}
|
|
561
|
-
static{
|
|
562
|
-
this.displayName = "时间戳工具";
|
|
563
|
-
}
|
|
564
|
-
static{
|
|
565
|
-
this.description = "获取和转换时间戳";
|
|
566
|
-
}
|
|
567
|
-
static{
|
|
568
|
-
this.parameters = {
|
|
569
|
-
type: 'object',
|
|
570
|
-
properties: {}
|
|
571
|
-
};
|
|
572
|
-
}
|
|
573
|
-
async *execute() {
|
|
574
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
575
|
-
const userName = userDetail && userDetail.name || '未知用户';
|
|
576
|
-
const query = this.currentContext.query;
|
|
577
|
-
const stream = new StringChunkStream();
|
|
578
|
-
// 如果没有输入参数,则返回当前时间戳
|
|
579
|
-
if (!query) {
|
|
580
|
-
const message = getCurrentTimeStampMd();
|
|
581
|
-
yield stream.flush(message);
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
const apiConfig = {
|
|
585
|
-
method: 'POST',
|
|
586
|
-
headers: {
|
|
587
|
-
'Content-Type': 'application/json'
|
|
588
|
-
},
|
|
589
|
-
body: JSON.stringify({
|
|
590
|
-
user: userName,
|
|
591
|
-
query: query
|
|
592
|
-
})
|
|
593
|
-
};
|
|
594
|
-
try {
|
|
595
|
-
const response = await fetch(timestampUrl, apiConfig);
|
|
596
|
-
const result = await response.json();
|
|
597
|
-
this.logger.info(result);
|
|
598
|
-
if (!result || !result.data || !result.data.function) {
|
|
599
|
-
if (result.message) {
|
|
600
|
-
throw new Error(result.message);
|
|
601
|
-
} else {
|
|
602
|
-
throw new Error('result.data is null or result.data.function is empty');
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
const intention = result.data.function;
|
|
606
|
-
if (intention == 'get_current_timestamp') {
|
|
607
|
-
const message = getCurrentTimeStampMd();
|
|
608
|
-
yield stream.flush(message);
|
|
609
|
-
} else {
|
|
610
|
-
const answer = result.data.answer;
|
|
611
|
-
yield stream.flush(answer);
|
|
612
|
-
}
|
|
613
|
-
} catch (error) {
|
|
614
|
-
yield stream.flush(`请求出错,请联系负责人\`@baizhihao\` 或稍后再试。\n${error}`);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
class perfTestProvider extends SkillProvider {
|
|
620
|
-
static{
|
|
621
|
-
this.skillName = '性能测试用例生成';
|
|
622
|
-
}
|
|
623
|
-
static{
|
|
624
|
-
this.displayName = '性能测试用例生成';
|
|
625
|
-
}
|
|
626
|
-
static{
|
|
627
|
-
this.description = '支持通过复制cURL信息或自然语言描述,快速生成Locust性能测用例';
|
|
628
|
-
}
|
|
629
|
-
static{
|
|
630
|
-
this.parameters = {
|
|
631
|
-
type: 'object',
|
|
632
|
-
properties: {}
|
|
633
|
-
};
|
|
634
|
-
}
|
|
635
|
-
async *execute() {
|
|
636
|
-
const stream = new TaskProgressChunkStream();
|
|
637
|
-
try {
|
|
638
|
-
const myHeaders = new Headers();
|
|
639
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
640
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
641
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
642
|
-
const raw = JSON.stringify({
|
|
643
|
-
query: this.currentContext.query,
|
|
644
|
-
user: realUserName
|
|
645
|
-
});
|
|
646
|
-
const options = {
|
|
647
|
-
method: 'POST',
|
|
648
|
-
headers: {
|
|
649
|
-
'Content-Type': 'application/json'
|
|
650
|
-
},
|
|
651
|
-
body: raw
|
|
652
|
-
};
|
|
653
|
-
const response = await fetchWithTimeout(perfTestUrl, options);
|
|
654
|
-
const result = await response.json();
|
|
655
|
-
yield stream.flushReplaceLast(result.data.content); // markdown字符串
|
|
656
|
-
} catch (error) {
|
|
657
|
-
yield stream.flushReplaceLast(`请求出错,请联系负责人@rongsong或稍后再试。${error}`);
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
class monitorTestProvider extends SkillProvider {
|
|
663
|
-
static{
|
|
664
|
-
this.skillName = '监控测试用例生成';
|
|
665
|
-
}
|
|
666
|
-
static{
|
|
667
|
-
this.displayName = '监控测试用例生成';
|
|
668
|
-
}
|
|
669
|
-
static{
|
|
670
|
-
this.description = '支持通过复制cURL信息或自然语言描述,快速生成监控测试用例';
|
|
671
|
-
}
|
|
672
|
-
static{
|
|
673
|
-
this.parameters = {
|
|
674
|
-
type: 'object',
|
|
675
|
-
properties: {}
|
|
676
|
-
};
|
|
677
|
-
}
|
|
678
|
-
async *execute() {
|
|
679
|
-
const stream = new TaskProgressChunkStream();
|
|
680
|
-
try {
|
|
681
|
-
const myHeaders = new Headers();
|
|
682
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
683
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
684
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
685
|
-
const raw = JSON.stringify({
|
|
686
|
-
query: this.currentContext.query,
|
|
687
|
-
user: realUserName
|
|
688
|
-
});
|
|
689
|
-
const options = {
|
|
690
|
-
method: 'POST',
|
|
691
|
-
headers: {
|
|
692
|
-
'Content-Type': 'application/json'
|
|
693
|
-
},
|
|
694
|
-
body: raw
|
|
695
|
-
};
|
|
696
|
-
const response = await fetchWithTimeout(monitorCaseUrl, options);
|
|
697
|
-
const result = await response.json();
|
|
698
|
-
yield stream.flushReplaceLast(result.data.result); // markdown字符串
|
|
699
|
-
} catch (error) {
|
|
700
|
-
yield stream.flushReplaceLast(`请求出错,请联系负责人@wangshunzhe或稍后再试。${error}`);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
class PersonalCommonAddressProvider extends SkillProvider {
|
|
706
|
-
static{
|
|
707
|
-
this.skillName = '个人常用地址管理';
|
|
708
|
-
}
|
|
709
|
-
static{
|
|
710
|
-
this.displayName = '个人常用地址管理';
|
|
711
|
-
}
|
|
712
|
-
static{
|
|
713
|
-
this.description = '支持自定义常用地址,实现快速查询';
|
|
714
|
-
}
|
|
715
|
-
static{
|
|
716
|
-
this.parameters = {
|
|
717
|
-
type: 'object',
|
|
718
|
-
properties: {}
|
|
719
|
-
};
|
|
720
|
-
}
|
|
721
|
-
async *execute() {
|
|
722
|
-
const stream = new ElementChunkStream();
|
|
723
|
-
try {
|
|
724
|
-
const myHeaders = new Headers();
|
|
725
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
726
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
727
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
728
|
-
const raw = JSON.stringify({
|
|
729
|
-
query: this.currentContext.query,
|
|
730
|
-
user: realUserName
|
|
731
|
-
});
|
|
732
|
-
const options = {
|
|
733
|
-
method: 'POST',
|
|
734
|
-
headers: {
|
|
735
|
-
'Content-Type': 'application/json'
|
|
736
|
-
},
|
|
737
|
-
body: raw
|
|
738
|
-
};
|
|
739
|
-
const response = await fetchWithTimeout(personalCommonAddressUrl, options);
|
|
740
|
-
const result = await response.json();
|
|
741
|
-
const aisuda = result.data.aisuda;
|
|
742
|
-
const address_list = result.data.content;
|
|
743
|
-
const length = address_list.length;
|
|
744
|
-
if (length === 0) {
|
|
745
|
-
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("p", {
|
|
746
|
-
children: [
|
|
747
|
-
/*#__PURE__*/ jsx("strong", {
|
|
748
|
-
children: "你还没有设置常用地址哦~"
|
|
749
|
-
}),
|
|
750
|
-
/*#__PURE__*/ jsx("br", {})
|
|
751
|
-
]
|
|
752
|
-
}));
|
|
753
|
-
} else {
|
|
754
|
-
yield stream.flush(/*#__PURE__*/ jsx("p", {
|
|
755
|
-
children: /*#__PURE__*/ jsx("strong", {
|
|
756
|
-
children: "你的常用地址如下:"
|
|
757
|
-
})
|
|
758
|
-
}));
|
|
759
|
-
for(let i = 1; i < length + 1; i++){
|
|
760
|
-
const url = address_list[i - 1].address;
|
|
761
|
-
const name = address_list[i - 1].name;
|
|
762
|
-
yield stream.flush(/*#__PURE__*/ jsx("blockquote", {
|
|
763
|
-
children: /*#__PURE__*/ jsx("flex", {
|
|
764
|
-
centered: true,
|
|
765
|
-
gap: "sm",
|
|
766
|
-
children: [
|
|
767
|
-
i,
|
|
768
|
-
".",
|
|
769
|
-
/*#__PURE__*/ jsx("a", {
|
|
770
|
-
href: url,
|
|
771
|
-
children: name
|
|
772
|
-
})
|
|
773
|
-
]
|
|
774
|
-
})
|
|
775
|
-
}));
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
yield stream.flush(/*#__PURE__*/ jsx("flex", {
|
|
779
|
-
flexEndCentered: true,
|
|
780
|
-
children: /*#__PURE__*/ jsx("a", {
|
|
781
|
-
href: aisuda,
|
|
782
|
-
children: "↗去配置更多地址"
|
|
783
|
-
})
|
|
784
|
-
}));
|
|
785
|
-
} catch (ex) {
|
|
786
|
-
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("p", {
|
|
787
|
-
children: "请求出错,请联系负责人wangwei160或稍后再试。"
|
|
788
|
-
}));
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
function setup({ registry }) {
|
|
794
|
-
registry.registerFallbackProvider('fallback', HelpFallbackProvider, true);
|
|
795
|
-
registry.registerSkillProvider('tor-help', HelpSkillProvider);
|
|
796
|
-
registry.registerSkillProvider('codeNameCreate', CodeNameCreateProvider);
|
|
797
|
-
registry.registerSkillProvider('errorLogAnalysis', ErrorLogAnalysisProvider);
|
|
798
|
-
registry.registerSkillProvider('kuRecentScan', kuRecentScanProvider);
|
|
799
|
-
registry.registerSkillProvider('docSearch', DocSearchProvider);
|
|
800
|
-
registry.registerSkillProvider('timestampTool', TimestampToolProvider);
|
|
801
|
-
registry.registerSkillProvider('kuEnvDeploy', kuEnvDeployProvider);
|
|
802
|
-
registry.registerSkillProvider('perfTest', perfTestProvider);
|
|
803
|
-
registry.registerSkillProvider('monitorTest', monitorTestProvider);
|
|
804
|
-
registry.registerSkillProvider('personalCommonAddress', PersonalCommonAddressProvider);
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
export { setup };
|