@glodon-aiot/apis 3.2.2-beta.2 → 3.2.2-beta.4
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/dist/es/aecpilot/index.mjs +114 -102
- package/dist/es/aecpilotui/index.mjs +29 -29
- package/dist/es/agentcliui/index.mjs +29 -29
- package/dist/es/auth/index.mjs +25 -20
- package/dist/es/cvforce/index.mjs +7 -7
- package/dist/es/cvforce-datahub/index.mjs +7 -11
- package/dist/lib/index.js +3 -120
- package/dist/src/aecpilot/model.d.ts +6 -1
- package/dist/src/auth/index.d.ts +1 -0
- package/dist/src/base/index.d.ts +1 -1
- package/dist/src/cvforce/model.d.ts +1 -0
- package/dist/src/cvforce-datahub/index.d.ts +9 -9
- package/dist/src/index.d.ts +2 -1
- package/dist/src/pluginmgr/index.d.ts +1 -1
- package/package.json +8 -4
- package/dist/es/_virtual/_commonjsHelpers.mjs +0 -4
- package/dist/es/_virtual/minio-zj.mjs +0 -4
- package/dist/es/node_modules/@glodon-aiot/minio/dist/minio-zj.mjs +0 -26485
- package/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +0 -6
- package/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +0 -10
- package/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +0 -9
- package/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +0 -19
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
var P = Object.defineProperty, K = Object.defineProperties;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
2
|
+
var b = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var T = Object.getOwnPropertySymbols;
|
|
4
|
+
var E = Object.prototype.hasOwnProperty, F = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var $ = (g, e, t) => e in g ? P(g, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[e] = t, f = (g, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
F.call(e, t) &&
|
|
11
|
-
return
|
|
12
|
-
}, S = (
|
|
13
|
-
var r = (
|
|
7
|
+
E.call(e, t) && $(g, t, e[t]);
|
|
8
|
+
if (T)
|
|
9
|
+
for (var t of T(e))
|
|
10
|
+
F.call(e, t) && $(g, t, e[t]);
|
|
11
|
+
return g;
|
|
12
|
+
}, S = (g, e) => K(g, b(e));
|
|
13
|
+
var r = (g, e, t) => new Promise((o, n) => {
|
|
14
14
|
var s = (i) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
} catch (
|
|
18
|
-
n(
|
|
16
|
+
h(t.next(i));
|
|
17
|
+
} catch (c) {
|
|
18
|
+
n(c);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, m = (i) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
23
|
-
} catch (
|
|
24
|
-
n(
|
|
22
|
+
h(t.throw(i));
|
|
23
|
+
} catch (c) {
|
|
24
|
+
n(c);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, h = (i) => i.done ? o(i.value) : Promise.resolve(i.value).then(s, m);
|
|
27
|
+
h((t = t.apply(g, e)).next());
|
|
28
28
|
});
|
|
29
29
|
import O from "axios";
|
|
30
30
|
import { BaseApi as v } from "../base/index.mjs";
|
|
31
|
-
import {
|
|
31
|
+
import { initMinio as C, putObjectBuffer as H } from "@glodon-aiot/minio";
|
|
32
32
|
import { IHistoryRole as k, AecKnowledgeFileStatus as R } from "./model.mjs";
|
|
33
|
-
import { IFileOrigin as
|
|
34
|
-
import {
|
|
35
|
-
import
|
|
36
|
-
import { PROMPT_SEARCH_MAX_LENGTH as
|
|
37
|
-
import { PROMPT_TITLE_MAX_LENGTH as
|
|
38
|
-
import A from "../
|
|
39
|
-
class
|
|
33
|
+
import { IFileOrigin as W, ISourceType as X, IThinkingStatus as q, IversionInfo as Z } from "./model.mjs";
|
|
34
|
+
import { v4 as w } from "uuid";
|
|
35
|
+
import Q from "dayjs";
|
|
36
|
+
import { PROMPT_SEARCH_MAX_LENGTH as x } from "./cosntant.mjs";
|
|
37
|
+
import { PROMPT_TITLE_MAX_LENGTH as se } from "./cosntant.mjs";
|
|
38
|
+
import { fetchEventSource as A } from "../utils/fetchEventSource/fetch.mjs";
|
|
39
|
+
class z extends v {
|
|
40
40
|
constructor(e, t, o) {
|
|
41
41
|
super(e != null ? e : O.create(), o), this.axiosInstance = e, this.getToken = t;
|
|
42
42
|
}
|
|
@@ -159,19 +159,19 @@ class J extends v {
|
|
|
159
159
|
return r(this, null, function* () {
|
|
160
160
|
return new Promise((o, n) => {
|
|
161
161
|
const s = new FileReader();
|
|
162
|
-
s.readAsArrayBuffer(t), s.onload = (
|
|
163
|
-
|
|
162
|
+
s.readAsArrayBuffer(t), s.onload = (m) => {
|
|
163
|
+
C({
|
|
164
164
|
endPoint: e.endpoints[0],
|
|
165
165
|
useSSL: e.useSSL,
|
|
166
166
|
accessKey: e.accessKey,
|
|
167
167
|
secretKey: e.secretKey
|
|
168
168
|
});
|
|
169
|
-
const
|
|
169
|
+
const h = new Uint8Array(m.target.result), i = {
|
|
170
170
|
"Content-Type": "application/octet-stream"
|
|
171
171
|
};
|
|
172
|
-
|
|
173
|
-
if (
|
|
174
|
-
throw console.error(
|
|
172
|
+
H(e.bucket, e.fileKeys[0], h, i, (c) => {
|
|
173
|
+
if (c)
|
|
174
|
+
throw console.error(c), Error(c);
|
|
175
175
|
o(e.fileKeys[0]);
|
|
176
176
|
});
|
|
177
177
|
};
|
|
@@ -229,30 +229,30 @@ class J extends v {
|
|
|
229
229
|
// 文件详情
|
|
230
230
|
checkFileReady(e, t, o = () => !0, n = 1e4, s) {
|
|
231
231
|
return r(this, null, function* () {
|
|
232
|
-
return new Promise((
|
|
232
|
+
return new Promise((m, h) => {
|
|
233
233
|
const i = () => {
|
|
234
234
|
if (!o()) {
|
|
235
|
-
clearInterval(
|
|
235
|
+
clearInterval(c);
|
|
236
236
|
return;
|
|
237
237
|
}
|
|
238
|
-
t ? this.getSessionKnowledgeFile(e, t).then((
|
|
239
|
-
if (s == null || s(
|
|
240
|
-
clearInterval(
|
|
241
|
-
const
|
|
242
|
-
|
|
238
|
+
t ? this.getSessionKnowledgeFile(e, t).then((a) => {
|
|
239
|
+
if (s == null || s(a), a.status === R.Success && (clearInterval(c), m(a)), a.status === R.Failed) {
|
|
240
|
+
clearInterval(c);
|
|
241
|
+
const l = "该文件无法读取,请上传可编辑pdf,doc,docx文档";
|
|
242
|
+
h(Error(l, {
|
|
243
243
|
cause: {
|
|
244
244
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
245
245
|
// @ts-ignore
|
|
246
246
|
code: -101,
|
|
247
|
-
message:
|
|
248
|
-
data:
|
|
247
|
+
message: l,
|
|
248
|
+
data: a
|
|
249
249
|
}
|
|
250
250
|
}));
|
|
251
251
|
}
|
|
252
|
-
}).catch((
|
|
253
|
-
clearInterval(
|
|
254
|
-
}) :
|
|
255
|
-
},
|
|
252
|
+
}).catch((a) => {
|
|
253
|
+
clearInterval(c), h(a);
|
|
254
|
+
}) : m(null);
|
|
255
|
+
}, c = setInterval(i, n);
|
|
256
256
|
i();
|
|
257
257
|
});
|
|
258
258
|
});
|
|
@@ -268,7 +268,7 @@ class J extends v {
|
|
|
268
268
|
var i;
|
|
269
269
|
const s = {
|
|
270
270
|
code: 0,
|
|
271
|
-
messageId:
|
|
271
|
+
messageId: w(),
|
|
272
272
|
content: "",
|
|
273
273
|
role: k.Robot,
|
|
274
274
|
sessionId: "",
|
|
@@ -280,49 +280,49 @@ class J extends v {
|
|
|
280
280
|
isAgree: 0
|
|
281
281
|
},
|
|
282
282
|
isReplying: !1
|
|
283
|
-
},
|
|
283
|
+
}, m = yield this.getToken(), h = S(f({}, t), {
|
|
284
284
|
stream: !0
|
|
285
285
|
});
|
|
286
|
-
|
|
286
|
+
A(`${(i = this.axiosInstance) == null ? void 0 : i.defaults.baseURL}/chat?sessionId=${e}`, {
|
|
287
287
|
method: "POST",
|
|
288
288
|
headers: {
|
|
289
|
-
Authorization: `Bearer ${
|
|
289
|
+
Authorization: `Bearer ${m}`,
|
|
290
290
|
"Content-Type": "application/json"
|
|
291
291
|
},
|
|
292
|
-
body: JSON.stringify(
|
|
292
|
+
body: JSON.stringify(h),
|
|
293
293
|
openWhenHidden: !0,
|
|
294
294
|
signal: o,
|
|
295
|
-
onopen(
|
|
296
|
-
return
|
|
295
|
+
onopen(c) {
|
|
296
|
+
return c.ok && n != null && n.onopen && n.onopen(), Promise.resolve();
|
|
297
297
|
},
|
|
298
|
-
onmessage(
|
|
299
|
-
if (!
|
|
298
|
+
onmessage(c) {
|
|
299
|
+
if (!c.data && !c.event && !c.id && !c.retry)
|
|
300
300
|
return;
|
|
301
|
-
if (!
|
|
302
|
-
let
|
|
301
|
+
if (!c.data.includes('{"code": ')) {
|
|
302
|
+
let a = {};
|
|
303
303
|
try {
|
|
304
|
-
|
|
304
|
+
a = JSON.parse(c.data);
|
|
305
305
|
} catch (u) {
|
|
306
306
|
}
|
|
307
|
-
(
|
|
308
|
-
const
|
|
307
|
+
(a == null ? void 0 : a.mtype) === "search" ? s.searchReference.push(a) : s.content = s.content + c.data;
|
|
308
|
+
const l = {
|
|
309
309
|
content: s.content,
|
|
310
310
|
role: 1,
|
|
311
311
|
reference: s.reference,
|
|
312
312
|
searchReference: s.searchReference,
|
|
313
313
|
messageId: s.messageId,
|
|
314
314
|
sessionId: e,
|
|
315
|
-
messageTime:
|
|
315
|
+
messageTime: Q(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
|
316
316
|
comment: {
|
|
317
317
|
isAgree: 0
|
|
318
318
|
},
|
|
319
319
|
isReplying: !0
|
|
320
320
|
};
|
|
321
|
-
return (n == null ? void 0 : n.onmessage) && n.onmessage(
|
|
321
|
+
return (n == null ? void 0 : n.onmessage) && n.onmessage(l);
|
|
322
322
|
}
|
|
323
|
-
const
|
|
324
|
-
if (s.reference =
|
|
325
|
-
const
|
|
323
|
+
const d = JSON.parse(c.data);
|
|
324
|
+
if (s.reference = d.data.reference, s.messageTime = d.data.messageTime, s.messageId = d.data.messageId, s.llmModel = d.data.llmModel, s.code = d.code, d.code === 200) {
|
|
325
|
+
const a = {
|
|
326
326
|
code: s.code,
|
|
327
327
|
content: s.content,
|
|
328
328
|
role: 1,
|
|
@@ -333,14 +333,14 @@ class J extends v {
|
|
|
333
333
|
messageTime: s.messageTime,
|
|
334
334
|
isReplying: !0
|
|
335
335
|
};
|
|
336
|
-
n != null && n.onmessage && n.onmessage(
|
|
336
|
+
n != null && n.onmessage && n.onmessage(a);
|
|
337
337
|
}
|
|
338
338
|
},
|
|
339
339
|
onerror() {
|
|
340
340
|
n != null && n.onerror && n.onerror();
|
|
341
341
|
},
|
|
342
342
|
onclose() {
|
|
343
|
-
const
|
|
343
|
+
const c = {
|
|
344
344
|
code: s.code,
|
|
345
345
|
content: s.content,
|
|
346
346
|
role: 1,
|
|
@@ -354,17 +354,17 @@ class J extends v {
|
|
|
354
354
|
},
|
|
355
355
|
isReplying: !1
|
|
356
356
|
};
|
|
357
|
-
n != null && n.onclose && n.onclose(
|
|
357
|
+
n != null && n.onclose && n.onclose(c);
|
|
358
358
|
}
|
|
359
359
|
});
|
|
360
360
|
});
|
|
361
361
|
}
|
|
362
362
|
postChatV3EventSource(e, t, o, n) {
|
|
363
363
|
return r(this, null, function* () {
|
|
364
|
-
var i,
|
|
364
|
+
var i, c;
|
|
365
365
|
const s = {
|
|
366
366
|
code: 0,
|
|
367
|
-
messageId:
|
|
367
|
+
messageId: w(),
|
|
368
368
|
content: "",
|
|
369
369
|
role: k.Robot,
|
|
370
370
|
sessionId: "",
|
|
@@ -378,49 +378,61 @@ class J extends v {
|
|
|
378
378
|
isReplying: !1,
|
|
379
379
|
reasoningContent: "",
|
|
380
380
|
thinkingSecs: "",
|
|
381
|
-
thinkingStatus: ""
|
|
382
|
-
|
|
381
|
+
thinkingStatus: "",
|
|
382
|
+
searchingStatus: ""
|
|
383
|
+
}, m = yield this.getToken(), h = S(f({}, t), {
|
|
383
384
|
stream: !0
|
|
384
385
|
});
|
|
385
|
-
|
|
386
|
+
A(`${(c = (i = this.axiosInstance) == null ? void 0 : i.defaults.baseURL) == null ? void 0 : c.replace("/v1", "/v3")}/chat?sessionId=${e}`, {
|
|
386
387
|
method: "POST",
|
|
387
388
|
headers: {
|
|
388
|
-
Authorization: `Bearer ${
|
|
389
|
+
Authorization: `Bearer ${m}`,
|
|
389
390
|
"Content-Type": "application/json"
|
|
390
391
|
},
|
|
391
|
-
body: JSON.stringify(
|
|
392
|
+
body: JSON.stringify(h),
|
|
392
393
|
openWhenHidden: !0,
|
|
393
394
|
signal: o,
|
|
394
|
-
onopen(
|
|
395
|
-
return
|
|
395
|
+
onopen(d) {
|
|
396
|
+
return d.ok && n != null && n.onopen && n.onopen(), Promise.resolve();
|
|
396
397
|
},
|
|
397
|
-
onmessage(
|
|
398
|
-
if (!
|
|
398
|
+
onmessage(d) {
|
|
399
|
+
if (!d.data && !d.event && !d.id && !d.retry)
|
|
399
400
|
return;
|
|
400
|
-
let
|
|
401
|
+
let a = {};
|
|
401
402
|
try {
|
|
402
|
-
|
|
403
|
+
a = JSON.parse(d.data);
|
|
403
404
|
} catch (p) {
|
|
404
|
-
console.log("eventData",
|
|
405
|
+
console.log("eventData", d.data);
|
|
405
406
|
}
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
|
|
407
|
+
const l = a.data.type, u = a.data.payload;
|
|
408
|
+
s.isReplying = !0, l === "error" && (s.code = a.code, s.message = a.message);
|
|
409
|
+
const I = () => {
|
|
410
|
+
if (!s.searchingStatus) {
|
|
411
|
+
s.searchingStatus = "start";
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
if (s.searchingStatus === "start") {
|
|
415
|
+
s.searchingStatus = "end";
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
if (l === "beforeSearch" && I(), l === "search" && (s.code = a.code, s.message = a.message, s.searchReference.push(u)), l === "thinking") {
|
|
420
|
+
I(), s.code = a.code, s.message = a.message, s.thinkingStatus = "start";
|
|
409
421
|
const y = u.choices[0];
|
|
410
422
|
s.reasoningContent = s.reasoningContent + y.delta.reasoningContent;
|
|
411
423
|
}
|
|
412
|
-
if (
|
|
413
|
-
s.code =
|
|
424
|
+
if (l === "thinkingOver") {
|
|
425
|
+
s.code = a.code, s.message = a.message, s.thinkingStatus = "end";
|
|
414
426
|
const p = u.thinkingSecs;
|
|
415
427
|
s.thinkingSecs = p;
|
|
416
428
|
}
|
|
417
|
-
if (
|
|
418
|
-
s.code =
|
|
429
|
+
if (l === "text") {
|
|
430
|
+
I(), s.code = a.code, s.message = a.message;
|
|
419
431
|
const y = u.choices[0];
|
|
420
432
|
s.content = s.content + y.delta.content;
|
|
421
433
|
}
|
|
422
|
-
if (
|
|
423
|
-
s.code =
|
|
434
|
+
if (l === "reference" && (s.code = a.code, s.message = a.message, s.reference = u), l === "result") {
|
|
435
|
+
s.code = a.code, s.message = a.message;
|
|
424
436
|
const p = u.messageId, y = u.llmModel, M = u.messageTime;
|
|
425
437
|
s.messageId = p, s.llmModel = y, s.messageTime = M, s.sessionId = e;
|
|
426
438
|
}
|
|
@@ -430,10 +442,10 @@ class J extends v {
|
|
|
430
442
|
n != null && n.onerror && n.onerror();
|
|
431
443
|
},
|
|
432
444
|
onclose() {
|
|
433
|
-
const
|
|
445
|
+
const d = S(f({}, s), {
|
|
434
446
|
isReplying: !1
|
|
435
447
|
});
|
|
436
|
-
n != null && n.onclose && n.onclose(
|
|
448
|
+
n != null && n.onclose && n.onclose(d);
|
|
437
449
|
}
|
|
438
450
|
});
|
|
439
451
|
});
|
|
@@ -456,7 +468,7 @@ class J extends v {
|
|
|
456
468
|
}
|
|
457
469
|
listPrompt(e) {
|
|
458
470
|
return r(this, null, function* () {
|
|
459
|
-
return e != null && e.title && e.title.length >
|
|
471
|
+
return e != null && e.title && e.title.length > x ? [] : this.get("/prompts", e);
|
|
460
472
|
});
|
|
461
473
|
}
|
|
462
474
|
getPrompt(e) {
|
|
@@ -498,13 +510,13 @@ class J extends v {
|
|
|
498
510
|
}
|
|
499
511
|
}
|
|
500
512
|
export {
|
|
501
|
-
|
|
513
|
+
z as AECPilotApi,
|
|
502
514
|
R as AecKnowledgeFileStatus,
|
|
503
|
-
|
|
515
|
+
W as IFileOrigin,
|
|
504
516
|
k as IHistoryRole,
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
517
|
+
X as ISourceType,
|
|
518
|
+
q as IThinkingStatus,
|
|
519
|
+
Z as IversionInfo,
|
|
520
|
+
x as PROMPT_SEARCH_MAX_LENGTH,
|
|
521
|
+
se as PROMPT_TITLE_MAX_LENGTH
|
|
510
522
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var v = Object.defineProperty, S = Object.defineProperties;
|
|
2
|
+
var A = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var h = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var f = (p, e, t) => e in p ?
|
|
4
|
+
var w = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var f = (p, e, t) => e in p ? v(p, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[e] = t, y = (p, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
|
|
7
|
+
w.call(e, t) && f(p, t, e[t]);
|
|
8
8
|
if (h)
|
|
9
9
|
for (var t of h(e))
|
|
10
|
-
|
|
10
|
+
R.call(e, t) && f(p, t, e[t]);
|
|
11
11
|
return p;
|
|
12
|
-
}, $ = (p, e) =>
|
|
12
|
+
}, $ = (p, e) => S(p, A(e));
|
|
13
13
|
var s = (p, e, t) => new Promise((a, i) => {
|
|
14
14
|
var r = (d) => {
|
|
15
15
|
try {
|
|
@@ -26,19 +26,19 @@ var s = (p, e, t) => new Promise((a, i) => {
|
|
|
26
26
|
}, m = (d) => d.done ? a(d.value) : Promise.resolve(d.value).then(r, n);
|
|
27
27
|
m((t = t.apply(p, e)).next());
|
|
28
28
|
});
|
|
29
|
-
import
|
|
30
|
-
import { BaseApi as
|
|
31
|
-
import {
|
|
32
|
-
import { IHistoryRole as
|
|
33
|
-
import {
|
|
34
|
-
import
|
|
35
|
-
import { Buffer as
|
|
36
|
-
import { PROMPT_SEARCH_MAX_LENGTH as
|
|
37
|
-
import E from "../
|
|
38
|
-
globalThis.Buffer =
|
|
39
|
-
class
|
|
29
|
+
import K from "axios";
|
|
30
|
+
import { BaseApi as T } from "../base/index.mjs";
|
|
31
|
+
import { initMinio as b, putObjectBuffer as P } from "@glodon-aiot/minio";
|
|
32
|
+
import { IHistoryRole as k, AecKnowledgeFileStatus as I } from "../aecpilot/model.mjs";
|
|
33
|
+
import { v4 as M } from "uuid";
|
|
34
|
+
import F from "dayjs";
|
|
35
|
+
import { Buffer as B } from "buffer";
|
|
36
|
+
import { PROMPT_SEARCH_MAX_LENGTH as H } from "../aecpilot/cosntant.mjs";
|
|
37
|
+
import { fetchEventSource as E } from "../utils/fetchEventSource/fetch.mjs";
|
|
38
|
+
globalThis.Buffer = B;
|
|
39
|
+
class J extends T {
|
|
40
40
|
constructor(e, t, a) {
|
|
41
|
-
super(e != null ? e :
|
|
41
|
+
super(e != null ? e : K.create(), a), this.axiosInstance = e, this.getToken = t;
|
|
42
42
|
}
|
|
43
43
|
// async postChatV2EventSource1(
|
|
44
44
|
// applicationId: string,
|
|
@@ -349,7 +349,7 @@ class Y extends b {
|
|
|
349
349
|
}
|
|
350
350
|
listPrompt(e, t) {
|
|
351
351
|
return s(this, null, function* () {
|
|
352
|
-
return t != null && t.title && t.title.length >
|
|
352
|
+
return t != null && t.title && t.title.length > H ? [] : this.get(`/data/v1/application/${e}/prompts`, t);
|
|
353
353
|
});
|
|
354
354
|
}
|
|
355
355
|
getPrompt(e, t) {
|
|
@@ -416,7 +416,7 @@ class Y extends b {
|
|
|
416
416
|
return;
|
|
417
417
|
}
|
|
418
418
|
a ? this.getApplicationIdSessionKnowledgeFileId(e, t, a, {}, !0).then((c) => {
|
|
419
|
-
if (n == null || n(c), c.status ===
|
|
419
|
+
if (n == null || n(c), c.status === I.Success && (clearInterval(o), m(c)), c.status === I.Failed) {
|
|
420
420
|
clearInterval(o);
|
|
421
421
|
const g = "该文件无法读取,请上传可编辑pdf,doc,docx文档";
|
|
422
422
|
d(Error(g, {
|
|
@@ -459,7 +459,7 @@ class Y extends b {
|
|
|
459
459
|
return new Promise((a, i) => {
|
|
460
460
|
const r = new FileReader();
|
|
461
461
|
r.readAsArrayBuffer(t), r.onload = (n) => {
|
|
462
|
-
|
|
462
|
+
b({
|
|
463
463
|
endPoint: e.endpoints[0],
|
|
464
464
|
useSSL: e.useSSL,
|
|
465
465
|
accessKey: e.accessKey,
|
|
@@ -468,7 +468,7 @@ class Y extends b {
|
|
|
468
468
|
const m = Buffer.from(n.target.result), d = {
|
|
469
469
|
"Content-Type": "application/octet-stream"
|
|
470
470
|
};
|
|
471
|
-
|
|
471
|
+
P(e.bucket, e.fileKeys[0], m, d, (l) => {
|
|
472
472
|
if (l)
|
|
473
473
|
throw console.error(l), Error(l);
|
|
474
474
|
a(e.fileKeys[0]);
|
|
@@ -502,9 +502,9 @@ class Y extends b {
|
|
|
502
502
|
var l;
|
|
503
503
|
const n = {
|
|
504
504
|
code: 0,
|
|
505
|
-
messageId:
|
|
505
|
+
messageId: M(),
|
|
506
506
|
content: "",
|
|
507
|
-
role:
|
|
507
|
+
role: k.Robot,
|
|
508
508
|
sessionId: "",
|
|
509
509
|
reference: [],
|
|
510
510
|
searchReference: [],
|
|
@@ -518,7 +518,7 @@ class Y extends b {
|
|
|
518
518
|
}, m = yield this.getToken(), d = $(y({}, a), {
|
|
519
519
|
stream: !0
|
|
520
520
|
});
|
|
521
|
-
|
|
521
|
+
E(`${(l = this.axiosInstance) == null ? void 0 : l.defaults.baseURL}/chat/v2/chat?applicationId=${e}&sessionId=${t}`, {
|
|
522
522
|
method: "POST",
|
|
523
523
|
headers: {
|
|
524
524
|
Authorization: `Bearer ${m}`,
|
|
@@ -537,7 +537,7 @@ class Y extends b {
|
|
|
537
537
|
let c = {};
|
|
538
538
|
try {
|
|
539
539
|
c = JSON.parse(o.data);
|
|
540
|
-
} catch (
|
|
540
|
+
} catch (V) {
|
|
541
541
|
}
|
|
542
542
|
(c == null ? void 0 : c.mtype) === "search" ? n.searchReference.push(c) : n.content = n.content + o.data;
|
|
543
543
|
const g = {
|
|
@@ -547,7 +547,7 @@ class Y extends b {
|
|
|
547
547
|
searchReference: n.searchReference,
|
|
548
548
|
messageId: n.messageId,
|
|
549
549
|
sessionId: t,
|
|
550
|
-
messageTime:
|
|
550
|
+
messageTime: F(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
|
551
551
|
comment: {
|
|
552
552
|
isAgree: 0
|
|
553
553
|
},
|
|
@@ -603,5 +603,5 @@ class Y extends b {
|
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
605
|
export {
|
|
606
|
-
|
|
606
|
+
J as AecpilotUIApi
|
|
607
607
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var v = Object.defineProperty, S = Object.defineProperties;
|
|
2
|
+
var w = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var u = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var f = (l, e, t) => e in l ?
|
|
4
|
+
var A = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var f = (l, e, t) => e in l ? v(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t, y = (l, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
|
|
7
|
+
A.call(e, t) && f(l, t, e[t]);
|
|
8
8
|
if (u)
|
|
9
9
|
for (var t of u(e))
|
|
10
|
-
|
|
10
|
+
R.call(e, t) && f(l, t, e[t]);
|
|
11
11
|
return l;
|
|
12
|
-
}, $ = (l, e) =>
|
|
12
|
+
}, $ = (l, e) => S(l, w(e));
|
|
13
13
|
var s = (l, e, t) => new Promise((a, i) => {
|
|
14
14
|
var n = (c) => {
|
|
15
15
|
try {
|
|
@@ -26,19 +26,19 @@ var s = (l, e, t) => new Promise((a, i) => {
|
|
|
26
26
|
}, r = (c) => c.done ? a(c.value) : Promise.resolve(c.value).then(n, h);
|
|
27
27
|
r((t = t.apply(l, e)).next());
|
|
28
28
|
});
|
|
29
|
-
import
|
|
30
|
-
import { BaseApi as
|
|
31
|
-
import {
|
|
32
|
-
import { IHistoryRole as
|
|
33
|
-
import {
|
|
34
|
-
import
|
|
35
|
-
import { Buffer as
|
|
36
|
-
import { PROMPT_SEARCH_MAX_LENGTH as
|
|
37
|
-
import
|
|
38
|
-
window.Buffer =
|
|
39
|
-
class
|
|
29
|
+
import T from "axios";
|
|
30
|
+
import { BaseApi as K } from "../base/index.mjs";
|
|
31
|
+
import { initMinio as k, putObjectBuffer as P } from "@glodon-aiot/minio";
|
|
32
|
+
import { IHistoryRole as F, AecKnowledgeFileStatus as I } from "../aecpilot/model.mjs";
|
|
33
|
+
import { v4 as M } from "uuid";
|
|
34
|
+
import b from "dayjs";
|
|
35
|
+
import { Buffer as B } from "buffer";
|
|
36
|
+
import { PROMPT_SEARCH_MAX_LENGTH as E } from "../aecpilot/cosntant.mjs";
|
|
37
|
+
import { fetchEventSource as H } from "../utils/fetchEventSource/fetch.mjs";
|
|
38
|
+
window.Buffer = B;
|
|
39
|
+
class x extends K {
|
|
40
40
|
constructor(e, t, a) {
|
|
41
|
-
super(e != null ? e :
|
|
41
|
+
super(e != null ? e : T.create(), a), this.axiosInstance = e, this.getToken = t;
|
|
42
42
|
}
|
|
43
43
|
getApplicationIdSessions(e) {
|
|
44
44
|
return s(this, null, function* () {
|
|
@@ -89,9 +89,9 @@ class _ extends k {
|
|
|
89
89
|
return s(this, null, function* () {
|
|
90
90
|
const r = {
|
|
91
91
|
code: 0,
|
|
92
|
-
messageId:
|
|
92
|
+
messageId: M(),
|
|
93
93
|
content: "",
|
|
94
|
-
role:
|
|
94
|
+
role: F.Robot,
|
|
95
95
|
sessionId: "",
|
|
96
96
|
reference: [],
|
|
97
97
|
searchReference: [],
|
|
@@ -104,7 +104,7 @@ class _ extends k {
|
|
|
104
104
|
}, c = yield this.getToken(), p = $(y({}, a), {
|
|
105
105
|
stream: !0
|
|
106
106
|
});
|
|
107
|
-
|
|
107
|
+
H(`https://aiot-dev.glodon.com/api/cvforcepd/chat/v2/chat?applicationId=${e}&sessionId=${t}`, {
|
|
108
108
|
method: "POST",
|
|
109
109
|
headers: {
|
|
110
110
|
Authorization: `Bearer ${c}`,
|
|
@@ -121,7 +121,7 @@ class _ extends k {
|
|
|
121
121
|
let o = {};
|
|
122
122
|
try {
|
|
123
123
|
o = JSON.parse(d.data);
|
|
124
|
-
} catch (
|
|
124
|
+
} catch (V) {
|
|
125
125
|
}
|
|
126
126
|
(o == null ? void 0 : o.mtype) === "search" ? r.searchReference.push(o) : r.content = r.content + d.data;
|
|
127
127
|
const g = {
|
|
@@ -131,7 +131,7 @@ class _ extends k {
|
|
|
131
131
|
searchReference: r.searchReference,
|
|
132
132
|
messageId: r.messageId,
|
|
133
133
|
sessionId: t,
|
|
134
|
-
messageTime:
|
|
134
|
+
messageTime: b(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
|
135
135
|
comment: {
|
|
136
136
|
isAgree: 0
|
|
137
137
|
},
|
|
@@ -268,7 +268,7 @@ class _ extends k {
|
|
|
268
268
|
return new Promise((a, i) => {
|
|
269
269
|
const n = new FileReader();
|
|
270
270
|
n.readAsArrayBuffer(t), n.onload = (h) => {
|
|
271
|
-
|
|
271
|
+
k({
|
|
272
272
|
endPoint: e.endpoints[0],
|
|
273
273
|
useSSL: e.useSSL,
|
|
274
274
|
accessKey: e.accessKey,
|
|
@@ -277,7 +277,7 @@ class _ extends k {
|
|
|
277
277
|
const r = Buffer.from(h.target.result), c = {
|
|
278
278
|
"Content-Type": "application/octet-stream"
|
|
279
279
|
};
|
|
280
|
-
|
|
280
|
+
P(e.bucket, e.fileKeys[0], r, c, (p) => {
|
|
281
281
|
if (p)
|
|
282
282
|
throw console.error(p), Error(p);
|
|
283
283
|
a(e.fileKeys[0]);
|
|
@@ -299,7 +299,7 @@ class _ extends k {
|
|
|
299
299
|
}
|
|
300
300
|
listPrompt(e, t) {
|
|
301
301
|
return s(this, null, function* () {
|
|
302
|
-
return t != null && t.title && t.title.length >
|
|
302
|
+
return t != null && t.title && t.title.length > E ? [] : this.get(`/data/v1/application/${e}/prompts`, t);
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
305
|
getPrompt(e, t) {
|
|
@@ -336,7 +336,7 @@ class _ extends k {
|
|
|
336
336
|
return;
|
|
337
337
|
}
|
|
338
338
|
a ? this.getApplicationIdSessionKnowledgeFileId(e, t, a, {}, !0).then((o) => {
|
|
339
|
-
if (h == null || h(o), o.status ===
|
|
339
|
+
if (h == null || h(o), o.status === I.Success && (clearInterval(d), r(o)), o.status === I.Failed) {
|
|
340
340
|
clearInterval(d);
|
|
341
341
|
const g = "该文件无法读取,请上传可编辑pdf,doc,docx文档";
|
|
342
342
|
c(Error(g, {
|
|
@@ -414,5 +414,5 @@ class _ extends k {
|
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
416
|
export {
|
|
417
|
-
|
|
417
|
+
x as AgentClientUIApi
|
|
418
418
|
};
|