@glodon-aiot/apis 2.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.git.md +73 -0
- package/README.lib.md +135 -0
- package/dist/es/aecpilot/cosntant.mjs +5 -0
- package/dist/es/aecpilot/index.mjs +510 -0
- package/dist/es/aecpilot/model.mjs +9 -0
- package/dist/es/aecpilotui/index.mjs +607 -0
- package/dist/es/agentcliui/index.mjs +418 -0
- package/dist/es/aishop/index.mjs +97 -0
- package/dist/es/aishop/model.mjs +5 -0
- package/dist/es/auth/index.mjs +52 -0
- package/dist/es/base/index.mjs +158 -0
- package/dist/es/contralyze/index.mjs +91 -0
- package/dist/es/cvforce/index.mjs +431 -0
- package/dist/es/cvforce/model.mjs +12 -0
- package/dist/es/cvforce-datahub/index.mjs +435 -0
- package/dist/es/cvforce-datahub/model.mjs +8 -0
- package/dist/es/cvforce-modelservice/index.mjs +114 -0
- package/dist/es/cvforce-modelservice/model.mjs +4 -0
- package/dist/es/index.mjs +62 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +6 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +10 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +9 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +19 -0
- package/dist/es/panorama/index.mjs +136 -0
- package/dist/es/panorama/model.mjs +5 -0
- package/dist/es/pluginmgr/index.mjs +85 -0
- package/dist/es/user/index.mjs +193 -0
- package/dist/es/utils/fetchEventSource/fetch.mjs +112 -0
- package/dist/es/utils/fetchEventSource/parse.mjs +97 -0
- package/dist/es/utils/index.mjs +9 -0
- package/dist/lib/index.js +3 -0
- package/dist/src/aecpilot/cosntant.d.ts +8 -0
- package/dist/src/aecpilot/index.d.ts +79 -0
- package/dist/src/aecpilot/model.d.ts +350 -0
- package/dist/src/aecpilotui/index.d.ts +72 -0
- package/dist/src/aecpilotui/model.d.ts +63 -0
- package/dist/src/agentcliui/index.d.ts +72 -0
- package/dist/src/agentcliui/model.d.ts +39 -0
- package/dist/src/aishop/index.d.ts +26 -0
- package/dist/src/aishop/model.d.ts +111 -0
- package/dist/src/auth/index.d.ts +17 -0
- package/dist/src/auth/model.d.ts +24 -0
- package/dist/src/base/index.d.ts +41 -0
- package/dist/src/base/model.d.ts +20 -0
- package/dist/src/contralyze/index.d.ts +24 -0
- package/dist/src/contralyze/model.d.ts +75 -0
- package/dist/src/cvforce/index.d.ts +130 -0
- package/dist/src/cvforce/model.d.ts +519 -0
- package/dist/src/cvforce-datahub/index.d.ts +186 -0
- package/dist/src/cvforce-datahub/model.d.ts +438 -0
- package/dist/src/cvforce-modelservice/index.d.ts +23 -0
- package/dist/src/cvforce-modelservice/model.d.ts +156 -0
- package/dist/src/index.d.ts +19 -0
- package/dist/src/panorama/index.d.ts +42 -0
- package/dist/src/panorama/model.d.ts +263 -0
- package/dist/src/pluginmgr/index.d.ts +28 -0
- package/dist/src/pluginmgr/model.d.ts +48 -0
- package/dist/src/user/index.d.ts +42 -0
- package/dist/src/user/model.d.ts +247 -0
- package/dist/src/utils/fetchEventSource/fetch.d.ts +44 -0
- package/dist/src/utils/fetchEventSource/index.d.ts +1 -0
- package/dist/src/utils/fetchEventSource/parse.d.ts +36 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
var M = Object.defineProperty, P = Object.defineProperties;
|
|
2
|
+
var K = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var I = Object.getOwnPropertySymbols;
|
|
4
|
+
var b = Object.prototype.hasOwnProperty, E = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var T = (g, e, t) => e in g ? M(g, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[e] = t, f = (g, e) => {
|
|
6
|
+
for (var t in e || (e = {}))
|
|
7
|
+
b.call(e, t) && T(g, t, e[t]);
|
|
8
|
+
if (I)
|
|
9
|
+
for (var t of I(e))
|
|
10
|
+
E.call(e, t) && T(g, t, e[t]);
|
|
11
|
+
return g;
|
|
12
|
+
}, S = (g, e) => P(g, K(e));
|
|
13
|
+
var r = (g, e, t) => new Promise((o, n) => {
|
|
14
|
+
var s = (i) => {
|
|
15
|
+
try {
|
|
16
|
+
m(t.next(i));
|
|
17
|
+
} catch (a) {
|
|
18
|
+
n(a);
|
|
19
|
+
}
|
|
20
|
+
}, h = (i) => {
|
|
21
|
+
try {
|
|
22
|
+
m(t.throw(i));
|
|
23
|
+
} catch (a) {
|
|
24
|
+
n(a);
|
|
25
|
+
}
|
|
26
|
+
}, m = (i) => i.done ? o(i.value) : Promise.resolve(i.value).then(s, h);
|
|
27
|
+
m((t = t.apply(g, e)).next());
|
|
28
|
+
});
|
|
29
|
+
import F from "axios";
|
|
30
|
+
import { BaseApi as O } from "../base/index.mjs";
|
|
31
|
+
import { initMinio as v, putObjectBuffer as C } from "@glodon-aiot/minio";
|
|
32
|
+
import { IHistoryRole as $, AecKnowledgeFileStatus as k } from "./model.mjs";
|
|
33
|
+
import { IFileOrigin as V, ISourceType as W, IThinkingStatus as X, IversionInfo as q } from "./model.mjs";
|
|
34
|
+
import { fetchEventSource as R } from "../utils/fetchEventSource/fetch.mjs";
|
|
35
|
+
import H from "dayjs";
|
|
36
|
+
import { PROMPT_SEARCH_MAX_LENGTH as Q } from "./cosntant.mjs";
|
|
37
|
+
import { PROMPT_TITLE_MAX_LENGTH as ee } from "./cosntant.mjs";
|
|
38
|
+
import w from "../node_modules/uuid/dist/esm-browser/v4.mjs";
|
|
39
|
+
class Y extends O {
|
|
40
|
+
constructor(e, t, o) {
|
|
41
|
+
super(e != null ? e : F.create(), o), this.axiosInstance = e, this.getToken = t;
|
|
42
|
+
}
|
|
43
|
+
// 会话
|
|
44
|
+
getSessions() {
|
|
45
|
+
return r(this, null, function* () {
|
|
46
|
+
return this.get("/chatSession");
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
postSession(e) {
|
|
50
|
+
return r(this, null, function* () {
|
|
51
|
+
return this.post("/chatSession", e);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
getSession(e) {
|
|
55
|
+
return r(this, null, function* () {
|
|
56
|
+
return this.get(`/chatSession/${e}`);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
updateSession(e, t) {
|
|
60
|
+
return r(this, null, function* () {
|
|
61
|
+
return this.patch(`/chatSession/${e}`, t);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
deleteSession(e) {
|
|
65
|
+
return r(this, null, function* () {
|
|
66
|
+
return this.delete(`/chatSession/${e}`);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
// 会话文件
|
|
70
|
+
getSessionKnowledgeFiles(e, t) {
|
|
71
|
+
return r(this, null, function* () {
|
|
72
|
+
return this.get(`chatSession/${e}/file`, t);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
postSessionKnowledgeFile(e, t) {
|
|
76
|
+
return r(this, null, function* () {
|
|
77
|
+
return this.post(`chatSession/${e}/file`, t);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
deleteSessionKnowledgeFiles(e, t) {
|
|
81
|
+
return r(this, null, function* () {
|
|
82
|
+
return this.delete(`chatSession/${e}/file`, t);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
getSessionKnowledgeFile(e, t) {
|
|
86
|
+
return r(this, null, function* () {
|
|
87
|
+
return this.get(`chatSession/${e}/file/${t}`);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
deleteSessionKnowledgeFile(e, t) {
|
|
91
|
+
return r(this, null, function* () {
|
|
92
|
+
return this.delete(`chatSession/${e}/file/${t}`);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
// 会话历史
|
|
96
|
+
getSessionChatHistory(e, t) {
|
|
97
|
+
return r(this, null, function* () {
|
|
98
|
+
return this.get(`/chatSession/${e}/history`, t);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
// 聊天
|
|
102
|
+
postMessage(e, t, o) {
|
|
103
|
+
return r(this, null, function* () {
|
|
104
|
+
return this.post(`/config/tenantApplication?applicationId=${e}&sessionId=${t}`, o);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// 评价
|
|
108
|
+
postComments(e, t) {
|
|
109
|
+
return r(this, null, function* () {
|
|
110
|
+
return this.post(`/chatSession/${e}/comments`, t);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
// 租户应用
|
|
114
|
+
listApplications() {
|
|
115
|
+
return r(this, null, function* () {
|
|
116
|
+
return this.list("/applications");
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
getApplication() {
|
|
120
|
+
return r(this, null, function* () {
|
|
121
|
+
return this.get("/config/tenantApplication");
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
postApplication(e) {
|
|
125
|
+
return r(this, null, function* () {
|
|
126
|
+
return this.post("/config/tenantApplication", {
|
|
127
|
+
applicationId: e
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
// 推荐问题
|
|
132
|
+
getRecommendQues() {
|
|
133
|
+
return r(this, null, function* () {
|
|
134
|
+
return this.get("/recommendQues");
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
postRecommendQues(e) {
|
|
138
|
+
return r(this, null, function* () {
|
|
139
|
+
return this.post("/recommendQues", e);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
patchRecommendQues(e, t) {
|
|
143
|
+
return r(this, null, function* () {
|
|
144
|
+
return this.patch(`/recommendQues/${e}`, t);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
delRecommendQues(e) {
|
|
148
|
+
return r(this, null, function* () {
|
|
149
|
+
return this.delete(`/recommendQues/${e}`);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
// 文件上传
|
|
153
|
+
getUploadTicket(e) {
|
|
154
|
+
return r(this, null, function* () {
|
|
155
|
+
return this.get("/upload/ticket", e);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
uploadMinioFile(e, t) {
|
|
159
|
+
return r(this, null, function* () {
|
|
160
|
+
return new Promise((o, n) => {
|
|
161
|
+
const s = new FileReader();
|
|
162
|
+
s.readAsArrayBuffer(t), s.onload = (h) => {
|
|
163
|
+
v({
|
|
164
|
+
endPoint: e.endpoints[0],
|
|
165
|
+
useSSL: e.useSSL,
|
|
166
|
+
accessKey: e.accessKey,
|
|
167
|
+
secretKey: e.secretKey
|
|
168
|
+
});
|
|
169
|
+
const m = Buffer.from(h.target.result), i = {
|
|
170
|
+
"Content-Type": "application/octet-stream"
|
|
171
|
+
};
|
|
172
|
+
C(e.bucket, e.fileKeys[0], m, i, (a) => {
|
|
173
|
+
if (a)
|
|
174
|
+
throw console.error(a), Error(a);
|
|
175
|
+
o(e.fileKeys[0]);
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
uploadFile(e, t) {
|
|
182
|
+
return r(this, null, function* () {
|
|
183
|
+
const o = {
|
|
184
|
+
files: [t.name],
|
|
185
|
+
isv: "minio",
|
|
186
|
+
knowledgeId: e
|
|
187
|
+
};
|
|
188
|
+
return this.postUploadTicket(o).then((n) => this.uploadMinioFile(n, t)).catch((n) => {
|
|
189
|
+
throw Error(n);
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
uploadFiles(e, t) {
|
|
194
|
+
return r(this, null, function* () {
|
|
195
|
+
const o = {
|
|
196
|
+
files: t.map((n) => n.name),
|
|
197
|
+
isv: "minio",
|
|
198
|
+
knowledgeId: e
|
|
199
|
+
};
|
|
200
|
+
return this.postUploadTicket(o).then((n) => Promise.all(t.map((s) => this.uploadMinioFile(n, s)))).catch((n) => {
|
|
201
|
+
throw Error(n);
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
getKnowledge(e, t) {
|
|
206
|
+
return r(this, null, function* () {
|
|
207
|
+
return this.get("/knowledge", {
|
|
208
|
+
docId: e,
|
|
209
|
+
name: t
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
//
|
|
214
|
+
getKnowledgeIdFileId(e, t) {
|
|
215
|
+
return r(this, null, function* () {
|
|
216
|
+
return this.get(`/knowledge/${e}/file/${t}`);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
updateKnowledgeIdFileId(e, t, o) {
|
|
220
|
+
return r(this, null, function* () {
|
|
221
|
+
return this.patch(`/chatSession/${e}/file/${t}`, o);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
getKnowledgeIdFileIdData(e, t, o) {
|
|
225
|
+
return r(this, null, function* () {
|
|
226
|
+
return this.get(`/knowledge/${e}/file/${t}/data/${o}`);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
// 文件详情
|
|
230
|
+
checkFileReady(e, t, o = () => !0, n = 1e4, s) {
|
|
231
|
+
return r(this, null, function* () {
|
|
232
|
+
return new Promise((h, m) => {
|
|
233
|
+
const i = () => {
|
|
234
|
+
if (!o()) {
|
|
235
|
+
clearInterval(a);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
t ? this.getSessionKnowledgeFile(e, t).then((c) => {
|
|
239
|
+
if (s == null || s(c), c.status === k.Success && (clearInterval(a), h(c)), c.status === k.Failed) {
|
|
240
|
+
clearInterval(a);
|
|
241
|
+
const d = "该文件无法读取,请上传可编辑pdf,doc,docx文档";
|
|
242
|
+
m(Error(d, {
|
|
243
|
+
cause: {
|
|
244
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
245
|
+
// @ts-ignore
|
|
246
|
+
code: -101,
|
|
247
|
+
message: d,
|
|
248
|
+
data: c
|
|
249
|
+
}
|
|
250
|
+
}));
|
|
251
|
+
}
|
|
252
|
+
}).catch((c) => {
|
|
253
|
+
clearInterval(a), m(c);
|
|
254
|
+
}) : h(null);
|
|
255
|
+
}, a = setInterval(i, n);
|
|
256
|
+
i();
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
postChat(e, t) {
|
|
261
|
+
return r(this, null, function* () {
|
|
262
|
+
return this.post("/chat", e, t);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
// IChatParam
|
|
266
|
+
postChatV2EventSource(e, t, o, n) {
|
|
267
|
+
return r(this, null, function* () {
|
|
268
|
+
var i;
|
|
269
|
+
const s = {
|
|
270
|
+
code: 0,
|
|
271
|
+
messageId: w(),
|
|
272
|
+
content: "",
|
|
273
|
+
role: $.Robot,
|
|
274
|
+
sessionId: "",
|
|
275
|
+
reference: [],
|
|
276
|
+
searchReference: [],
|
|
277
|
+
messageTime: "",
|
|
278
|
+
llmModel: "",
|
|
279
|
+
comment: {
|
|
280
|
+
isAgree: 0
|
|
281
|
+
},
|
|
282
|
+
isReplying: !1
|
|
283
|
+
}, h = yield this.getToken(), m = S(f({}, t), {
|
|
284
|
+
stream: !0
|
|
285
|
+
});
|
|
286
|
+
R(`${(i = this.axiosInstance) == null ? void 0 : i.defaults.baseURL}/chat?sessionId=${e}`, {
|
|
287
|
+
method: "POST",
|
|
288
|
+
headers: {
|
|
289
|
+
Authorization: `Bearer ${h}`,
|
|
290
|
+
"Content-Type": "application/json"
|
|
291
|
+
},
|
|
292
|
+
body: JSON.stringify(m),
|
|
293
|
+
openWhenHidden: !0,
|
|
294
|
+
signal: o,
|
|
295
|
+
onopen(a) {
|
|
296
|
+
return console.log("onopen"), a.ok && n != null && n.onopen && n.onopen(), Promise.resolve();
|
|
297
|
+
},
|
|
298
|
+
onmessage(a) {
|
|
299
|
+
if (!a.data && !a.event && !a.id && !a.retry)
|
|
300
|
+
return;
|
|
301
|
+
if (!a.data.includes('{"code": ')) {
|
|
302
|
+
let c = {};
|
|
303
|
+
try {
|
|
304
|
+
c = JSON.parse(a.data);
|
|
305
|
+
} catch (u) {
|
|
306
|
+
}
|
|
307
|
+
(c == null ? void 0 : c.mtype) === "search" ? s.searchReference.push(c) : s.content = s.content + a.data;
|
|
308
|
+
const d = {
|
|
309
|
+
content: s.content,
|
|
310
|
+
role: 1,
|
|
311
|
+
reference: s.reference,
|
|
312
|
+
searchReference: s.searchReference,
|
|
313
|
+
messageId: s.messageId,
|
|
314
|
+
sessionId: e,
|
|
315
|
+
messageTime: H(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
|
316
|
+
comment: {
|
|
317
|
+
isAgree: 0
|
|
318
|
+
},
|
|
319
|
+
isReplying: !0
|
|
320
|
+
};
|
|
321
|
+
return (n == null ? void 0 : n.onmessage) && n.onmessage(d);
|
|
322
|
+
}
|
|
323
|
+
const l = JSON.parse(a.data);
|
|
324
|
+
if (s.reference = l.data.reference, s.messageTime = l.data.messageTime, s.messageId = l.data.messageId, s.llmModel = l.data.llmModel, s.code = l.code, l.code === 200) {
|
|
325
|
+
const c = {
|
|
326
|
+
code: s.code,
|
|
327
|
+
content: s.content,
|
|
328
|
+
role: 1,
|
|
329
|
+
reference: s.reference,
|
|
330
|
+
searchReference: s.searchReference,
|
|
331
|
+
messageId: s.messageId,
|
|
332
|
+
sessionId: e,
|
|
333
|
+
messageTime: s.messageTime,
|
|
334
|
+
isReplying: !0
|
|
335
|
+
};
|
|
336
|
+
n != null && n.onmessage && n.onmessage(c);
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
onerror() {
|
|
340
|
+
n != null && n.onerror && n.onerror();
|
|
341
|
+
},
|
|
342
|
+
onclose() {
|
|
343
|
+
const a = {
|
|
344
|
+
code: s.code,
|
|
345
|
+
content: s.content,
|
|
346
|
+
role: 1,
|
|
347
|
+
reference: s.reference,
|
|
348
|
+
searchReference: s.searchReference,
|
|
349
|
+
messageId: s.messageId,
|
|
350
|
+
sessionId: e,
|
|
351
|
+
messageTime: s.messageTime,
|
|
352
|
+
comment: {
|
|
353
|
+
isAgree: 0
|
|
354
|
+
},
|
|
355
|
+
isReplying: !1
|
|
356
|
+
};
|
|
357
|
+
n != null && n.onclose && n.onclose(a);
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
postChatV3EventSource(e, t, o, n) {
|
|
363
|
+
return r(this, null, function* () {
|
|
364
|
+
var i, a;
|
|
365
|
+
const s = {
|
|
366
|
+
code: 0,
|
|
367
|
+
messageId: w(),
|
|
368
|
+
content: "",
|
|
369
|
+
role: $.Robot,
|
|
370
|
+
sessionId: "",
|
|
371
|
+
reference: [],
|
|
372
|
+
searchReference: [],
|
|
373
|
+
messageTime: "",
|
|
374
|
+
llmModel: "",
|
|
375
|
+
comment: {
|
|
376
|
+
isAgree: 0
|
|
377
|
+
},
|
|
378
|
+
isReplying: !1,
|
|
379
|
+
reasoningContent: "",
|
|
380
|
+
thinkingSecs: "",
|
|
381
|
+
thinkingStatus: ""
|
|
382
|
+
}, h = yield this.getToken(), m = S(f({}, t), {
|
|
383
|
+
stream: !0
|
|
384
|
+
});
|
|
385
|
+
R(`${(a = (i = this.axiosInstance) == null ? void 0 : i.defaults.baseURL) == null ? void 0 : a.replace("/v1", "/v3")}/chat?sessionId=${e}`, {
|
|
386
|
+
method: "POST",
|
|
387
|
+
headers: {
|
|
388
|
+
Authorization: `Bearer ${h}`,
|
|
389
|
+
"Content-Type": "application/json"
|
|
390
|
+
},
|
|
391
|
+
body: JSON.stringify(m),
|
|
392
|
+
openWhenHidden: !0,
|
|
393
|
+
signal: o,
|
|
394
|
+
onopen(l) {
|
|
395
|
+
return console.log("onopen"), l.ok && n != null && n.onopen && n.onopen(), Promise.resolve();
|
|
396
|
+
},
|
|
397
|
+
onmessage(l) {
|
|
398
|
+
if (!l.data && !l.event && !l.id && !l.retry)
|
|
399
|
+
return;
|
|
400
|
+
let c = {};
|
|
401
|
+
try {
|
|
402
|
+
c = JSON.parse(l.data);
|
|
403
|
+
} catch (p) {
|
|
404
|
+
console.log("eventData", l.data);
|
|
405
|
+
}
|
|
406
|
+
const d = c.data.type, u = c.data.payload;
|
|
407
|
+
if (s.isReplying = !0, d === "error" && (s.code = c.code, s.message = c.message), d === "search" && (s.code = c.code, s.message = c.message, s.searchReference.push(u)), d === "thinking") {
|
|
408
|
+
s.code = c.code, s.message = c.message, s.thinkingStatus = "start";
|
|
409
|
+
const y = u.choices[0];
|
|
410
|
+
s.reasoningContent = s.reasoningContent + y.delta.reasoningContent;
|
|
411
|
+
}
|
|
412
|
+
if (d === "thinkingOver") {
|
|
413
|
+
s.code = c.code, s.message = c.message, s.thinkingStatus = "end";
|
|
414
|
+
const p = u.thinkingSecs;
|
|
415
|
+
s.thinkingSecs = p;
|
|
416
|
+
}
|
|
417
|
+
if (d === "text") {
|
|
418
|
+
s.code = c.code, s.message = c.message;
|
|
419
|
+
const y = u.choices[0];
|
|
420
|
+
s.content = s.content + y.delta.content;
|
|
421
|
+
}
|
|
422
|
+
if (d === "reference" && (s.code = c.code, s.message = c.message, s.reference = u), d === "result") {
|
|
423
|
+
s.code = c.code, s.message = c.message;
|
|
424
|
+
const p = u.messageId, y = u.llmModel, A = u.messageTime;
|
|
425
|
+
s.messageId = p, s.llmModel = y, s.messageTime = A, s.sessionId = e;
|
|
426
|
+
}
|
|
427
|
+
n != null && n.onmessage && n.onmessage(s);
|
|
428
|
+
},
|
|
429
|
+
onerror() {
|
|
430
|
+
n != null && n.onerror && n.onerror();
|
|
431
|
+
},
|
|
432
|
+
onclose() {
|
|
433
|
+
const l = S(f({}, s), {
|
|
434
|
+
isReplying: !1
|
|
435
|
+
});
|
|
436
|
+
n != null && n.onclose && n.onclose(l);
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
getResourceToken(e) {
|
|
442
|
+
return r(this, null, function* () {
|
|
443
|
+
return this.get("/resourceToken", e);
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
postUploadTicket(e) {
|
|
447
|
+
return r(this, null, function* () {
|
|
448
|
+
return this.post("/upload/ticket", e);
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
//常用提示词
|
|
452
|
+
postPrompts(e) {
|
|
453
|
+
return r(this, null, function* () {
|
|
454
|
+
return this.post("/prompts", e);
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
listPrompt(e) {
|
|
458
|
+
return r(this, null, function* () {
|
|
459
|
+
return e != null && e.title && e.title.length > Q ? [] : this.get("/prompts", e);
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
getPrompt(e) {
|
|
463
|
+
return r(this, null, function* () {
|
|
464
|
+
return this.get(`/prompts/${e}`);
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
updatePrompt(e, t) {
|
|
468
|
+
return r(this, null, function* () {
|
|
469
|
+
return this.put(`/prompts/${e}`, t);
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
deletePrompt(e) {
|
|
473
|
+
return r(this, null, function* () {
|
|
474
|
+
return this.delete(`/prompts/${e}`);
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
chatSessionIdContext(e) {
|
|
478
|
+
return r(this, null, function* () {
|
|
479
|
+
return this.patch(`/chatSession/${e}/context`, {});
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
getBaseModelInfo(e) {
|
|
483
|
+
return r(this, null, function* () {
|
|
484
|
+
return this.get("/data/v1/baseModelInfo", {
|
|
485
|
+
serviceId: e
|
|
486
|
+
});
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
getApplicationId(e) {
|
|
490
|
+
return r(this, null, function* () {
|
|
491
|
+
return this.get(`/applications/${e}`);
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
getAppService() {
|
|
495
|
+
return r(this, null, function* () {
|
|
496
|
+
return this.get("/appservice");
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
export {
|
|
501
|
+
Y as AECPilotApi,
|
|
502
|
+
k as AecKnowledgeFileStatus,
|
|
503
|
+
V as IFileOrigin,
|
|
504
|
+
$ as IHistoryRole,
|
|
505
|
+
W as ISourceType,
|
|
506
|
+
X as IThinkingStatus,
|
|
507
|
+
q as IversionInfo,
|
|
508
|
+
Q as PROMPT_SEARCH_MAX_LENGTH,
|
|
509
|
+
ee as PROMPT_TITLE_MAX_LENGTH
|
|
510
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var t = /* @__PURE__ */ ((r) => (r[r.None = 0] = "None", r[r.SourceFile = 1] = "SourceFile", r[r.WebLink = 2] = "WebLink", r))(t || {}), a = /* @__PURE__ */ ((r) => (r.Unprotected = "不受著作权保护", r.ProtectAuthorize = "受著作权保护,已获得授权", r.ProtectUnauthorize = "受著作权保护,未获得授权", r))(a || {}), n = /* @__PURE__ */ ((r) => (r[r.Robot = 1] = "Robot", r[r.User = 2] = "User", r[r.System = 3] = "System", r))(n || {}), P = /* @__PURE__ */ ((r) => (r.Start = "start", r.End = "end", r))(P || {}), b = /* @__PURE__ */ ((r) => (r[r.Processing = 1] = "Processing", r[r.Success = 2] = "Success", r[r.Failed = 3] = "Failed", r))(b || {}), v = /* @__PURE__ */ ((r) => (r.AECPILOT = "aecpilot", r))(v || {});
|
|
2
|
+
export {
|
|
3
|
+
b as AecKnowledgeFileStatus,
|
|
4
|
+
v as IFileOrigin,
|
|
5
|
+
n as IHistoryRole,
|
|
6
|
+
t as ISourceType,
|
|
7
|
+
P as IThinkingStatus,
|
|
8
|
+
a as IversionInfo
|
|
9
|
+
};
|