@glodon-aiot/apis 3.26.0-alpha.23 → 3.26.0-alpha.26
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/bot-client/index.mjs +79 -76
- package/dist/lib/index.js +2 -2
- package/dist/src/aecpilot/model.d.ts +15 -0
- package/dist/src/agentcliui/index.d.ts +72 -0
- package/dist/src/agentcliui/model.d.ts +39 -0
- package/dist/src/bot-client/model.d.ts +11 -3
- package/dist/src/cvforce/model.d.ts +29 -0
- package/package.json +1 -1
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
var v = Object.defineProperty, S = Object.defineProperties;
|
|
2
2
|
var w = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var g = Object.getOwnPropertySymbols;
|
|
4
4
|
var A = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
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
|
-
A.call(e, t) &&
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
R.call(e, t) &&
|
|
7
|
+
A.call(e, t) && f(l, t, e[t]);
|
|
8
|
+
if (g)
|
|
9
|
+
for (var t of g(e))
|
|
10
|
+
R.call(e, t) && f(l, t, e[t]);
|
|
11
11
|
return l;
|
|
12
|
-
},
|
|
13
|
-
var s = (l, e, t) => new Promise((a,
|
|
12
|
+
}, $ = (l, e) => S(l, w(e));
|
|
13
|
+
var s = (l, e, t) => new Promise((a, i) => {
|
|
14
14
|
var n = (c) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
16
|
+
r(t.next(c));
|
|
17
17
|
} catch (p) {
|
|
18
|
-
|
|
18
|
+
i(p);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, h = (c) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
22
|
+
r(t.throw(c));
|
|
23
23
|
} catch (p) {
|
|
24
|
-
|
|
24
|
+
i(p);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, r = (c) => c.done ? a(c.value) : Promise.resolve(c.value).then(n, h);
|
|
27
|
+
r((t = t.apply(l, e)).next());
|
|
28
28
|
});
|
|
29
29
|
import T from "axios";
|
|
30
|
-
import { BaseApi as
|
|
31
|
-
import { initMinio as
|
|
32
|
-
import { IHistoryRole as
|
|
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
33
|
import { v4 as M } from "uuid";
|
|
34
34
|
import b from "dayjs";
|
|
35
35
|
import { Buffer as B } from "buffer";
|
|
36
36
|
import { PROMPT_SEARCH_MAX_LENGTH as E } from "../aecpilot/cosntant.mjs";
|
|
37
37
|
import { fetchEventSource as H } from "../utils/fetchEventSource/fetch.mjs";
|
|
38
38
|
window.Buffer = B;
|
|
39
|
-
class
|
|
39
|
+
class x extends K {
|
|
40
40
|
constructor(e, t, a) {
|
|
41
41
|
super(e != null ? e : T.create(), a), this.axiosInstance = e, this.getToken = t;
|
|
42
42
|
}
|
|
@@ -85,13 +85,13 @@ class G extends k {
|
|
|
85
85
|
return this.get(`/data/v1/application/${e}/chatHistory/${t}`);
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
postChatV2EventSource(e, t, a,
|
|
88
|
+
postChatV2EventSource(e, t, a, i, n, h) {
|
|
89
89
|
return s(this, null, function* () {
|
|
90
|
-
const
|
|
90
|
+
const r = {
|
|
91
91
|
code: 0,
|
|
92
92
|
messageId: M(),
|
|
93
93
|
content: "",
|
|
94
|
-
role:
|
|
94
|
+
role: F.Robot,
|
|
95
95
|
sessionId: "",
|
|
96
96
|
reference: [],
|
|
97
97
|
searchReference: [],
|
|
@@ -101,7 +101,7 @@ class G extends k {
|
|
|
101
101
|
isAgree: 0
|
|
102
102
|
},
|
|
103
103
|
isReplying: !1
|
|
104
|
-
}, c = yield this.getToken(), p =
|
|
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}`, {
|
|
@@ -112,7 +112,7 @@ class G extends k {
|
|
|
112
112
|
},
|
|
113
113
|
body: JSON.stringify(p),
|
|
114
114
|
openWhenHidden: !0,
|
|
115
|
-
signal:
|
|
115
|
+
signal: i,
|
|
116
116
|
onopen(d) {
|
|
117
117
|
return d.ok && n != null && n.onopen && n.onopen(), Promise.resolve();
|
|
118
118
|
},
|
|
@@ -123,13 +123,13 @@ class G extends k {
|
|
|
123
123
|
o = JSON.parse(d.data);
|
|
124
124
|
} catch (V) {
|
|
125
125
|
}
|
|
126
|
-
(o == null ? void 0 : o.mtype) === "search" ?
|
|
127
|
-
const
|
|
128
|
-
content:
|
|
126
|
+
(o == null ? void 0 : o.mtype) === "search" ? r.searchReference.push(o) : r.content = r.content + d.data;
|
|
127
|
+
const u = {
|
|
128
|
+
content: r.content,
|
|
129
129
|
role: 1,
|
|
130
|
-
reference:
|
|
131
|
-
searchReference:
|
|
132
|
-
messageId:
|
|
130
|
+
reference: r.reference,
|
|
131
|
+
searchReference: r.searchReference,
|
|
132
|
+
messageId: r.messageId,
|
|
133
133
|
sessionId: t,
|
|
134
134
|
messageTime: b(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
|
135
135
|
comment: {
|
|
@@ -137,24 +137,24 @@ class G extends k {
|
|
|
137
137
|
},
|
|
138
138
|
isReplying: !0
|
|
139
139
|
};
|
|
140
|
-
return (n == null ? void 0 : n.onmessage) && n.onmessage(
|
|
140
|
+
return (n == null ? void 0 : n.onmessage) && n.onmessage(u);
|
|
141
141
|
}
|
|
142
142
|
const m = JSON.parse(d.data);
|
|
143
|
-
if (
|
|
143
|
+
if (r.reference = m.data.reference, r.searchReference = m.data.searchReference, r.messageTime = m.data.messageTime, r.messageId = m.data.messageId, r.llmModel = m.data.llmModel, r.content = m.data.content, r.code = m.code, m.code === 200) {
|
|
144
144
|
const o = {
|
|
145
|
-
code:
|
|
146
|
-
content:
|
|
145
|
+
code: r.code,
|
|
146
|
+
content: r.content,
|
|
147
147
|
role: 1,
|
|
148
|
-
reference:
|
|
149
|
-
searchReference:
|
|
150
|
-
messageId:
|
|
148
|
+
reference: r.reference,
|
|
149
|
+
searchReference: r.searchReference,
|
|
150
|
+
messageId: r.messageId,
|
|
151
151
|
sessionId: t,
|
|
152
|
-
messageTime:
|
|
152
|
+
messageTime: r.messageTime,
|
|
153
153
|
isReplying: !0
|
|
154
154
|
};
|
|
155
155
|
n != null && n.onmessage && n.onmessage(o);
|
|
156
156
|
} else
|
|
157
|
-
return
|
|
157
|
+
return h && h({
|
|
158
158
|
code: m.code,
|
|
159
159
|
message: m.message
|
|
160
160
|
});
|
|
@@ -164,14 +164,14 @@ class G extends k {
|
|
|
164
164
|
},
|
|
165
165
|
onclose() {
|
|
166
166
|
const d = {
|
|
167
|
-
code:
|
|
168
|
-
content:
|
|
167
|
+
code: r.code,
|
|
168
|
+
content: r.content,
|
|
169
169
|
role: 1,
|
|
170
|
-
reference:
|
|
171
|
-
searchReference:
|
|
172
|
-
messageId:
|
|
170
|
+
reference: r.reference,
|
|
171
|
+
searchReference: r.searchReference,
|
|
172
|
+
messageId: r.messageId,
|
|
173
173
|
sessionId: t,
|
|
174
|
-
messageTime:
|
|
174
|
+
messageTime: r.messageTime,
|
|
175
175
|
comment: {
|
|
176
176
|
isAgree: 0
|
|
177
177
|
},
|
|
@@ -221,24 +221,24 @@ class G extends k {
|
|
|
221
221
|
uploadFiles(e, t) {
|
|
222
222
|
return s(this, null, function* () {
|
|
223
223
|
const a = {
|
|
224
|
-
files: t.map((
|
|
224
|
+
files: t.map((i) => i.name),
|
|
225
225
|
isv: "minio",
|
|
226
226
|
knowledgeId: e
|
|
227
227
|
};
|
|
228
|
-
return this.postTicket(a).then((
|
|
229
|
-
throw Error(
|
|
228
|
+
return this.postTicket(a).then((i) => Promise.all(t.map((n) => this.uploadMinioFile(i.minio, n)))).catch((i) => {
|
|
229
|
+
throw Error(i);
|
|
230
230
|
});
|
|
231
231
|
});
|
|
232
232
|
}
|
|
233
233
|
postFile(e, t, a) {
|
|
234
234
|
return s(this, null, function* () {
|
|
235
|
-
const
|
|
235
|
+
const i = {
|
|
236
236
|
files: [t.name],
|
|
237
237
|
isv: "minio",
|
|
238
238
|
knowledgeId: e,
|
|
239
239
|
type: a
|
|
240
240
|
};
|
|
241
|
-
return this.postTicket(
|
|
241
|
+
return this.postTicket(i).then((n) => this.uploadMinioFile(n.minio, t)).catch((n) => {
|
|
242
242
|
throw Error(n);
|
|
243
243
|
});
|
|
244
244
|
});
|
|
@@ -255,8 +255,8 @@ class G extends k {
|
|
|
255
255
|
isv: "minio",
|
|
256
256
|
knowledgeId: e
|
|
257
257
|
};
|
|
258
|
-
return this.postTicket(a).then((
|
|
259
|
-
throw Error(
|
|
258
|
+
return this.postTicket(a).then((i) => this.uploadMinioFile(i.minio, t)).catch((i) => {
|
|
259
|
+
throw Error(i);
|
|
260
260
|
});
|
|
261
261
|
});
|
|
262
262
|
}
|
|
@@ -265,16 +265,19 @@ class G extends k {
|
|
|
265
265
|
// }
|
|
266
266
|
uploadMinioFile(e, t) {
|
|
267
267
|
return s(this, null, function* () {
|
|
268
|
-
return new Promise((a,
|
|
268
|
+
return new Promise((a, i) => {
|
|
269
269
|
const n = new FileReader();
|
|
270
|
-
n.readAsArrayBuffer(t), n.onload = (
|
|
271
|
-
|
|
272
|
-
endPoint: e.endpoints[0]
|
|
273
|
-
|
|
274
|
-
|
|
270
|
+
n.readAsArrayBuffer(t), n.onload = (h) => {
|
|
271
|
+
k({
|
|
272
|
+
endPoint: e.endpoints[0],
|
|
273
|
+
useSSL: e.useSSL,
|
|
274
|
+
accessKey: e.accessKey,
|
|
275
|
+
secretKey: e.secretKey
|
|
276
|
+
});
|
|
277
|
+
const r = Buffer.from(h.target.result), c = {
|
|
275
278
|
"Content-Type": "application/octet-stream"
|
|
276
279
|
};
|
|
277
|
-
|
|
280
|
+
P(e.bucket, e.fileKeys[0], r, c, (p) => {
|
|
278
281
|
if (p)
|
|
279
282
|
throw console.error(p), Error(p);
|
|
280
283
|
a(e.fileKeys[0]);
|
|
@@ -324,39 +327,39 @@ class G extends k {
|
|
|
324
327
|
return this.get(`/data/v1/application/${e}/session/${t}/file`, a);
|
|
325
328
|
});
|
|
326
329
|
}
|
|
327
|
-
checkFileReady(e, t, a,
|
|
330
|
+
checkFileReady(e, t, a, i = () => !0, n = 1e4, h) {
|
|
328
331
|
return s(this, null, function* () {
|
|
329
|
-
return new Promise((
|
|
332
|
+
return new Promise((r, c) => {
|
|
330
333
|
const p = () => {
|
|
331
|
-
if (!
|
|
334
|
+
if (!i()) {
|
|
332
335
|
clearInterval(d);
|
|
333
336
|
return;
|
|
334
337
|
}
|
|
335
338
|
a ? this.getApplicationIdSessionKnowledgeFileId(e, t, a, {}, !0).then((o) => {
|
|
336
|
-
if (
|
|
339
|
+
if (h == null || h(o), o.status === I.Success && (clearInterval(d), r(o)), o.status === I.Failed) {
|
|
337
340
|
clearInterval(d);
|
|
338
|
-
const
|
|
339
|
-
c(Error(
|
|
341
|
+
const u = "该文件无法读取,请上传可编辑pdf,doc,docx文档";
|
|
342
|
+
c(Error(u, {
|
|
340
343
|
cause: {
|
|
341
344
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
342
345
|
// @ts-ignore
|
|
343
346
|
code: -101,
|
|
344
|
-
message:
|
|
347
|
+
message: u,
|
|
345
348
|
data: o
|
|
346
349
|
}
|
|
347
350
|
}));
|
|
348
351
|
}
|
|
349
352
|
}).catch((o) => {
|
|
350
353
|
clearInterval(d), c(o);
|
|
351
|
-
}) :
|
|
354
|
+
}) : r(null);
|
|
352
355
|
}, d = setInterval(p, n);
|
|
353
356
|
p();
|
|
354
357
|
});
|
|
355
358
|
});
|
|
356
359
|
}
|
|
357
|
-
getApplicationIdSessionKnowledgeFileId(e, t, a,
|
|
360
|
+
getApplicationIdSessionKnowledgeFileId(e, t, a, i, n) {
|
|
358
361
|
return s(this, null, function* () {
|
|
359
|
-
return this.get(`/data/v1/application/${e}/session/${t}/file/${a}`,
|
|
362
|
+
return this.get(`/data/v1/application/${e}/session/${t}/file/${a}`, i, n);
|
|
360
363
|
});
|
|
361
364
|
}
|
|
362
365
|
delApplicationIdSessionKnowledgeFileId(e, t, a) {
|
|
@@ -364,9 +367,9 @@ class G extends k {
|
|
|
364
367
|
return this.delete(`/data/v1/application/${e}/session/${t}/file/${a}`);
|
|
365
368
|
});
|
|
366
369
|
}
|
|
367
|
-
postApplicationIdSessionKnowledgeSessionFile(e, t, a,
|
|
370
|
+
postApplicationIdSessionKnowledgeSessionFile(e, t, a, i, n) {
|
|
368
371
|
return s(this, null, function* () {
|
|
369
|
-
return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`, a,
|
|
372
|
+
return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`, a, i, n);
|
|
370
373
|
});
|
|
371
374
|
}
|
|
372
375
|
delApplicationIdSessionKnowledgeFile(e, t, a) {
|
|
@@ -379,9 +382,9 @@ class G extends k {
|
|
|
379
382
|
return this.delete(`/data/v1/chatSession/${e}/file`, t);
|
|
380
383
|
});
|
|
381
384
|
}
|
|
382
|
-
patchApplicationIdKnowledgeIdFileId(e, t, a,
|
|
385
|
+
patchApplicationIdKnowledgeIdFileId(e, t, a, i) {
|
|
383
386
|
return s(this, null, function* () {
|
|
384
|
-
return this.patch(`/data/v1/application/${e}/session/${t}/file/${a}`,
|
|
387
|
+
return this.patch(`/data/v1/application/${e}/session/${t}/file/${a}`, i);
|
|
385
388
|
});
|
|
386
389
|
}
|
|
387
390
|
getApplicationIdSessionIdPromptVariables(e, t) {
|
|
@@ -394,9 +397,9 @@ class G extends k {
|
|
|
394
397
|
return this.get(`/data/v1/application/${e}/promptVariables`, t);
|
|
395
398
|
});
|
|
396
399
|
}
|
|
397
|
-
patchApplicationIdSessionpromptVariablesId(e, t, a,
|
|
400
|
+
patchApplicationIdSessionpromptVariablesId(e, t, a, i) {
|
|
398
401
|
return s(this, null, function* () {
|
|
399
|
-
return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${a}`,
|
|
402
|
+
return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${a}`, i);
|
|
400
403
|
});
|
|
401
404
|
}
|
|
402
405
|
updateSession(e, t, a) {
|
|
@@ -421,5 +424,5 @@ class G extends k {
|
|
|
421
424
|
}
|
|
422
425
|
}
|
|
423
426
|
export {
|
|
424
|
-
|
|
427
|
+
x as BotClientApi
|
|
425
428
|
};
|
package/dist/lib/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var we=Object.defineProperty,Ie=Object.defineProperties;var ke=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var N=(n,e,t)=>e in n?we(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,y=(n,e)=>{for(var t in e||(e={}))O.call(e,t)&&N(n,t,e[t]);if(M)for(var t of M(e))H.call(e,t)&&N(n,t,e[t]);return n},w=(n,e)=>Ie(n,ke(e));var _=(n,e)=>{var t={};for(var r in n)O.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&M)for(var r of M(n))e.indexOf(r)<0&&H.call(n,r)&&(t[r]=n[r]);return t};var s=(n,e,t)=>new Promise((r,a)=>{var i=h=>{try{c(t.next(h))}catch(p){a(p)}},o=h=>{try{c(t.throw(h))}catch(p){a(p)}},c=h=>h.done?r(h.value):Promise.resolve(h.value).then(i,o);c((t=t.apply(n,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("axios"),A=require("@glodon-aiot/minio"),F=require("uuid"),L=require("dayjs"),x=require("buffer");class m{constructor(e,t){this.axios=e,this.errorHandler=t}get http(){return this.axios}get(e,t,r){return s(this,null,function*(){const a=this.axios.get(e,{params:t});return this.handleResponse(a,r)})}listPaged(e,t){return s(this,null,function*(){const r=this.axios.get(e,{params:t});return this.handleResponse(r)})}list(e,t){return s(this,null,function*(){const r=this.axios.get(e,{params:t});return this.handleResponse(r)})}delete(e,t){return s(this,null,function*(){const r=this.axios.delete(e,{params:t});return this.handleResponse(r)})}post(e,t,r,a){return s(this,null,function*(){const i=this.axios.post(e,t,y({params:r},a));return this.handleResponse(i)})}postForm(e,t,r){return s(this,null,function*(){const a=this.axios.post(e,t,{params:r,headers:{"Content-Type":"multipart/form-data"}});return this.handleResponse(a)})}patch(e,t,r){return s(this,null,function*(){const a=this.axios.patch(e,t,{params:r});return this.handleResponse(a)})}put(e,t){return s(this,null,function*(){const r=this.axios.put(e,t);return this.handleResponse(r)})}upload(e,t,r){return s(this,null,function*(){const a=this.axios.post(e,t,y({},r));return this.handleResponse(a)})}getNonStandard(e,t){return s(this,null,function*(){const r=this.axios.get(e,t);try{const a=yield r;if(a.status===200)return a}catch(a){throw this.handleError(a)}})}postNonStandard(e,t,r,a){return s(this,null,function*(){var c,h;const o=yield this.axios.post(e,t,y({params:r},a));if(o.status===200)if((c=o.data)!=null&&c.code)(h=this.errorHandler)!=null&&h.onAppStatusError&&this.errorHandler.onAppStatusError(o.data.code,o.data.message);else return o.data})}handleResponse(e,t){return s(this,null,function*(){try{const r=yield e;return this.handleAppError(r.data,t).data}catch(r){throw this.handleError(r)}})}handleAppError(e,t){var r;if(e.code<200||e.code>=300)throw(r=this.errorHandler)!=null&&r.onAppStatusError?this.errorHandler.onAppStatusError(e.code,z(e.code,e.message),t):console.error("未处理应用错误:",e),{isAxiosError:!1,message:e.message};return e}handleError(e){var t,r;return e.response?(t=this.errorHandler)!=null&&t.onHttpStatusError&&(console.log("HTTP 错误",this.errorHandler),this.errorHandler.onHttpStatusError(e.response.status,"",e.response)):e.request?(console.log(e.request),(r=this.errorHandler)!=null&&r.onNetworkError&&this.errorHandler.onNetworkError()):console.error("axios request config error:",e),new Error(e.message)}}const J=n=>n>=10002&&n<=10012,z=(n,e)=>J(n)?"数据操作错误":e||"未知接口错误";class Ae extends m{constructor(e,t){super(e!=null?e:v.create(),t)}getLoginUrl(){return s(this,null,function*(){return this.get("/openAddress")})}getToken(e,t){return s(this,null,function*(){return this.get(e,t)})}getAIoTTokenByGTeamToken(e){return s(this,null,function*(){return this.post("/validate/glodonCloud",e).then(t=>t.accessToken)})}postRefreshToken(e,t,r,a="3600",i){return s(this,null,function*(){return this.post("/refresh-token",{oldToken:e,tenant:t,orgId:r,expired:a,product:i})})}logout(){return s(this,null,function*(){return this.post("/logout",{})})}}class Te extends m{constructor(e,t){super(e!=null?e:v.create(),t)}getTenant(e){return s(this,null,function*(){return this.get(`/tenant/${e}`)})}listProduct(){return s(this,null,function*(){return this.list("/products")})}listProvinces(){return s(this,null,function*(){return this.list("/regions/provinces")})}listCities(e){return s(this,null,function*(){return this.list(`/regions/provinces/${e}/city`)})}listCounties(e,t){return s(this,null,function*(){return this.list(`/regions/provinces/${e}/city/${t}/county`)})}getOrgList(e){return s(this,null,function*(){return this.list("/org",e)})}getUserIdOrgList(e,t){return s(this,null,function*(){return this.list(`/users/${e}/org`,t)})}delOrg(e){return s(this,null,function*(){return this.delete(`/org/${e}`)})}postOrg(e){return s(this,null,function*(){return this.post("/org",e)})}patchOrg(e,t){return s(this,null,function*(){return this.patch(`/org/${e}`,t)})}getUsers(e,t){return s(this,null,function*(){return this.list(`/tenant/${e}/users`,t)})}delUser(e,t){return s(this,null,function*(){return this.delete(`/tenant/${e}/users/${t}`)})}postUser(e,t){return s(this,null,function*(){return this.post(`/tenant/${e}/users`,t)})}patchUser(e,t,r){return s(this,null,function*(){return this.patch(`tenant/${e}/users/${t}`,r)})}getTenantList(){return s(this,null,function*(){return this.get("/tenant")})}getUserIdRoles(e){return s(this,null,function*(){return this.get(`/users/${e}/role`)})}getProductCodeRole(e){return s(this,null,function*(){return this.get(`/products/${e}/role`)})}postUserRole(e,t){return s(this,null,function*(){return this.post(`/users/${e}/role`,t)})}patchUserRole(e,t,r){return s(this,null,function*(){return this.patch(`/users/${e}/role/${t}`,r)})}deleteUserRole(e,t){return s(this,null,function*(){return this.delete(`/users/${e}/role/${t}`)})}getUsersIdProductCodeMenu(e,t,r="web",a){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/menu?groupCode=${r}`,{level:a})})}getUserInfo(e){return s(this,null,function*(){return this.get(`/users/${e}`)})}uipermission(e,t,r="web"){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/uipermission?groupCode=${r}`)})}getAppInfo(e){return s(this,null,function*(){return this.get(`/products/${e}/apps`)})}getTenantUserInfo(e,t){return s(this,null,function*(){return this.get(`/tenant/${e}/users/${t}`)})}uploadFile(e){return s(this,null,function*(){return this.upload("/upload",e)})}getUserIdProductCodeOrg(e,t){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/org`)})}getOrg(e){return s(this,null,function*(){return this.get(`/org/${e}`)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}putAppInfo(e,t){return s(this,null,function*(){return this.put(`/products/${e}/apps`,t)})}getTenantKeySecret(e){return s(this,null,function*(){return this.get(`/tenant/${e}/key`)})}resetTenantKeySecret(e){return s(this,null,function*(){return this.post(`/tenant/${e}/resetSecret`,void 0)})}getProductsCode(e){return s(this,null,function*(){return this.get(`/products/${e}`)})}getLongtermTokens(e){return s(this,null,function*(){return this.listPaged("/longterm-token",e)})}postLongtermToken(e){return s(this,null,function*(){return this.post("/longterm-token",e)})}deleteLongtermToken(e){return s(this,null,function*(){return this.delete(`/longterm-token/${e}`)})}getMyUserInfo(){return s(this,null,function*(){return this.get("/user/me")})}}var Y=(n=>(n.Collecting="采集中",n.CollectionTimeout="超时",n.CollectionFinish="完成",n.WaitUpload="等待上传",n.Uploading="上传中",n.UploadFinish="上传完成",n.UploadFailed="上传失败",n.WaitMerge="等待合成",n.CreateMergeTaskFailed="创建合成任务失败",n.Merging="合成中",n.MergeFailed="合成失败",n.MergeFinish="合成成功",n))(Y||{}),j=(n=>(n.Collecting="采集中",n.CollectionTimeout="超时",n.CollectionFinish="完成",n.WaitUpload="等待上传",n.Uploading="上传中",n.UploadFinish="上传完成",n.UploadFailed="上传失败",n.WaitMerge="等待合成",n.CreateMergeTaskFailed="创建合成任务失败",n.Merging="合成中",n.MergeFailed="合成失败",n.MergeFinish="合成成功",n))(j||{});class be extends m{constructor(e,t){super(e!=null?e:v.create(),t)}static parseApiToken(e){const t=window.atob(e.split(".")[1]);return JSON.parse(t)}static loadApiToken(e,t,r){return s(this,null,function*(){return fetch(`${e}${t}/viewtoken/${r}/create_apitoken`,{method:"POST"}).then(a=>{if(a.status!==200)throw console.error(a),Error(JSON.stringify(a));return a.json()}).then(a=>{if(a.code!==200)throw Error(JSON.stringify(a));return a.data.apiToken})})}listRecord(e){return s(this,null,function*(){return this.listPaged("/spacetwins",e)})}postRecord(e){return s(this,null,function*(){return this.post("/spacetwins",e)})}getRecordOverview(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}`)})}getRecordViewtoken(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}/viewtoken`)})}listScene(e){return s(this,null,function*(){return this.list(`/spacetwins/${e}/scenes`)})}getScenesByTimestamp(e,t){return s(this,null,function*(){return this.list(`/spacetwins/${e}/scenes_timestamp`,{timestamp:t})})}recomputeTrack(e,t){return s(this,null,function*(){return this.patch(`/spacetwins/${e}/track`,{points:t})})}updateRecordUploadStatus(e,t){return s(this,null,function*(){return this.post(`/spacetwins/${e}/update_upload_status`,t)})}getApiToken(e){return s(this,null,function*(){return this.post(`/viewtoken/${e}/create_apitoken`,{})})}getSpacetwins(e){return s(this,null,function*(){return this.listPaged("/spacetwins",e)})}postSpacetwins(e){return s(this,null,function*(){return this.post("/spacetwins",e)})}updateInspection(e,t){return s(this,null,function*(){return this.patch(`/patrolInspection/${e}`,t)})}getSpacetwinsIdViewtoken(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}/viewtoken`)})}postSpacetwinsIdUpdateUploadStatus(e,t){return s(this,null,function*(){return this.post(`/spacetwins/${e}/update_upload_status`,t)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/upload/ticket",e)})}getDownloadUrl(e){return s(this,null,function*(){return this.get(`/download/url?isv=${e.isv}&key=${e.key}`)})}listTrack(e,t){return s(this,null,function*(){return this.list(`/spacetwins/${e}/track`,{type:t})})}}class Pe extends m{constructor(e,t){super(e!=null?e:v.create(),t)}listPlugin(e){return s(this,null,function*(){return this.list("/plugins",e)})}postPlugin(e){return s(this,null,function*(){return this.post("/plugins",e)})}getPlugin(e){return s(this,null,function*(){return this.get(`/plugins/${e}`)})}updatePlugin(e,t){return s(this,null,function*(){return this.patch(`/plugins/${e}`,t)})}listPluginData(e,t){return s(this,null,function*(){return this.list(`/plugins/${e}/datas`,t)})}postPluginData(e,t){return s(this,null,function*(){return this.post(`/plugins/${e}/datas`,t)})}getPluginData(e,t){return s(this,null,function*(){return this.get(`/plugins/${e}/datas/${t}`).then(r=>w(y({},r),{arguments:JSON.parse(r.arguments)}))})}updatePluginData(e,t,r){return s(this,null,function*(){return this.patch(`/plugins/${e}/datas/${t}`,r)})}deletePluginData(e,t){return s(this,null,function*(){return this.delete(`/plugins/${e}/datas/${t}`)})}}var G=(n=>(n[n.None=0]="None",n[n.SourceFile=1]="SourceFile",n[n.WebLink=2]="WebLink",n))(G||{}),X=(n=>(n.Unprotected="不受著作权保护",n.ProtectAuthorize="受著作权保护,已获得授权",n.ProtectUnauthorize="受著作权保护,未获得授权",n))(X||{}),b=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(b||{}),Z=(n=>(n.Start="start",n.End="end",n))(Z||{}),T=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(T||{}),ee=(n=>(n.AECPILOT="aecpilot",n))(ee||{});function Re(n,e){return s(this,null,function*(){const t=n.getReader();let r;for(;!(r=yield t.read()).done;)e(r.value)})}function Me(n){let e,t,r,a=!1,i;return function(c){e===void 0?(e=c,t=0,r=-1,i=!1):e=Ve(e,c);const h=e.length;let p=0;for(;t<h;){a&&(e[t]===10&&(p=++t),a=!1);let u=-1;for(;t<h&&u===-1;++t)switch(e[t]){case 58:r===-1&&(r=t-p);break;case 13:a=!1,t+4<h&&e[t+1]===10&&e[t+2]!==13&&e[t-1]!==10&&e[t-2]!==13&&(i=!0);case 10:u=t;break}if(u===-1)break;n(e.subarray(p,u),r,i),p=t,r=-1,i=!1}p===h?e=void 0:p!==0&&(e=e.subarray(p),t-=p)}}function Fe(n,e,t){let r=Q();const a=new TextDecoder;return function(o,c,h){if(o.length===0)t==null||t(r),r=Q();else if(c>0){const p=a.decode(o.subarray(0,c)),u=c+(o[c+1]===32?2:1);let l=a.decode(o.subarray(u));switch(h&&(l+=`
|
|
1
|
+
"use strict";var we=Object.defineProperty,Ie=Object.defineProperties;var ke=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var N=(n,e,t)=>e in n?we(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,y=(n,e)=>{for(var t in e||(e={}))O.call(e,t)&&N(n,t,e[t]);if(M)for(var t of M(e))H.call(e,t)&&N(n,t,e[t]);return n},w=(n,e)=>Ie(n,ke(e));var _=(n,e)=>{var t={};for(var r in n)O.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&M)for(var r of M(n))e.indexOf(r)<0&&H.call(n,r)&&(t[r]=n[r]);return t};var s=(n,e,t)=>new Promise((r,a)=>{var i=h=>{try{c(t.next(h))}catch(p){a(p)}},o=h=>{try{c(t.throw(h))}catch(p){a(p)}},c=h=>h.done?r(h.value):Promise.resolve(h.value).then(i,o);c((t=t.apply(n,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("axios"),A=require("@glodon-aiot/minio"),F=require("uuid"),C=require("dayjs"),x=require("buffer");class m{constructor(e,t){this.axios=e,this.errorHandler=t}get http(){return this.axios}get(e,t,r){return s(this,null,function*(){const a=this.axios.get(e,{params:t});return this.handleResponse(a,r)})}listPaged(e,t){return s(this,null,function*(){const r=this.axios.get(e,{params:t});return this.handleResponse(r)})}list(e,t){return s(this,null,function*(){const r=this.axios.get(e,{params:t});return this.handleResponse(r)})}delete(e,t){return s(this,null,function*(){const r=this.axios.delete(e,{params:t});return this.handleResponse(r)})}post(e,t,r,a){return s(this,null,function*(){const i=this.axios.post(e,t,y({params:r},a));return this.handleResponse(i)})}postForm(e,t,r){return s(this,null,function*(){const a=this.axios.post(e,t,{params:r,headers:{"Content-Type":"multipart/form-data"}});return this.handleResponse(a)})}patch(e,t,r){return s(this,null,function*(){const a=this.axios.patch(e,t,{params:r});return this.handleResponse(a)})}put(e,t){return s(this,null,function*(){const r=this.axios.put(e,t);return this.handleResponse(r)})}upload(e,t,r){return s(this,null,function*(){const a=this.axios.post(e,t,y({},r));return this.handleResponse(a)})}getNonStandard(e,t){return s(this,null,function*(){const r=this.axios.get(e,t);try{const a=yield r;if(a.status===200)return a}catch(a){throw this.handleError(a)}})}postNonStandard(e,t,r,a){return s(this,null,function*(){var c,h;const o=yield this.axios.post(e,t,y({params:r},a));if(o.status===200)if((c=o.data)!=null&&c.code)(h=this.errorHandler)!=null&&h.onAppStatusError&&this.errorHandler.onAppStatusError(o.data.code,o.data.message);else return o.data})}handleResponse(e,t){return s(this,null,function*(){try{const r=yield e;return this.handleAppError(r.data,t).data}catch(r){throw this.handleError(r)}})}handleAppError(e,t){var r;if(e.code<200||e.code>=300)throw(r=this.errorHandler)!=null&&r.onAppStatusError?this.errorHandler.onAppStatusError(e.code,z(e.code,e.message),t):console.error("未处理应用错误:",e),{isAxiosError:!1,message:e.message};return e}handleError(e){var t,r;return e.response?(t=this.errorHandler)!=null&&t.onHttpStatusError&&(console.log("HTTP 错误",this.errorHandler),this.errorHandler.onHttpStatusError(e.response.status,"",e.response)):e.request?(console.log(e.request),(r=this.errorHandler)!=null&&r.onNetworkError&&this.errorHandler.onNetworkError()):console.error("axios request config error:",e),new Error(e.message)}}const J=n=>n>=10002&&n<=10012,z=(n,e)=>J(n)?"数据操作错误":e||"未知接口错误";class Ae extends m{constructor(e,t){super(e!=null?e:v.create(),t)}getLoginUrl(){return s(this,null,function*(){return this.get("/openAddress")})}getToken(e,t){return s(this,null,function*(){return this.get(e,t)})}getAIoTTokenByGTeamToken(e){return s(this,null,function*(){return this.post("/validate/glodonCloud",e).then(t=>t.accessToken)})}postRefreshToken(e,t,r,a="3600",i){return s(this,null,function*(){return this.post("/refresh-token",{oldToken:e,tenant:t,orgId:r,expired:a,product:i})})}logout(){return s(this,null,function*(){return this.post("/logout",{})})}}class Te extends m{constructor(e,t){super(e!=null?e:v.create(),t)}getTenant(e){return s(this,null,function*(){return this.get(`/tenant/${e}`)})}listProduct(){return s(this,null,function*(){return this.list("/products")})}listProvinces(){return s(this,null,function*(){return this.list("/regions/provinces")})}listCities(e){return s(this,null,function*(){return this.list(`/regions/provinces/${e}/city`)})}listCounties(e,t){return s(this,null,function*(){return this.list(`/regions/provinces/${e}/city/${t}/county`)})}getOrgList(e){return s(this,null,function*(){return this.list("/org",e)})}getUserIdOrgList(e,t){return s(this,null,function*(){return this.list(`/users/${e}/org`,t)})}delOrg(e){return s(this,null,function*(){return this.delete(`/org/${e}`)})}postOrg(e){return s(this,null,function*(){return this.post("/org",e)})}patchOrg(e,t){return s(this,null,function*(){return this.patch(`/org/${e}`,t)})}getUsers(e,t){return s(this,null,function*(){return this.list(`/tenant/${e}/users`,t)})}delUser(e,t){return s(this,null,function*(){return this.delete(`/tenant/${e}/users/${t}`)})}postUser(e,t){return s(this,null,function*(){return this.post(`/tenant/${e}/users`,t)})}patchUser(e,t,r){return s(this,null,function*(){return this.patch(`tenant/${e}/users/${t}`,r)})}getTenantList(){return s(this,null,function*(){return this.get("/tenant")})}getUserIdRoles(e){return s(this,null,function*(){return this.get(`/users/${e}/role`)})}getProductCodeRole(e){return s(this,null,function*(){return this.get(`/products/${e}/role`)})}postUserRole(e,t){return s(this,null,function*(){return this.post(`/users/${e}/role`,t)})}patchUserRole(e,t,r){return s(this,null,function*(){return this.patch(`/users/${e}/role/${t}`,r)})}deleteUserRole(e,t){return s(this,null,function*(){return this.delete(`/users/${e}/role/${t}`)})}getUsersIdProductCodeMenu(e,t,r="web",a){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/menu?groupCode=${r}`,{level:a})})}getUserInfo(e){return s(this,null,function*(){return this.get(`/users/${e}`)})}uipermission(e,t,r="web"){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/uipermission?groupCode=${r}`)})}getAppInfo(e){return s(this,null,function*(){return this.get(`/products/${e}/apps`)})}getTenantUserInfo(e,t){return s(this,null,function*(){return this.get(`/tenant/${e}/users/${t}`)})}uploadFile(e){return s(this,null,function*(){return this.upload("/upload",e)})}getUserIdProductCodeOrg(e,t){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/org`)})}getOrg(e){return s(this,null,function*(){return this.get(`/org/${e}`)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}putAppInfo(e,t){return s(this,null,function*(){return this.put(`/products/${e}/apps`,t)})}getTenantKeySecret(e){return s(this,null,function*(){return this.get(`/tenant/${e}/key`)})}resetTenantKeySecret(e){return s(this,null,function*(){return this.post(`/tenant/${e}/resetSecret`,void 0)})}getProductsCode(e){return s(this,null,function*(){return this.get(`/products/${e}`)})}getLongtermTokens(e){return s(this,null,function*(){return this.listPaged("/longterm-token",e)})}postLongtermToken(e){return s(this,null,function*(){return this.post("/longterm-token",e)})}deleteLongtermToken(e){return s(this,null,function*(){return this.delete(`/longterm-token/${e}`)})}getMyUserInfo(){return s(this,null,function*(){return this.get("/user/me")})}}var Y=(n=>(n.Collecting="采集中",n.CollectionTimeout="超时",n.CollectionFinish="完成",n.WaitUpload="等待上传",n.Uploading="上传中",n.UploadFinish="上传完成",n.UploadFailed="上传失败",n.WaitMerge="等待合成",n.CreateMergeTaskFailed="创建合成任务失败",n.Merging="合成中",n.MergeFailed="合成失败",n.MergeFinish="合成成功",n))(Y||{}),j=(n=>(n.Collecting="采集中",n.CollectionTimeout="超时",n.CollectionFinish="完成",n.WaitUpload="等待上传",n.Uploading="上传中",n.UploadFinish="上传完成",n.UploadFailed="上传失败",n.WaitMerge="等待合成",n.CreateMergeTaskFailed="创建合成任务失败",n.Merging="合成中",n.MergeFailed="合成失败",n.MergeFinish="合成成功",n))(j||{});class be extends m{constructor(e,t){super(e!=null?e:v.create(),t)}static parseApiToken(e){const t=window.atob(e.split(".")[1]);return JSON.parse(t)}static loadApiToken(e,t,r){return s(this,null,function*(){return fetch(`${e}${t}/viewtoken/${r}/create_apitoken`,{method:"POST"}).then(a=>{if(a.status!==200)throw console.error(a),Error(JSON.stringify(a));return a.json()}).then(a=>{if(a.code!==200)throw Error(JSON.stringify(a));return a.data.apiToken})})}listRecord(e){return s(this,null,function*(){return this.listPaged("/spacetwins",e)})}postRecord(e){return s(this,null,function*(){return this.post("/spacetwins",e)})}getRecordOverview(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}`)})}getRecordViewtoken(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}/viewtoken`)})}listScene(e){return s(this,null,function*(){return this.list(`/spacetwins/${e}/scenes`)})}getScenesByTimestamp(e,t){return s(this,null,function*(){return this.list(`/spacetwins/${e}/scenes_timestamp`,{timestamp:t})})}recomputeTrack(e,t){return s(this,null,function*(){return this.patch(`/spacetwins/${e}/track`,{points:t})})}updateRecordUploadStatus(e,t){return s(this,null,function*(){return this.post(`/spacetwins/${e}/update_upload_status`,t)})}getApiToken(e){return s(this,null,function*(){return this.post(`/viewtoken/${e}/create_apitoken`,{})})}getSpacetwins(e){return s(this,null,function*(){return this.listPaged("/spacetwins",e)})}postSpacetwins(e){return s(this,null,function*(){return this.post("/spacetwins",e)})}updateInspection(e,t){return s(this,null,function*(){return this.patch(`/patrolInspection/${e}`,t)})}getSpacetwinsIdViewtoken(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}/viewtoken`)})}postSpacetwinsIdUpdateUploadStatus(e,t){return s(this,null,function*(){return this.post(`/spacetwins/${e}/update_upload_status`,t)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/upload/ticket",e)})}getDownloadUrl(e){return s(this,null,function*(){return this.get(`/download/url?isv=${e.isv}&key=${e.key}`)})}listTrack(e,t){return s(this,null,function*(){return this.list(`/spacetwins/${e}/track`,{type:t})})}}class Pe extends m{constructor(e,t){super(e!=null?e:v.create(),t)}listPlugin(e){return s(this,null,function*(){return this.list("/plugins",e)})}postPlugin(e){return s(this,null,function*(){return this.post("/plugins",e)})}getPlugin(e){return s(this,null,function*(){return this.get(`/plugins/${e}`)})}updatePlugin(e,t){return s(this,null,function*(){return this.patch(`/plugins/${e}`,t)})}listPluginData(e,t){return s(this,null,function*(){return this.list(`/plugins/${e}/datas`,t)})}postPluginData(e,t){return s(this,null,function*(){return this.post(`/plugins/${e}/datas`,t)})}getPluginData(e,t){return s(this,null,function*(){return this.get(`/plugins/${e}/datas/${t}`).then(r=>w(y({},r),{arguments:JSON.parse(r.arguments)}))})}updatePluginData(e,t,r){return s(this,null,function*(){return this.patch(`/plugins/${e}/datas/${t}`,r)})}deletePluginData(e,t){return s(this,null,function*(){return this.delete(`/plugins/${e}/datas/${t}`)})}}var G=(n=>(n[n.None=0]="None",n[n.SourceFile=1]="SourceFile",n[n.WebLink=2]="WebLink",n))(G||{}),X=(n=>(n.Unprotected="不受著作权保护",n.ProtectAuthorize="受著作权保护,已获得授权",n.ProtectUnauthorize="受著作权保护,未获得授权",n))(X||{}),b=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(b||{}),Z=(n=>(n.Start="start",n.End="end",n))(Z||{}),T=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(T||{}),ee=(n=>(n.AECPILOT="aecpilot",n))(ee||{});function Re(n,e){return s(this,null,function*(){const t=n.getReader();let r;for(;!(r=yield t.read()).done;)e(r.value)})}function Me(n){let e,t,r,a=!1,i;return function(c){e===void 0?(e=c,t=0,r=-1,i=!1):e=Ve(e,c);const h=e.length;let p=0;for(;t<h;){a&&(e[t]===10&&(p=++t),a=!1);let u=-1;for(;t<h&&u===-1;++t)switch(e[t]){case 58:r===-1&&(r=t-p);break;case 13:a=!1,t+4<h&&e[t+1]===10&&e[t+2]!==13&&e[t-1]!==10&&e[t-2]!==13&&(i=!0);case 10:u=t;break}if(u===-1)break;n(e.subarray(p,u),r,i),p=t,r=-1,i=!1}p===h?e=void 0:p!==0&&(e=e.subarray(p),t-=p)}}function Fe(n,e,t){let r=Q();const a=new TextDecoder;return function(o,c,h){if(o.length===0)t==null||t(r),r=Q();else if(c>0){const p=a.decode(o.subarray(0,c)),u=c+(o[c+1]===32?2:1);let l=a.decode(o.subarray(u));switch(h&&(l+=`
|
|
2
2
|
`),p){case"data":r.data=r.data?r.data+`
|
|
3
|
-
`+l:l;break;case"event":r.event=l;break;case"id":n(r.id=l);break;case"retry":const d=parseInt(l,10);isNaN(d)||e(r.retry=d);break}}}}function Ve(n,e){const t=new Uint8Array(n.length+e.length);return t.set(n),t.set(e,n.length),t}function Q(){return{data:"",event:"",id:"",retry:void 0}}const C="text/event-stream",De=1e3,W="last-event-id";function V(n,u){var l=u,{signal:e,headers:t,onopen:r,onmessage:a,onclose:i,onerror:o,openWhenHidden:c,fetch:h}=l,p=_(l,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((d,g)=>{const S=y({},t);S.accept||(S.accept=C);let $;function I(){$.abort(),document.hidden||U()}c||document.addEventListener("visibilitychange",I);let P=De,E=0;function K(){document.removeEventListener("visibilitychange",I),window.clearTimeout(E),$.abort()}e==null||e.addEventListener("abort",()=>{K(),d()});const ve=h!=null?h:window.fetch,Se=r!=null?r:Ee;function U(){return s(this,null,function*(){var B;$=new AbortController;try{const R=yield ve(n,w(y({},p),{headers:S,signal:$.signal}));yield Se(R),yield Re(R.body,Me(Fe(k=>{k?S[W]=k:delete S[W]},k=>{P=k},a))),i==null||i(),K(),d()}catch(R){if(!$.signal.aborted)try{const k=(B=o==null?void 0:o(R))!=null?B:P;window.clearTimeout(E),E=window.setTimeout(U,k)}catch(k){K(),g(k)}}})}U()})}function Ee(n){const e=n.headers.get("content-type");if(!(e!=null&&e.startsWith(C)))throw new Error(`Expected content-type to be ${C}, Actual: ${e}`)}const D=128,Ke=20;class Ue extends m{constructor(e,t,r){super(e!=null?e:v.create(),r),this.axiosInstance=e,this.getToken=t}getSessions(){return s(this,null,function*(){return this.get("/chatSession")})}postSession(e){return s(this,null,function*(){return this.post("/chatSession",e)})}getSession(e){return s(this,null,function*(){return this.get(`/chatSession/${e}`)})}updateSession(e,t){return s(this,null,function*(){return this.patch(`/chatSession/${e}`,t)})}deleteSession(e){return s(this,null,function*(){return this.delete(`/chatSession/${e}`)})}getSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.get(`chatSession/${e}/file`,t)})}postSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.post(`chatSession/${e}/file`,t)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`chatSession/${e}/file`,t)})}getSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.get(`chatSession/${e}/file/${t}`)})}deleteSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.delete(`chatSession/${e}/file/${t}`)})}getSessionChatHistory(e,t){return s(this,null,function*(){return this.get(`/chatSession/${e}/history`,t)})}postMessage(e,t,r){return s(this,null,function*(){return this.post(`/config/tenantApplication?applicationId=${e}&sessionId=${t}`,r)})}postComments(e,t){return s(this,null,function*(){return this.post(`/chatSession/${e}/comments`,t)})}listApplications(){return s(this,null,function*(){return this.list("/applications")})}getApplication(){return s(this,null,function*(){return this.get("/config/tenantApplication")})}postApplication(e){return s(this,null,function*(){return this.post("/config/tenantApplication",{applicationId:e})})}getRecommendQues(){return s(this,null,function*(){return this.get("/recommendQues")})}postRecommendQues(e){return s(this,null,function*(){return this.post("/recommendQues",e)})}patchRecommendQues(e,t){return s(this,null,function*(){return this.patch(`/recommendQues/${e}`,t)})}delRecommendQues(e){return s(this,null,function*(){return this.delete(`/recommendQues/${e}`)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{A.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const c=new Uint8Array(o.target.result),h={"Content-Type":"application/octet-stream"};A.putObjectBuffer(e.bucket,e.fileKeys[0],c,h,p=>{if(p)throw console.error(p),Error(p);r(e.fileKeys[0])})}})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>this.uploadMinioFile(a,t)).catch(a=>{throw Error(a)})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a,i)))).catch(a=>{throw Error(a)})})}getKnowledge(e,t){return s(this,null,function*(){return this.get("/knowledge",{docId:e,name:t})})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}`)})}updateKnowledgeIdFileId(e,t,r){return s(this,null,function*(){return this.patch(`/chatSession/${e}/file/${t}`,r)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}/data/${r}`)})}checkFileReady(e,t,r=()=>!0,a=1e4,i){return s(this,null,function*(){return new Promise((o,c)=>{const h=()=>{if(!r()){clearInterval(p);return}t?this.getSessionKnowledgeFile(e,t).then(l=>{if(i==null||i(l),l.status===T.Success&&(clearInterval(p),o(l)),l.status===T.Failed){clearInterval(p);const d="该文件无法读取,请上传可编辑pdf,doc,docx文档";c(Error(d,{cause:{code:-101,message:d,data:l}}))}}).catch(l=>{clearInterval(p),c(l)}):o(null)},p=setInterval(h,a);h()})})}postChat(e,t){return s(this,null,function*(){return this.post("/chat",e,t)})}postChatV2EventSource(e,t,r,a){return s(this,null,function*(){var h;const i={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},o=yield this.getToken(),c=w(y({},t),{stream:!0});V(`${(h=this.axiosInstance)==null?void 0:h.defaults.baseURL}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(c),openWhenHidden:!0,signal:r,onopen(p){return p.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(p){if(!p.data&&!p.event&&!p.id&&!p.retry)return;if(!p.data.includes('{"code": ')){let l={};try{l=JSON.parse(p.data)}catch(g){}(l==null?void 0:l.mtype)==="search"?i.searchReference.push(l):i.content=i.content+p.data;const d={content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:L(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(a==null?void 0:a.onmessage)&&a.onmessage(d)}const u=JSON.parse(p.data);if(i.reference=u.data.reference,i.messageTime=u.data.messageTime,i.messageId=u.data.messageId,i.llmModel=u.data.llmModel,i.code=u.code,u.code===200){const l={code:i.code,content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:i.messageTime,isReplying:!0};a!=null&&a.onmessage&&a.onmessage(l)}},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const p={code:i.code,content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:i.messageTime,comment:{isAgree:0},isReplying:!1};a!=null&&a.onclose&&a.onclose(p)}})})}postChatV3EventSource(e,t,r,a){return s(this,null,function*(){var h,p;const i={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,reasoningContent:"",thinkingSecs:"",thinkingStatus:"",searchingStatus:""},o=yield this.getToken(),c=w(y({},t),{stream:!0});V(`${(p=(h=this.axiosInstance)==null?void 0:h.defaults.baseURL)==null?void 0:p.replace("/v1","/v3")}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(c),openWhenHidden:!0,signal:r,onopen(u){return u.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(u){if(!u.data&&!u.event&&!u.id&&!u.retry)return;let l={};try{l=JSON.parse(u.data)}catch($){console.log("eventData",u.data)}const d=l.data.type,g=l.data.payload;i.isReplying=!0,d==="error"&&(i.code=l.code,i.message=l.message);const S=()=>{if(!i.searchingStatus){i.searchingStatus="start";return}if(i.searchingStatus==="start"){i.searchingStatus="end";return}};if(d==="beforeSearch"&&S(),d==="search"&&(i.code=l.code,i.message=l.message,i.searchReference.push(g)),d==="thinking"){S(),i.code=l.code,i.message=l.message,i.thinkingStatus="start";const I=g.choices[0];i.reasoningContent=i.reasoningContent+I.delta.reasoningContent}if(d==="thinkingOver"){i.code=l.code,i.message=l.message,i.thinkingStatus="end";const $=g.thinkingSecs;i.thinkingSecs=$}if(d==="text"){S(),i.code=l.code,i.message=l.message;const I=g.choices[0];i.content=i.content+I.delta.content}if(d==="reference"&&(i.code=l.code,i.message=l.message,i.reference=g),d==="result"){i.code=l.code,i.message=l.message;const $=g.messageId,I=g.llmModel,P=g.messageTime;i.messageId=$,i.llmModel=I,i.messageTime=P,i.sessionId=e}a!=null&&a.onmessage&&a.onmessage(i)},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const u=w(y({},i),{isReplying:!1});a!=null&&a.onclose&&a.onclose(u)}})})}getResourceToken(e){return s(this,null,function*(){return this.get("/resourceToken",e)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/upload/ticket",e)})}postPrompts(e){return s(this,null,function*(){return this.post("/prompts",e)})}listPrompt(e){return s(this,null,function*(){return e!=null&&e.title&&e.title.length>D?[]:this.get("/prompts",e)})}getPrompt(e){return s(this,null,function*(){return this.get(`/prompts/${e}`)})}updatePrompt(e,t){return s(this,null,function*(){return this.put(`/prompts/${e}`,t)})}deletePrompt(e){return s(this,null,function*(){return this.delete(`/prompts/${e}`)})}chatSessionIdContext(e){return s(this,null,function*(){return this.patch(`/chatSession/${e}/context`,{})})}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}getApplicationId(e){return s(this,null,function*(){return this.get(`/applications/${e}`)})}getAppService(){return s(this,null,function*(){return this.get("/appservice")})}}window.Buffer=x.Buffer;class Ce extends m{constructor(e,t,r){super(e!=null?e:v.create(),r),this.axiosInstance=e,this.getToken=t}getApplicationIdSessions(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session`)})}getApplicationId(e,t){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`,t)})}postApplicationIdSession(e){return s(this,null,function*(){return this.post(`/data/v1/application/${e.applicationId}/sessions`,e)})}getApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}patchApplicationIdSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}/context`,{})})}delApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/sessions/${t}`)})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/sessions/${t}/comments`,r)})}getChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/chatHistory/${t}`)})}postChatV2EventSource(e,t,r,a,i,o){return s(this,null,function*(){const c={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},h=yield this.getToken(),p=w(y({},r),{stream:!0});V(`https://aiot-dev.glodon.com/api/cvforcepd/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${h}`,"Content-Type":"application/json"},body:JSON.stringify(p),openWhenHidden:!0,signal:a,onopen(u){return u.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(u){if(!u.data.includes('{"code": ')){let d={};try{d=JSON.parse(u.data)}catch(S){}(d==null?void 0:d.mtype)==="search"?c.searchReference.push(d):c.content=c.content+u.data;const g={content:c.content,role:1,reference:c.reference,searchReference:c.searchReference,messageId:c.messageId,sessionId:t,messageTime:L(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(i==null?void 0:i.onmessage)&&i.onmessage(g)}const l=JSON.parse(u.data);if(c.reference=l.data.reference,c.searchReference=l.data.searchReference,c.messageTime=l.data.messageTime,c.messageId=l.data.messageId,c.llmModel=l.data.llmModel,c.content=l.data.content,c.code=l.code,l.code===200){const d={code:c.code,content:c.content,role:1,reference:c.reference,searchReference:c.searchReference,messageId:c.messageId,sessionId:t,messageTime:c.messageTime,isReplying:!0};i!=null&&i.onmessage&&i.onmessage(d)}else return o&&o({code:l.code,message:l.message})},onerror(){i!=null&&i.onerror&&i.onerror()},onclose(){const u={code:c.code,content:c.content,role:1,reference:c.reference,searchReference:c.searchReference,messageId:c.messageId,sessionId:t,messageTime:c.messageTime,comment:{isAgree:0},isReplying:!1};i!=null&&i.onclose&&i.onclose(u)}})})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}/data/${r}`)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}`)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}`)})}getSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.get(`/data/v1/chatSession/${e}/file/${t}`)})}sleep(e){return s(this,null,function*(){return new Promise(t=>{setTimeout(()=>{t("")},e)})})}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.postTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a.minio,i)))).catch(a=>{throw Error(a)})})}postFile(e,t,r){return s(this,null,function*(){const a={files:[t.name],isv:"minio",knowledgeId:e,type:r};return this.postTicket(a).then(i=>this.uploadMinioFile(i.minio,t)).catch(i=>{throw Error(i)})})}postTicket(e){return s(this,null,function*(){return this.post("/data/v1/ticket",e)})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{A.initMinio(w(y({},e),{endPoint:e.endpoints[0]}));const c=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};A.putObjectBuffer(e.bucket,e.fileKeys[0],c,h,p=>{if(p)throw console.error(p),Error(p);r(e.fileKeys[0])})}})})}getRecommendQues(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/recommendQues`)})}postPrompts(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/prompts`,t)})}listPrompt(e,t){return s(this,null,function*(){return t!=null&&t.title&&t.title.length>D?[]:this.get(`/data/v1/application/${e}/prompts`,t)})}getPrompt(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/prompts/${t}`)})}updatePrompt(e,t,r){return s(this,null,function*(){return this.put(`/data/v1/application/${e}/prompts/${t}`,r)})}deletePrompt(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/prompts/${t}`)})}postGeneques(e,t){return s(this,null,function*(){return this.post("/data/v1/geneques",e,{},t)})}getApplicationIdSessionKnowledgeFiles(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file`,r)})}checkFileReady(e,t,r,a=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((c,h)=>{const p=()=>{if(!a()){clearInterval(u);return}r?this.getApplicationIdSessionKnowledgeFileId(e,t,r,{},!0).then(d=>{if(o==null||o(d),d.status===T.Success&&(clearInterval(u),c(d)),d.status===T.Failed){clearInterval(u);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:d}}))}}).catch(d=>{clearInterval(u),h(d)}):c(null)},u=setInterval(p,i);p()})})}getApplicationIdSessionKnowledgeFileId(e,t,r,a,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${r}`,a,i)})}delApplicationIdSessionKnowledgeFileId(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file/${r}`)})}postApplicationIdSessionKnowledgeSessionFile(e,t,r,a,i){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`,r,a,i)})}delApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file`,r)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`/data/v1/chatSession/${e}/file`,t)})}patchApplicationIdKnowledgeIdFileId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${r}`,a)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`)})}getApplicationIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/promptVariables`,t)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${r}`,a)})}updateSession(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}getSession(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}getSessionArtifacts(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}/artifacts`,void 0,!0)})}getSilenceDuration(){return s(this,null,function*(){return this.get("/data/v1/silenceDuration")})}}globalThis.Buffer=x.Buffer;class Le extends m{constructor(e,t,r){super(e!=null?e:v.create(),r),this.axiosInstance=e,this.getToken=t}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}postGeneques(e){return s(this,null,function*(){return this.post("/data/v1/geneques",e)})}getApplicationId(e){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`)})}getApplicationIdSessions(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessionsa`,t)})}postApplicationIdSession(e){return s(this,null,function*(){return this.post(`/data/v1/application/${e.applicationId}/sessions`,e)})}getApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}patchApplicationIdSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}delApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/sessions/${t}`)})}getApplicationIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/promptVariables`,t)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${r}`,a)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`/data/v1/chatSession/${e}/file`,t)})}getRecommendQues(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/recommendQues`)})}postRecommendQues(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/recommendQues`,t)})}delRecommendQues(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/recommendQues/${t}`)})}getChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/chatHistory/${t}`)})}postPrompts(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/prompts`,t)})}listPrompt(e,t){return s(this,null,function*(){return t!=null&&t.title&&t.title.length>D?[]:this.get(`/data/v1/application/${e}/prompts`,t)})}getPrompt(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/prompts/${t}`)})}updatePrompt(e,t,r){return s(this,null,function*(){return this.put(`/data/v1/application/${e}/prompts/${t}`,r)})}deletePrompt(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/prompts/${t}`)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}/context`,{})})}getApplicationIdSessionKnowledgeFiles(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file`,r)})}postApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/file`,r)})}postApplicationIdSessionKnowledgeSessionFile(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`,r)})}delApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file`,r)})}getApplicationIdSessionKnowledgeFileId(e,t,r,a,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${r}`,a,i)})}delApplicationIdSessionKnowledgeFileId(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file/${r}`)})}patchApplicationIdKnowledgeIdFileId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${r}`,a)})}checkFileReady(e,t,r,a=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((c,h)=>{const p=()=>{if(!a()){clearInterval(u);return}r?this.getApplicationIdSessionKnowledgeFileId(e,t,r,{},!0).then(d=>{if(o==null||o(d),d.status===T.Success&&(clearInterval(u),c(d)),d.status===T.Failed){clearInterval(u);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:d}}))}}).catch(d=>{clearInterval(u),h(d)}):c(null)},u=setInterval(p,i);p()})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}postUploadTicket(e){return s(this,null,function*(){return this.post("/data/v1/ticket",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{A.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const c=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};A.putObjectBuffer(e.bucket,e.fileKeys[0],c,h,p=>{if(p)throw console.error(p),Error(p);r(e.fileKeys[0])})}})})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/sessions/${t}/comments`,r)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}`)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}`)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}/data/${r}`)})}postChatV2EventSource(e,t,r,a,i){return s(this,null,function*(){var p;const o={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,message:""},c=yield this.getToken(),h=w(y({},r),{stream:!0});V(`${(p=this.axiosInstance)==null?void 0:p.defaults.baseURL}/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${c}`,"Content-Type":"application/json"},body:JSON.stringify(h),openWhenHidden:!0,signal:a,onopen(u){return u.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(u){if(!u.data&&!u.event&&!u.id&&!u.retry)return;if(!u.data.includes('{"code": ')){let d={};try{d=JSON.parse(u.data)}catch(S){}(d==null?void 0:d.mtype)==="search"?o.searchReference.push(d):o.content=o.content+u.data;const g={content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:L(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(i==null?void 0:i.onmessage)&&i.onmessage(g)}const l=JSON.parse(u.data);if(o.reference=l.data.reference,o.messageTime=l.data.messageTime,o.messageId=l.data.messageId,o.llmModel=l.data.llmModel,o.code=l.code,o.message=l.message,l.code===200){const d={code:o.code,content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:o.messageTime,isReplying:!0};i!=null&&i.onmessage&&i.onmessage(d)}},onerror(){i!=null&&i.onerror&&i.onerror()},onclose(){const u={code:o.code,content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:o.messageTime,comment:{isAgree:0},isReplying:!1,message:o.message};i!=null&&i.onclose&&i.onclose(u)}})})}postChat(e,t){return s(this,null,function*(){var r;return this.post(`${(r=this.axiosInstance)==null?void 0:r.defaults.baseURL}/chat/v2/chat`,e,t)})}}var te=(n=>(n[n.Dialog=0]="Dialog",n[n.TextGenerate=1]="TextGenerate",n[n.FileSummery=2]="FileSummery",n))(te||{}),se=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(se||{}),re=(n=>(n[n.Processing=1]="Processing",n[n.Done=2]="Done",n[n.Failed=3]="Failed",n))(re||{}),ne=(n=>(n[n.File=0]="File",n[n.WebLink=1]="WebLink",n))(ne||{}),ae=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(ae||{}),ie=(n=>(n.InputFile="ui.input.file",n.LLMModel="ui.llm.model",n))(ie||{}),oe=(n=>(n[n.Idle=0]="Idle",n[n.Quoted=1]="Quoted",n))(oe||{}),ce=(n=>(n[n.Basic=0]="Basic",n[n.Pro=1]="Pro",n))(ce||{}),le=(n=>(n[n.Dialog=0]="Dialog",n[n.Text=1]="Text",n[n.Agent=2]="Agent",n[n.All=3]="All",n))(le||{}),de=(n=>(n.User="instruction",n.System="settings",n))(de||{});class xe extends m{constructor(e,t){super(e!=null?e:v.create(),t)}getKnowledge(e,t){return s(this,null,function*(){return this.get("/knowledge",{docId:e,name:t})})}postKnowledge(e){return s(this,null,function*(){return this.post("/knowledge",e)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/knowledge/${e}`)})}patchKnowledgeId(e,t){return s(this,null,function*(){return this.patch(`/knowledge/${e}`,t)})}delKnowledgeId(e){return s(this,null,function*(){return this.delete(`/knowledge/${e}`)})}getKnowledgeIdFile(e){return s(this,null,function*(){return this.get(`/knowledge/${e}/file`)})}getKnowledgeIdFileList(e,t){return s(this,null,function*(){return this.listPaged(`/knowledge/${e}/file`,t)})}postKnowledgeIdFile(e,t){return s(this,null,function*(){return this.post(`/knowledge/${e}/file`,t)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}delKnowledgeIdFileFid(e,t){return s(this,null,function*(){return this.delete(`/knowledge/${e}/file/${t}`)})}patchKnowledgeIdFileFid(e,t,r){return s(this,null,function*(){return this.patch(`/knowledge/${e}/file/${t}`,r)})}listSessions(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessionsa`,t)})}postSession(e,t){return s(this,null,function*(){return this.post(`/application/${e}/sessions`,t)})}getSession(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessions/${t}`)})}getSessionArtifacts(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessions/${t}/artifacts`)})}patchSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/application/${e}/sessions/${t}`,r)})}delSessionsId(e,t){return s(this,null,function*(){return this.delete(`/application/${e}/sessions/${t}`)})}getSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.get(`/application/${e}session/${t}/file/${r}`)})}postSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}session/${t}/file`,r)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/ticket",e)})}postApplicationIdSessionFile(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}/session/${t}/sessionfile`,r)})}getApplicationIdSessionFile(e,t,r){return s(this,null,function*(){return this.get(`/application/${e}/session/${t}/file/${r}`)})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}/sessions/${t}/comments`,r)})}getChatHistorySessionId(e,t,r){return s(this,null,function*(){return this.get(`application/${e}/chatHistory/${t}`,r)})}postChatHistorySessionId(e,t){return s(this,null,function*(){return this.post(`/chatHistory/${e}`,t)})}getApplications(e){return s(this,null,function*(){return this.get("/applications",e)})}postApplication(e){return s(this,null,function*(){return this.post("/applications",e)})}getApplicationId(e,t){return s(this,null,function*(){return this.get(`/applications/${e}`,t)})}patchApplicationId(e,t){return s(this,null,function*(){return this.patch(`/applications/${e}`,t)})}delApplicationId(e){return s(this,null,function*(){return this.delete(`/applications/${e}`)})}getApplicationIdSessions(e){return s(this,null,function*(){return this.get(`/applications/${e}/session`)})}patchFileId(e,t){return s(this,null,function*(){return this.patch(`/file/${e}`,t)})}getCvforceResource(e){return s(this,null,function*(){return this.get("/cvforce/resource",e)})}postKnowledgeIdComposedFiles(e,t){return s(this,null,function*(){return this.post(`/knowledge/${e}/composedFiles`,t)})}getTokensApplicationId(e,t){return s(this,null,function*(){return this.get(`/tokens/${e}`,t)})}getTokens(e){return s(this,null,function*(){return this.get("/tokens",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{A.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const c=x.Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};A.putObjectBuffer(e.bucket,e.fileKeys[0],c,h,p=>{if(p)throw console.error(p),Error(p);r(e.fileKeys[0])})}})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.getUploadTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.getUploadTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a.minio,i)))).catch(a=>{throw Error(a)})})}getAecModels(){return s(this,null,function*(){return this.get("/aecModels")})}postTextFilter(e){return s(this,null,function*(){return this.post("/textFilter",e)})}getTenantModel(){return s(this,null,function*(){return this.get("/tenantModel")})}getPrompts(e,t){return s(this,null,function*(){return this.get(`application/${e}/promptVariables`,t)})}postPrompt(e,t){return s(this,null,function*(){return this.post(`application/${e}/promptVariables`,t)})}patchPromptId(e,t,r){return s(this,null,function*(){return this.patch(`application/${e}/promptVariables/${t}`,r)})}delPromptId(e,t){return s(this,null,function*(){return this.delete(`application/${e}/promptVariables/${t}`)})}getSessionPrompts(e){return s(this,null,function*(){return this.get(`session/${e}/promptVariables`)})}patchSessionPromptId(e,t,r){return s(this,null,function*(){return this.patch(`session/${t}/promptVariables/${e}`,r)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/application/${e}/session/${t}/promptVariables`)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/application/${e}/session/${t}/promptVariables/${r}`,a)})}getPresetApplication(e){return s(this,null,function*(){return this.get("presetApplication",e)})}postKnowledgeConfig(e){return s(this,null,function*(){return this.post("/knowledgeConfig",e)})}getKnowledgeConfig(e){return s(this,null,function*(){return this.get(`/knowledgeConfig/${e}`)})}patchKnowledgeConfig(e,t){return s(this,null,function*(){return this.patch(`/knowledgeConfig/${e}`,t)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}`)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.listPaged(`/knowledge/${e}/file/${t}/data`,r)})}postKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.post(`/knowledge/${e}/file/${t}/data`,{data:r})})}patchKnowledgeIdFileIdData(e,t,r,a){return s(this,null,function*(){return this.patch(`/knowledge/${e}/file/${t}/data/${r}`,{data:a})})}delKnowledgeIdFileIdDataDid(e,t,r){return s(this,null,function*(){return this.delete(`/knowledge/${e}/file/${t}/data/${r}`)})}getPresetKnowledge(e){return s(this,null,function*(){return this.get("/presetKnowledge",e)})}patchSessionsIdContext(e){return s(this,null,function*(){return this.patch(`/sessions/${e}/context`,{})})}postResourceToken(e){return s(this,null,function*(){return this.post("/resourceToken",e)})}getApplicationIdSession(e){return s(this,null,function*(){return this.get(`/application/${e}/session`)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/application/${e}/sessions/${t}/context`,{})})}postApplicationIdSessions(e,t){return s(this,null,function*(){return this.post(`/application/${e}/sessions`,t)})}getApplicationIdChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/application/${e}/chatHistory/${t}`)})}postApplicationIdChatHistorySessionIdComments(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}/sessions/${t}/comments`,r)})}getApplicationIdPrompts(e,t){return s(this,null,function*(){return this.get(`/application/${e}/promptVariables`,t)})}postKnowledgeSourceFile(e,t,r){return s(this,null,function*(){return this.post(`/knowledge/${e}/sourceFile/${t}`,r)})}getMetadata(e){return s(this,null,function*(){return this.get("/metadata",e)})}postGeneques(e){return s(this,null,function*(){return this.post("/geneques",e)})}getBaseModel(e){return s(this,null,function*(){return this.get("/baseModelInfo",{serviceId:e})})}}var pe=(n=>(n[n.inital=0]="inital",n[n.success=1]="success",n[n.processing=2]="processing",n[n.failed=3]="failed",n))(pe||{}),ue=(n=>(n[n.inital=0]="inital",n[n.processing=1]="processing",n[n.paused=2]="paused",n[n.failed=3]="failed",n[n.done=4]="done",n))(ue||{}),f=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Failure="FAILURE",n.Success="SUCCESS",n.Abort="ABORT",n))(f||{}),he=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Success="SUCCESS",n.Failure="FAILURE ",n))(he||{}),ge=(n=>(n[n.all=0]="all",n[n.general=1]="general",n[n.major=2]="major",n))(ge||{});function Be(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){const e=Math.random()*16|0;return(n=="x"?e:e&3|8).toString(16)})}class Ne extends m{constructor(e,t){super(e!=null?e:v.create(),t)}getDatasets(e){return s(this,null,function*(){return this.get("/datasets",e)})}postDatasets(e){return s(this,null,function*(){return this.post("/datasets",e)})}getDatasetsId(e){return s(this,null,function*(){return this.get(`/datasets/${e}`)})}delDatasetsId(e){return s(this,null,function*(){return this.delete(`/datasets/${e}`)})}patchDatasetsId(e,t){return s(this,null,function*(){return this.patch(`/datasets/${e}`,t)})}getDatasetsIdVersions(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions?pageNo=${t}&pageSize=${r}`)})}getDatasetsIdVersionsVidNextno(e){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/nextno`)})}getS3Iam(e,t){return s(this,null,function*(){return this.post("/s3/iam",{datasetId:e,publicBucket:t})})}postDatasetsIdVersions(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/versions`,t)})}patchDatasetsIdVersionsVid(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}`,r)})}getDatasetsIdVersionsVid(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}`)})}delDatasetsIdVersionsVid(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}`)})}getDatasetsIdVersionsNo(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/no`,t)})}listDatasetsIdLabels(e,t){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/labels`,t)})}getDatasetsIdVersionsVidLabelcount(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/labelcount`,r)})}getDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/samples`,r)})}updateSamples(e,t,r,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/samples`,{samples:r,confirmStatus:a})})}delDatasetsIdVersionsVidSamplesId(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/samples/${r}`)})}delDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/samples`,{sampleIds:r})})}delDatasetsIdVersionsVidLlmSamplesId(e,t,r){return s(this,null,function*(){return this.delete(`datasets/${e}/versions/${t}/llmSamples/${r}`)})}getDatasetsIdVersionsVidSsamplesSid(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/samples/${r}`).then(a=>w(y({},a),{labels:a.labels?a.labels.map(i=>w(y({},i),{uuid:i.uuid||Be()})):[]}))})}getImportInfo(){return s(this,null,function*(){return this.get("/importInfo")})}getOptionsMarkType(){return s(this,null,function*(){return this.get("/options/markType")})}getOptionsOcrMarkTmpl(){return s(this,null,function*(){return this.get("/options/ocrMarkTmpl")})}getOptionsLlmMarkTmpl(){return s(this,null,function*(){return this.get("/options/llmMarkTmpl")})}getOptionsLlmResponseSort(){return s(this,null,function*(){return this.get("/options/llmResponseSort")})}getOptionsImgproxy(){return s(this,null,function*(){return this.get("/options/imgproxy")})}getDeduplication(e,t){return s(this,null,function*(){return this.post("/files/deduplication",{md5s:e,datasetId:t})})}postDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/samples`,r)})}patchDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/samples`,r)})}listCategory(e){return s(this,null,function*(){return this.list(`/datasets/${e}/catagory`)})}postCategory(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/catagory`,{name:t})})}updateCategory(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/catagory/${t}`,{name:r})})}deleteCategory(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/catagory/${t}`)})}postDatasetIdVersionIdFilesDeduplication(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/files/deduplication`,r)})}postDatasetIdVersionIdLlmSamples(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples`,r)})}patchDatasetIdVersionIdLlmSampleId(e,t,r,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamples/${r}`,a)})}postLlmSamplesSubsection(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/subsection`,r)})}generatellmSamplesSubsection(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/subsection`,r)})}listSubsection(e,t,r,a){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection`,a)})}postSubsection(e,t,r,a){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection`,a)})}updateSubsection(e,t,r,a,i){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection/${a}`,i)})}deleteSubsection(e,t,r,a){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection/${a}`)})}llmSupervisedRecordGenerate(e){return s(this,null,function*(){return this.post("/llm/supervisedRecord/generatedata",e)})}llmSupervisedRecordAbordTask(e){return s(this,null,function*(){return this.post("/llm/supervisedRecord/abortTask",e)})}llmSupervisedRecordPauseTask(e){return s(this,null,function*(){return this.post("/llm/supervisedRecord/pauseTask",e)})}getLlmSupervisedRecord(e){return s(this,null,function*(){return this.get(`/llm/supervisedRecord/${e}`)})}getDatasetsIdVersionsIdLlmSamplesV2(e,t,r){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/versions/${t}/llmSamplesV2`,r)})}postDatasetsIdVersionsIdLlmSamplesV2(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamplesV2`,r)})}getDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/llmSamplesV2/${r}`)})}patchDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,r,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamplesV2/${r}`,a)})}delDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/llmSamplesV2/${r}`)})}getDatasetsIdVersionsIdExportLLMSamples(e,t){return s(this,null,function*(){return this.getNonStandard(`/datasets/${e}/versions/${t}/exportLLMSamples`,{responseType:"blob"})})}llmSamplesSubsectionView(e,t,r,a){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/${r}/previewSubsection`,a)})}listLabels(e,t){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/labels`,t)})}postLabels(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/labels`,t)})}patchLabel(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/labels/${t}`,r)})}deleteLabel(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/labels/${t}`)})}postUploadPicsZip(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/uploadzip`,r)})}postVlmUploadPicsZip(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/vlmuploadzip`,r)})}checkFileResult(e,t,r,a=1e3,i,o){return s(this,null,function*(){return new Promise((c,h)=>{const p=()=>{e?i==="vlm"?this.getUploadVlmPicsZipResult(e,t,r).then(l=>{const d=l[0];if(d.state===f.Started||d.state===f.Pending){const g=d.process||0;o&&o(g)}if(d.state===f.Success&&(clearInterval(u),c(d.lastTaskResult)),d.state===f.Failure){clearInterval(u);const g="该文件处理失败";h(Error(g,{cause:{code:-101,message:g,data:d.lastTaskResult}}))}d.state===f.Abort&&(clearInterval(u),c(d.lastTaskResult))}).catch(l=>{clearInterval(u),h(l)}):this.getUploadPicsZipResult(e,t,r).then(l=>{const d=l[0];if(d.state===f.Started||d.state===f.Pending){const g=d.process||0;o&&o(g)}if(d.state===f.Success&&(clearInterval(u),c(d.lastTaskResult)),d.state===f.Failure){clearInterval(u);const g="该文件处理失败";h(Error(g,{cause:{code:-101,message:g,data:d.lastTaskResult}}))}d.state===f.Abort&&(clearInterval(u),c(d.lastTaskResult))}).catch(l=>{clearInterval(u),h(l)}):c(null)},u=setInterval(p,a);p()})})}getUploadPicsZipResult(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/uploadzip`,r)})}getUploadVlmPicsZipResult(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/vlmuploadzip`,r)})}getUploadabort(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/uploadabort`,r)})}postPreLabelTask(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/prelabeltask`,r)})}getPreLabelTask(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/prelabeltask`)})}delPreLabelTask(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/prelabeltask/${r}`)})}getAllConfirmSamples(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/confirm`)})}getDataSetCopyTask(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/copyDataset`)})}postDataSetCopyTask(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/copyDataset`,r)})}deleteDatasetCopyTask(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/copyDataset`,r)})}getDatasetsIdVersionsVidConfigs(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/labels`)})}saveVisionLabelConfigs(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/labels`,r)})}postGenerateVlmKieQa(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/samples/generator/vlm_kie_qa`,r)})}getDefaultQaTemplates(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/defaultQaTemplates`)})}getDatasetVersionCompareSummary(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/compare/summary`,t)})}getDatasetVersionCompareSamples(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/compare/samples`,t)})}}class Oe extends m{constructor(e,t){super(e!=null?e:v.create(),t)}listModelServices(e){return s(this,null,function*(){return this.listPaged("/modelService",e)})}postModelService(e){return s(this,null,function*(){return this.post("/modelService",e)})}getModelServiceById(e){return s(this,null,function*(){return this.get(`/modelService/${e}`)})}patchModelServiceById(e,t){return s(this,null,function*(){return this.patch(`/modelService/${e}`,t)})}deleteModelService(e){return s(this,null,function*(){return this.delete(`/modelService/${e}`)})}getEnableModelService(e){return s(this,null,function*(){return this.get(`/modelService/${e}/enable`)})}getDisableModelService(e){return s(this,null,function*(){return this.get(`/modelService/${e}/disable`)})}getModelServiceList(e){return s(this,null,function*(){return this.get(`/modelService/${e}/list`)})}getModelServiceDelist(e){return s(this,null,function*(){return this.get(`/modelService/${e}/delist`)})}importService(e){return s(this,null,function*(){return this.post("/modelService/import",e)})}patchModelService(e,t){return s(this,null,function*(){return this.patch(`/modelService/${e}`,t)})}openModelServices(e){return s(this,null,function*(){return this.get("/openModelService",e)})}importMirronService(e){return s(this,null,function*(){return this.post("/modelService/importMirron",e)})}patchMirronService(e,t){return s(this,null,function*(){return this.patch(`/modelService/importMirron/${e}`,t)})}getServiceSignList(e){return s(this,null,function*(){return this.get("/serviceSign",e)})}}var ye=(n=>(n[n.minio=0]="minio",n[n.pvc=1]="pvc",n))(ye||{}),me=(n=>(n.common="A100",n.idcard="A104",n.bankcard="A108",n.page="A112",n.rmwatermark="A115",n.seal="A116",n.rmseal="A117",n.table="A118",n))(me||{}),$e=(n=>(n.User="user",n.Assistant="assistant",n.System="system",n))($e||{});class He extends m{constructor(e,t){super(e!=null?e:v.create(),t)}ocr(e,t){return s(this,null,function*(){if(t.modelStore===ye.pvc){const r=this.convertToBatchParams(t),a=yield this.ocrPvcBatch(e,r);return this.convertToMinioResult(a)}else return this.ocrMinio(e,t)})}convertToBatchParams(e){return{pages:[{image:e.image}]}}convertToMinioResult(e){var t;return(t=e.pages)==null?void 0:t.flatMap(r=>{var a;return((a=r.textItems)==null?void 0:a.map(i=>({box:i.bbox})))||[]})}ocrMinio(e,t){return s(this,null,function*(){return t.image&&t.image.split("base64,").length>1&&(t.image=t.image.split("base64,")[1]),this.post(`/v2/infer?serviceId=${e}`,t)})}ocrPvcBatch(e,t){return s(this,null,function*(){return this.post(`/v2/infer?serviceId=${e}`,t)})}getSleep(e){return s(this,null,function*(){return new Promise(t=>{setTimeout(()=>{t(!0)},e*1e3)})})}postChatCompletions(e){return s(this,null,function*(){return this.postNonStandard("/v1/chat/completions",e)})}detection(e,t){return s(this,null,function*(){return this.post(`/v2/infer?serviceId=${e}`,t)})}detectionLayout(e,t){return s(this,null,function*(){if("pages"in t){const r=yield this.post(`/v2/infer?serviceId=${e}`,t);return this.convertLayoutToDetection(r)}else return this.post(`/v2/infer?serviceId=${e}`,t)})}convertLayoutToDetection(e){var t,r;return{prediction:((r=(t=e.pages[0])==null?void 0:t.layout)==null?void 0:r.map(a=>({box:a.bbox,label:a.type,score:a.score})))||[]}}getBaseModel(e){return s(this,null,function*(){return this.get("/v1/baseModel",{serviceId:e})})}postEmbeddings(e){return s(this,null,function*(){return this.postNonStandard("/v1/embeddings",e)})}postFile(e,t){return s(this,null,function*(){const r=new FormData;r.append("file",e,e.name);const a=yield this.http.post("/v1/files",r,{onUploadProgress:o=>{t==null||t(o.loaded,o.total||e.size)}}),i=q(a);if(!i)throw new Error("平台文件服务请求失败");return i})}getFile(e){return s(this,null,function*(){var t;try{const r=yield this.http.get(`/v1/files/${encodeURIComponent(e)}`);return q(r,!0)}catch(r){const a=r.response;if((a==null?void 0:a.status)===404||((t=a==null?void 0:a.data)==null?void 0:t.code)===fe)return;throw new Error("平台文件服务请求失败")}})}}const fe=11012;function _e(n){return n===0||n>=200&&n<300}function q(n,e=!1){var r;const t=n.data;if(!t||typeof t.code!="number")throw new Error("平台文件服务请求失败");if(t.code===fe){if(e)return;throw new Error("文件不存在")}if(!_e(t.code)||!((r=t.data)!=null&&r.id))throw new Error(t.message||"平台文件服务请求失败");return t.data}class Qe extends m{constructor(e,t){super(e!=null?e:v.create(),t)}listTasks(e){return s(this,null,function*(){return this.get("/tasks",e)})}createTask(e){return s(this,null,function*(){return this.post("/tasks",e)})}getTask(e){return s(this,null,function*(){return this.get(`/tasks/${e}`)})}updateTask(e,t){return s(this,null,function*(){return this.patch(`/tasks/${e}`,t)})}deleteTask(e){return s(this,null,function*(){return this.delete(`/tasks/${e}`)})}listTaskFiles(e){return s(this,null,function*(){return this.get(`/tasks/${e}/files`)})}uploadTaskFile(e,t){return s(this,null,function*(){return this.post(`/tasks/${e}/files`,t)})}listWorkflowExecutions(e){return s(this,null,function*(){return this.get("/workflows/executions",e)})}getWorkflowExecution(e){return s(this,null,function*(){return this.get(`/workflows/executions/${e}`)})}startWorkflowExecution(e){return s(this,null,function*(){return this.post("/workflows/executions",e)})}updateWorkflowExecution(e,t){return s(this,null,function*(){return this.patch(`/workflows/executions/${e}`,t)})}cancelWorkflowExecution(e){return s(this,null,function*(){return this.post(`/workflows/executions/${e}/cancel`,{})})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}}exports.AECPilotApi=Ue;exports.AIShopApi=He;exports.AecKnowledgeFileStatus=T;exports.AecpilotUIApi=Le;exports.ApplicationTypes=le;exports.ArchiGptUIKeys=ie;exports.AuthApi=Ae;exports.BaseApi=m;exports.BotClientApi=Ce;exports.CVForceApi=xe;exports.CVForceDatahubApi=Ne;exports.ChatMessageRole=se;exports.ChatMode=te;exports.ContralyzeApi=Qe;exports.DataApi=Te;exports.FileProccessStatus=re;exports.GenerateStatus=ue;exports.IChatRole=$e;exports.IDatasetLevel=ge;exports.IFileOrigin=ee;exports.IHistoryRole=b;exports.ISourceType=G;exports.ISpacetwinStatus=j;exports.IThinkingStatus=Z;exports.IversionInfo=X;exports.KnowledgeFileStatus=ae;exports.KnowledgeType=ce;exports.ModelServiceApi=Oe;exports.OCRServiceId=me;exports.PROMPT_SEARCH_MAX_LENGTH=D;exports.PROMPT_TITLE_MAX_LENGTH=Ke;exports.PanoramaApi=be;exports.PanoramaPluginMgrApi=Pe;exports.PreLabelTaskStatus=he;exports.PromptStatus=oe;exports.PromptVariableType=de;exports.RecordStatus=Y;exports.SourceType=ne;exports.SubsectionStatus=pe;exports.UploadZipsStatus=f;exports.needPrettifyMsg=J;exports.prettifyMsg=z;
|
|
3
|
+
`+l:l;break;case"event":r.event=l;break;case"id":n(r.id=l);break;case"retry":const d=parseInt(l,10);isNaN(d)||e(r.retry=d);break}}}}function Ve(n,e){const t=new Uint8Array(n.length+e.length);return t.set(n),t.set(e,n.length),t}function Q(){return{data:"",event:"",id:"",retry:void 0}}const L="text/event-stream",De=1e3,W="last-event-id";function V(n,u){var l=u,{signal:e,headers:t,onopen:r,onmessage:a,onclose:i,onerror:o,openWhenHidden:c,fetch:h}=l,p=_(l,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((d,g)=>{const S=y({},t);S.accept||(S.accept=L);let $;function I(){$.abort(),document.hidden||U()}c||document.addEventListener("visibilitychange",I);let P=De,E=0;function K(){document.removeEventListener("visibilitychange",I),window.clearTimeout(E),$.abort()}e==null||e.addEventListener("abort",()=>{K(),d()});const ve=h!=null?h:window.fetch,Se=r!=null?r:Ee;function U(){return s(this,null,function*(){var B;$=new AbortController;try{const R=yield ve(n,w(y({},p),{headers:S,signal:$.signal}));yield Se(R),yield Re(R.body,Me(Fe(k=>{k?S[W]=k:delete S[W]},k=>{P=k},a))),i==null||i(),K(),d()}catch(R){if(!$.signal.aborted)try{const k=(B=o==null?void 0:o(R))!=null?B:P;window.clearTimeout(E),E=window.setTimeout(U,k)}catch(k){K(),g(k)}}})}U()})}function Ee(n){const e=n.headers.get("content-type");if(!(e!=null&&e.startsWith(L)))throw new Error(`Expected content-type to be ${L}, Actual: ${e}`)}const D=128,Ke=20;class Ue extends m{constructor(e,t,r){super(e!=null?e:v.create(),r),this.axiosInstance=e,this.getToken=t}getSessions(){return s(this,null,function*(){return this.get("/chatSession")})}postSession(e){return s(this,null,function*(){return this.post("/chatSession",e)})}getSession(e){return s(this,null,function*(){return this.get(`/chatSession/${e}`)})}updateSession(e,t){return s(this,null,function*(){return this.patch(`/chatSession/${e}`,t)})}deleteSession(e){return s(this,null,function*(){return this.delete(`/chatSession/${e}`)})}getSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.get(`chatSession/${e}/file`,t)})}postSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.post(`chatSession/${e}/file`,t)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`chatSession/${e}/file`,t)})}getSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.get(`chatSession/${e}/file/${t}`)})}deleteSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.delete(`chatSession/${e}/file/${t}`)})}getSessionChatHistory(e,t){return s(this,null,function*(){return this.get(`/chatSession/${e}/history`,t)})}postMessage(e,t,r){return s(this,null,function*(){return this.post(`/config/tenantApplication?applicationId=${e}&sessionId=${t}`,r)})}postComments(e,t){return s(this,null,function*(){return this.post(`/chatSession/${e}/comments`,t)})}listApplications(){return s(this,null,function*(){return this.list("/applications")})}getApplication(){return s(this,null,function*(){return this.get("/config/tenantApplication")})}postApplication(e){return s(this,null,function*(){return this.post("/config/tenantApplication",{applicationId:e})})}getRecommendQues(){return s(this,null,function*(){return this.get("/recommendQues")})}postRecommendQues(e){return s(this,null,function*(){return this.post("/recommendQues",e)})}patchRecommendQues(e,t){return s(this,null,function*(){return this.patch(`/recommendQues/${e}`,t)})}delRecommendQues(e){return s(this,null,function*(){return this.delete(`/recommendQues/${e}`)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{A.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const c=new Uint8Array(o.target.result),h={"Content-Type":"application/octet-stream"};A.putObjectBuffer(e.bucket,e.fileKeys[0],c,h,p=>{if(p)throw console.error(p),Error(p);r(e.fileKeys[0])})}})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>this.uploadMinioFile(a,t)).catch(a=>{throw Error(a)})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a,i)))).catch(a=>{throw Error(a)})})}getKnowledge(e,t){return s(this,null,function*(){return this.get("/knowledge",{docId:e,name:t})})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}`)})}updateKnowledgeIdFileId(e,t,r){return s(this,null,function*(){return this.patch(`/chatSession/${e}/file/${t}`,r)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}/data/${r}`)})}checkFileReady(e,t,r=()=>!0,a=1e4,i){return s(this,null,function*(){return new Promise((o,c)=>{const h=()=>{if(!r()){clearInterval(p);return}t?this.getSessionKnowledgeFile(e,t).then(l=>{if(i==null||i(l),l.status===T.Success&&(clearInterval(p),o(l)),l.status===T.Failed){clearInterval(p);const d="该文件无法读取,请上传可编辑pdf,doc,docx文档";c(Error(d,{cause:{code:-101,message:d,data:l}}))}}).catch(l=>{clearInterval(p),c(l)}):o(null)},p=setInterval(h,a);h()})})}postChat(e,t){return s(this,null,function*(){return this.post("/chat",e,t)})}postChatV2EventSource(e,t,r,a){return s(this,null,function*(){var h;const i={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},o=yield this.getToken(),c=w(y({},t),{stream:!0});V(`${(h=this.axiosInstance)==null?void 0:h.defaults.baseURL}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(c),openWhenHidden:!0,signal:r,onopen(p){return p.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(p){if(!p.data&&!p.event&&!p.id&&!p.retry)return;if(!p.data.includes('{"code": ')){let l={};try{l=JSON.parse(p.data)}catch(g){}(l==null?void 0:l.mtype)==="search"?i.searchReference.push(l):i.content=i.content+p.data;const d={content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:C(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(a==null?void 0:a.onmessage)&&a.onmessage(d)}const u=JSON.parse(p.data);if(i.reference=u.data.reference,i.messageTime=u.data.messageTime,i.messageId=u.data.messageId,i.llmModel=u.data.llmModel,i.code=u.code,u.code===200){const l={code:i.code,content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:i.messageTime,isReplying:!0};a!=null&&a.onmessage&&a.onmessage(l)}},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const p={code:i.code,content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:i.messageTime,comment:{isAgree:0},isReplying:!1};a!=null&&a.onclose&&a.onclose(p)}})})}postChatV3EventSource(e,t,r,a){return s(this,null,function*(){var h,p;const i={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,reasoningContent:"",thinkingSecs:"",thinkingStatus:"",searchingStatus:""},o=yield this.getToken(),c=w(y({},t),{stream:!0});V(`${(p=(h=this.axiosInstance)==null?void 0:h.defaults.baseURL)==null?void 0:p.replace("/v1","/v3")}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(c),openWhenHidden:!0,signal:r,onopen(u){return u.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(u){if(!u.data&&!u.event&&!u.id&&!u.retry)return;let l={};try{l=JSON.parse(u.data)}catch($){console.log("eventData",u.data)}const d=l.data.type,g=l.data.payload;i.isReplying=!0,d==="error"&&(i.code=l.code,i.message=l.message);const S=()=>{if(!i.searchingStatus){i.searchingStatus="start";return}if(i.searchingStatus==="start"){i.searchingStatus="end";return}};if(d==="beforeSearch"&&S(),d==="search"&&(i.code=l.code,i.message=l.message,i.searchReference.push(g)),d==="thinking"){S(),i.code=l.code,i.message=l.message,i.thinkingStatus="start";const I=g.choices[0];i.reasoningContent=i.reasoningContent+I.delta.reasoningContent}if(d==="thinkingOver"){i.code=l.code,i.message=l.message,i.thinkingStatus="end";const $=g.thinkingSecs;i.thinkingSecs=$}if(d==="text"){S(),i.code=l.code,i.message=l.message;const I=g.choices[0];i.content=i.content+I.delta.content}if(d==="reference"&&(i.code=l.code,i.message=l.message,i.reference=g),d==="result"){i.code=l.code,i.message=l.message;const $=g.messageId,I=g.llmModel,P=g.messageTime;i.messageId=$,i.llmModel=I,i.messageTime=P,i.sessionId=e}a!=null&&a.onmessage&&a.onmessage(i)},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const u=w(y({},i),{isReplying:!1});a!=null&&a.onclose&&a.onclose(u)}})})}getResourceToken(e){return s(this,null,function*(){return this.get("/resourceToken",e)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/upload/ticket",e)})}postPrompts(e){return s(this,null,function*(){return this.post("/prompts",e)})}listPrompt(e){return s(this,null,function*(){return e!=null&&e.title&&e.title.length>D?[]:this.get("/prompts",e)})}getPrompt(e){return s(this,null,function*(){return this.get(`/prompts/${e}`)})}updatePrompt(e,t){return s(this,null,function*(){return this.put(`/prompts/${e}`,t)})}deletePrompt(e){return s(this,null,function*(){return this.delete(`/prompts/${e}`)})}chatSessionIdContext(e){return s(this,null,function*(){return this.patch(`/chatSession/${e}/context`,{})})}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}getApplicationId(e){return s(this,null,function*(){return this.get(`/applications/${e}`)})}getAppService(){return s(this,null,function*(){return this.get("/appservice")})}}window.Buffer=x.Buffer;class Le extends m{constructor(e,t,r){super(e!=null?e:v.create(),r),this.axiosInstance=e,this.getToken=t}getApplicationIdSessions(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session`)})}getApplicationId(e,t){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`,t)})}postApplicationIdSession(e){return s(this,null,function*(){return this.post(`/data/v1/application/${e.applicationId}/sessions`,e)})}getApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}patchApplicationIdSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}/context`,{})})}delApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/sessions/${t}`)})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/sessions/${t}/comments`,r)})}getChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/chatHistory/${t}`)})}postChatV2EventSource(e,t,r,a,i,o){return s(this,null,function*(){const c={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},h=yield this.getToken(),p=w(y({},r),{stream:!0});V(`https://aiot-dev.glodon.com/api/cvforcepd/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${h}`,"Content-Type":"application/json"},body:JSON.stringify(p),openWhenHidden:!0,signal:a,onopen(u){return u.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(u){if(!u.data.includes('{"code": ')){let d={};try{d=JSON.parse(u.data)}catch(S){}(d==null?void 0:d.mtype)==="search"?c.searchReference.push(d):c.content=c.content+u.data;const g={content:c.content,role:1,reference:c.reference,searchReference:c.searchReference,messageId:c.messageId,sessionId:t,messageTime:C(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(i==null?void 0:i.onmessage)&&i.onmessage(g)}const l=JSON.parse(u.data);if(c.reference=l.data.reference,c.searchReference=l.data.searchReference,c.messageTime=l.data.messageTime,c.messageId=l.data.messageId,c.llmModel=l.data.llmModel,c.content=l.data.content,c.code=l.code,l.code===200){const d={code:c.code,content:c.content,role:1,reference:c.reference,searchReference:c.searchReference,messageId:c.messageId,sessionId:t,messageTime:c.messageTime,isReplying:!0};i!=null&&i.onmessage&&i.onmessage(d)}else return o&&o({code:l.code,message:l.message})},onerror(){i!=null&&i.onerror&&i.onerror()},onclose(){const u={code:c.code,content:c.content,role:1,reference:c.reference,searchReference:c.searchReference,messageId:c.messageId,sessionId:t,messageTime:c.messageTime,comment:{isAgree:0},isReplying:!1};i!=null&&i.onclose&&i.onclose(u)}})})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}/data/${r}`)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}`)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}`)})}getSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.get(`/data/v1/chatSession/${e}/file/${t}`)})}sleep(e){return s(this,null,function*(){return new Promise(t=>{setTimeout(()=>{t("")},e)})})}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.postTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a.minio,i)))).catch(a=>{throw Error(a)})})}postFile(e,t,r){return s(this,null,function*(){const a={files:[t.name],isv:"minio",knowledgeId:e,type:r};return this.postTicket(a).then(i=>this.uploadMinioFile(i.minio,t)).catch(i=>{throw Error(i)})})}postTicket(e){return s(this,null,function*(){return this.post("/data/v1/ticket",e)})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{A.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const c=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};A.putObjectBuffer(e.bucket,e.fileKeys[0],c,h,p=>{if(p)throw console.error(p),Error(p);r(e.fileKeys[0])})}})})}getRecommendQues(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/recommendQues`)})}postPrompts(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/prompts`,t)})}listPrompt(e,t){return s(this,null,function*(){return t!=null&&t.title&&t.title.length>D?[]:this.get(`/data/v1/application/${e}/prompts`,t)})}getPrompt(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/prompts/${t}`)})}updatePrompt(e,t,r){return s(this,null,function*(){return this.put(`/data/v1/application/${e}/prompts/${t}`,r)})}deletePrompt(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/prompts/${t}`)})}postGeneques(e,t){return s(this,null,function*(){return this.post("/data/v1/geneques",e,{},t)})}getApplicationIdSessionKnowledgeFiles(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file`,r)})}checkFileReady(e,t,r,a=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((c,h)=>{const p=()=>{if(!a()){clearInterval(u);return}r?this.getApplicationIdSessionKnowledgeFileId(e,t,r,{},!0).then(d=>{if(o==null||o(d),d.status===T.Success&&(clearInterval(u),c(d)),d.status===T.Failed){clearInterval(u);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:d}}))}}).catch(d=>{clearInterval(u),h(d)}):c(null)},u=setInterval(p,i);p()})})}getApplicationIdSessionKnowledgeFileId(e,t,r,a,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${r}`,a,i)})}delApplicationIdSessionKnowledgeFileId(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file/${r}`)})}postApplicationIdSessionKnowledgeSessionFile(e,t,r,a,i){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`,r,a,i)})}delApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file`,r)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`/data/v1/chatSession/${e}/file`,t)})}patchApplicationIdKnowledgeIdFileId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${r}`,a)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`)})}getApplicationIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/promptVariables`,t)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${r}`,a)})}updateSession(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}getSession(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}getSessionArtifacts(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}/artifacts`,void 0,!0)})}getSilenceDuration(){return s(this,null,function*(){return this.get("/data/v1/silenceDuration")})}}globalThis.Buffer=x.Buffer;class Ce extends m{constructor(e,t,r){super(e!=null?e:v.create(),r),this.axiosInstance=e,this.getToken=t}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}postGeneques(e){return s(this,null,function*(){return this.post("/data/v1/geneques",e)})}getApplicationId(e){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`)})}getApplicationIdSessions(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessionsa`,t)})}postApplicationIdSession(e){return s(this,null,function*(){return this.post(`/data/v1/application/${e.applicationId}/sessions`,e)})}getApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}patchApplicationIdSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}delApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/sessions/${t}`)})}getApplicationIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/promptVariables`,t)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${r}`,a)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`/data/v1/chatSession/${e}/file`,t)})}getRecommendQues(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/recommendQues`)})}postRecommendQues(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/recommendQues`,t)})}delRecommendQues(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/recommendQues/${t}`)})}getChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/chatHistory/${t}`)})}postPrompts(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/prompts`,t)})}listPrompt(e,t){return s(this,null,function*(){return t!=null&&t.title&&t.title.length>D?[]:this.get(`/data/v1/application/${e}/prompts`,t)})}getPrompt(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/prompts/${t}`)})}updatePrompt(e,t,r){return s(this,null,function*(){return this.put(`/data/v1/application/${e}/prompts/${t}`,r)})}deletePrompt(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/prompts/${t}`)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}/context`,{})})}getApplicationIdSessionKnowledgeFiles(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file`,r)})}postApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/file`,r)})}postApplicationIdSessionKnowledgeSessionFile(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`,r)})}delApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file`,r)})}getApplicationIdSessionKnowledgeFileId(e,t,r,a,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${r}`,a,i)})}delApplicationIdSessionKnowledgeFileId(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file/${r}`)})}patchApplicationIdKnowledgeIdFileId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${r}`,a)})}checkFileReady(e,t,r,a=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((c,h)=>{const p=()=>{if(!a()){clearInterval(u);return}r?this.getApplicationIdSessionKnowledgeFileId(e,t,r,{},!0).then(d=>{if(o==null||o(d),d.status===T.Success&&(clearInterval(u),c(d)),d.status===T.Failed){clearInterval(u);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:d}}))}}).catch(d=>{clearInterval(u),h(d)}):c(null)},u=setInterval(p,i);p()})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}postUploadTicket(e){return s(this,null,function*(){return this.post("/data/v1/ticket",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{A.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const c=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};A.putObjectBuffer(e.bucket,e.fileKeys[0],c,h,p=>{if(p)throw console.error(p),Error(p);r(e.fileKeys[0])})}})})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/sessions/${t}/comments`,r)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}`)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}`)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}/data/${r}`)})}postChatV2EventSource(e,t,r,a,i){return s(this,null,function*(){var p;const o={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,message:""},c=yield this.getToken(),h=w(y({},r),{stream:!0});V(`${(p=this.axiosInstance)==null?void 0:p.defaults.baseURL}/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${c}`,"Content-Type":"application/json"},body:JSON.stringify(h),openWhenHidden:!0,signal:a,onopen(u){return u.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(u){if(!u.data&&!u.event&&!u.id&&!u.retry)return;if(!u.data.includes('{"code": ')){let d={};try{d=JSON.parse(u.data)}catch(S){}(d==null?void 0:d.mtype)==="search"?o.searchReference.push(d):o.content=o.content+u.data;const g={content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:C(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(i==null?void 0:i.onmessage)&&i.onmessage(g)}const l=JSON.parse(u.data);if(o.reference=l.data.reference,o.messageTime=l.data.messageTime,o.messageId=l.data.messageId,o.llmModel=l.data.llmModel,o.code=l.code,o.message=l.message,l.code===200){const d={code:o.code,content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:o.messageTime,isReplying:!0};i!=null&&i.onmessage&&i.onmessage(d)}},onerror(){i!=null&&i.onerror&&i.onerror()},onclose(){const u={code:o.code,content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:o.messageTime,comment:{isAgree:0},isReplying:!1,message:o.message};i!=null&&i.onclose&&i.onclose(u)}})})}postChat(e,t){return s(this,null,function*(){var r;return this.post(`${(r=this.axiosInstance)==null?void 0:r.defaults.baseURL}/chat/v2/chat`,e,t)})}}var te=(n=>(n[n.Dialog=0]="Dialog",n[n.TextGenerate=1]="TextGenerate",n[n.FileSummery=2]="FileSummery",n))(te||{}),se=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(se||{}),re=(n=>(n[n.Processing=1]="Processing",n[n.Done=2]="Done",n[n.Failed=3]="Failed",n))(re||{}),ne=(n=>(n[n.File=0]="File",n[n.WebLink=1]="WebLink",n))(ne||{}),ae=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(ae||{}),ie=(n=>(n.InputFile="ui.input.file",n.LLMModel="ui.llm.model",n))(ie||{}),oe=(n=>(n[n.Idle=0]="Idle",n[n.Quoted=1]="Quoted",n))(oe||{}),ce=(n=>(n[n.Basic=0]="Basic",n[n.Pro=1]="Pro",n))(ce||{}),le=(n=>(n[n.Dialog=0]="Dialog",n[n.Text=1]="Text",n[n.Agent=2]="Agent",n[n.All=3]="All",n))(le||{}),de=(n=>(n.User="instruction",n.System="settings",n))(de||{});class xe extends m{constructor(e,t){super(e!=null?e:v.create(),t)}getKnowledge(e,t){return s(this,null,function*(){return this.get("/knowledge",{docId:e,name:t})})}postKnowledge(e){return s(this,null,function*(){return this.post("/knowledge",e)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/knowledge/${e}`)})}patchKnowledgeId(e,t){return s(this,null,function*(){return this.patch(`/knowledge/${e}`,t)})}delKnowledgeId(e){return s(this,null,function*(){return this.delete(`/knowledge/${e}`)})}getKnowledgeIdFile(e){return s(this,null,function*(){return this.get(`/knowledge/${e}/file`)})}getKnowledgeIdFileList(e,t){return s(this,null,function*(){return this.listPaged(`/knowledge/${e}/file`,t)})}postKnowledgeIdFile(e,t){return s(this,null,function*(){return this.post(`/knowledge/${e}/file`,t)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}delKnowledgeIdFileFid(e,t){return s(this,null,function*(){return this.delete(`/knowledge/${e}/file/${t}`)})}patchKnowledgeIdFileFid(e,t,r){return s(this,null,function*(){return this.patch(`/knowledge/${e}/file/${t}`,r)})}listSessions(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessionsa`,t)})}postSession(e,t){return s(this,null,function*(){return this.post(`/application/${e}/sessions`,t)})}getSession(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessions/${t}`)})}getSessionArtifacts(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessions/${t}/artifacts`)})}patchSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/application/${e}/sessions/${t}`,r)})}delSessionsId(e,t){return s(this,null,function*(){return this.delete(`/application/${e}/sessions/${t}`)})}getSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.get(`/application/${e}session/${t}/file/${r}`)})}postSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}session/${t}/file`,r)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/ticket",e)})}postApplicationIdSessionFile(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}/session/${t}/sessionfile`,r)})}getApplicationIdSessionFile(e,t,r){return s(this,null,function*(){return this.get(`/application/${e}/session/${t}/file/${r}`)})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}/sessions/${t}/comments`,r)})}getChatHistorySessionId(e,t,r){return s(this,null,function*(){return this.get(`application/${e}/chatHistory/${t}`,r)})}postChatHistorySessionId(e,t){return s(this,null,function*(){return this.post(`/chatHistory/${e}`,t)})}getApplications(e){return s(this,null,function*(){return this.get("/applications",e)})}postApplication(e){return s(this,null,function*(){return this.post("/applications",e)})}getApplicationId(e,t){return s(this,null,function*(){return this.get(`/applications/${e}`,t)})}patchApplicationId(e,t){return s(this,null,function*(){return this.patch(`/applications/${e}`,t)})}delApplicationId(e){return s(this,null,function*(){return this.delete(`/applications/${e}`)})}getApplicationIdSessions(e){return s(this,null,function*(){return this.get(`/applications/${e}/session`)})}patchFileId(e,t){return s(this,null,function*(){return this.patch(`/file/${e}`,t)})}getCvforceResource(e){return s(this,null,function*(){return this.get("/cvforce/resource",e)})}postKnowledgeIdComposedFiles(e,t){return s(this,null,function*(){return this.post(`/knowledge/${e}/composedFiles`,t)})}getTokensApplicationId(e,t){return s(this,null,function*(){return this.get(`/tokens/${e}`,t)})}getTokens(e){return s(this,null,function*(){return this.get("/tokens",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{A.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const c=x.Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};A.putObjectBuffer(e.bucket,e.fileKeys[0],c,h,p=>{if(p)throw console.error(p),Error(p);r(e.fileKeys[0])})}})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.getUploadTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.getUploadTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a.minio,i)))).catch(a=>{throw Error(a)})})}getAecModels(){return s(this,null,function*(){return this.get("/aecModels")})}postTextFilter(e){return s(this,null,function*(){return this.post("/textFilter",e)})}getTenantModel(){return s(this,null,function*(){return this.get("/tenantModel")})}getPrompts(e,t){return s(this,null,function*(){return this.get(`application/${e}/promptVariables`,t)})}postPrompt(e,t){return s(this,null,function*(){return this.post(`application/${e}/promptVariables`,t)})}patchPromptId(e,t,r){return s(this,null,function*(){return this.patch(`application/${e}/promptVariables/${t}`,r)})}delPromptId(e,t){return s(this,null,function*(){return this.delete(`application/${e}/promptVariables/${t}`)})}getSessionPrompts(e){return s(this,null,function*(){return this.get(`session/${e}/promptVariables`)})}patchSessionPromptId(e,t,r){return s(this,null,function*(){return this.patch(`session/${t}/promptVariables/${e}`,r)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/application/${e}/session/${t}/promptVariables`)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/application/${e}/session/${t}/promptVariables/${r}`,a)})}getPresetApplication(e){return s(this,null,function*(){return this.get("presetApplication",e)})}postKnowledgeConfig(e){return s(this,null,function*(){return this.post("/knowledgeConfig",e)})}getKnowledgeConfig(e){return s(this,null,function*(){return this.get(`/knowledgeConfig/${e}`)})}patchKnowledgeConfig(e,t){return s(this,null,function*(){return this.patch(`/knowledgeConfig/${e}`,t)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}`)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.listPaged(`/knowledge/${e}/file/${t}/data`,r)})}postKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.post(`/knowledge/${e}/file/${t}/data`,{data:r})})}patchKnowledgeIdFileIdData(e,t,r,a){return s(this,null,function*(){return this.patch(`/knowledge/${e}/file/${t}/data/${r}`,{data:a})})}delKnowledgeIdFileIdDataDid(e,t,r){return s(this,null,function*(){return this.delete(`/knowledge/${e}/file/${t}/data/${r}`)})}getPresetKnowledge(e){return s(this,null,function*(){return this.get("/presetKnowledge",e)})}patchSessionsIdContext(e){return s(this,null,function*(){return this.patch(`/sessions/${e}/context`,{})})}postResourceToken(e){return s(this,null,function*(){return this.post("/resourceToken",e)})}getApplicationIdSession(e){return s(this,null,function*(){return this.get(`/application/${e}/session`)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/application/${e}/sessions/${t}/context`,{})})}postApplicationIdSessions(e,t){return s(this,null,function*(){return this.post(`/application/${e}/sessions`,t)})}getApplicationIdChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/application/${e}/chatHistory/${t}`)})}postApplicationIdChatHistorySessionIdComments(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}/sessions/${t}/comments`,r)})}getApplicationIdPrompts(e,t){return s(this,null,function*(){return this.get(`/application/${e}/promptVariables`,t)})}postKnowledgeSourceFile(e,t,r){return s(this,null,function*(){return this.post(`/knowledge/${e}/sourceFile/${t}`,r)})}getMetadata(e){return s(this,null,function*(){return this.get("/metadata",e)})}postGeneques(e){return s(this,null,function*(){return this.post("/geneques",e)})}getBaseModel(e){return s(this,null,function*(){return this.get("/baseModelInfo",{serviceId:e})})}}var pe=(n=>(n[n.inital=0]="inital",n[n.success=1]="success",n[n.processing=2]="processing",n[n.failed=3]="failed",n))(pe||{}),ue=(n=>(n[n.inital=0]="inital",n[n.processing=1]="processing",n[n.paused=2]="paused",n[n.failed=3]="failed",n[n.done=4]="done",n))(ue||{}),f=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Failure="FAILURE",n.Success="SUCCESS",n.Abort="ABORT",n))(f||{}),he=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Success="SUCCESS",n.Failure="FAILURE ",n))(he||{}),ge=(n=>(n[n.all=0]="all",n[n.general=1]="general",n[n.major=2]="major",n))(ge||{});function Be(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){const e=Math.random()*16|0;return(n=="x"?e:e&3|8).toString(16)})}class Ne extends m{constructor(e,t){super(e!=null?e:v.create(),t)}getDatasets(e){return s(this,null,function*(){return this.get("/datasets",e)})}postDatasets(e){return s(this,null,function*(){return this.post("/datasets",e)})}getDatasetsId(e){return s(this,null,function*(){return this.get(`/datasets/${e}`)})}delDatasetsId(e){return s(this,null,function*(){return this.delete(`/datasets/${e}`)})}patchDatasetsId(e,t){return s(this,null,function*(){return this.patch(`/datasets/${e}`,t)})}getDatasetsIdVersions(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions?pageNo=${t}&pageSize=${r}`)})}getDatasetsIdVersionsVidNextno(e){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/nextno`)})}getS3Iam(e,t){return s(this,null,function*(){return this.post("/s3/iam",{datasetId:e,publicBucket:t})})}postDatasetsIdVersions(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/versions`,t)})}patchDatasetsIdVersionsVid(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}`,r)})}getDatasetsIdVersionsVid(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}`)})}delDatasetsIdVersionsVid(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}`)})}getDatasetsIdVersionsNo(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/no`,t)})}listDatasetsIdLabels(e,t){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/labels`,t)})}getDatasetsIdVersionsVidLabelcount(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/labelcount`,r)})}getDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/samples`,r)})}updateSamples(e,t,r,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/samples`,{samples:r,confirmStatus:a})})}delDatasetsIdVersionsVidSamplesId(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/samples/${r}`)})}delDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/samples`,{sampleIds:r})})}delDatasetsIdVersionsVidLlmSamplesId(e,t,r){return s(this,null,function*(){return this.delete(`datasets/${e}/versions/${t}/llmSamples/${r}`)})}getDatasetsIdVersionsVidSsamplesSid(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/samples/${r}`).then(a=>w(y({},a),{labels:a.labels?a.labels.map(i=>w(y({},i),{uuid:i.uuid||Be()})):[]}))})}getImportInfo(){return s(this,null,function*(){return this.get("/importInfo")})}getOptionsMarkType(){return s(this,null,function*(){return this.get("/options/markType")})}getOptionsOcrMarkTmpl(){return s(this,null,function*(){return this.get("/options/ocrMarkTmpl")})}getOptionsLlmMarkTmpl(){return s(this,null,function*(){return this.get("/options/llmMarkTmpl")})}getOptionsLlmResponseSort(){return s(this,null,function*(){return this.get("/options/llmResponseSort")})}getOptionsImgproxy(){return s(this,null,function*(){return this.get("/options/imgproxy")})}getDeduplication(e,t){return s(this,null,function*(){return this.post("/files/deduplication",{md5s:e,datasetId:t})})}postDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/samples`,r)})}patchDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/samples`,r)})}listCategory(e){return s(this,null,function*(){return this.list(`/datasets/${e}/catagory`)})}postCategory(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/catagory`,{name:t})})}updateCategory(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/catagory/${t}`,{name:r})})}deleteCategory(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/catagory/${t}`)})}postDatasetIdVersionIdFilesDeduplication(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/files/deduplication`,r)})}postDatasetIdVersionIdLlmSamples(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples`,r)})}patchDatasetIdVersionIdLlmSampleId(e,t,r,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamples/${r}`,a)})}postLlmSamplesSubsection(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/subsection`,r)})}generatellmSamplesSubsection(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/subsection`,r)})}listSubsection(e,t,r,a){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection`,a)})}postSubsection(e,t,r,a){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection`,a)})}updateSubsection(e,t,r,a,i){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection/${a}`,i)})}deleteSubsection(e,t,r,a){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection/${a}`)})}llmSupervisedRecordGenerate(e){return s(this,null,function*(){return this.post("/llm/supervisedRecord/generatedata",e)})}llmSupervisedRecordAbordTask(e){return s(this,null,function*(){return this.post("/llm/supervisedRecord/abortTask",e)})}llmSupervisedRecordPauseTask(e){return s(this,null,function*(){return this.post("/llm/supervisedRecord/pauseTask",e)})}getLlmSupervisedRecord(e){return s(this,null,function*(){return this.get(`/llm/supervisedRecord/${e}`)})}getDatasetsIdVersionsIdLlmSamplesV2(e,t,r){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/versions/${t}/llmSamplesV2`,r)})}postDatasetsIdVersionsIdLlmSamplesV2(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamplesV2`,r)})}getDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/llmSamplesV2/${r}`)})}patchDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,r,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamplesV2/${r}`,a)})}delDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/llmSamplesV2/${r}`)})}getDatasetsIdVersionsIdExportLLMSamples(e,t){return s(this,null,function*(){return this.getNonStandard(`/datasets/${e}/versions/${t}/exportLLMSamples`,{responseType:"blob"})})}llmSamplesSubsectionView(e,t,r,a){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/${r}/previewSubsection`,a)})}listLabels(e,t){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/labels`,t)})}postLabels(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/labels`,t)})}patchLabel(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/labels/${t}`,r)})}deleteLabel(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/labels/${t}`)})}postUploadPicsZip(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/uploadzip`,r)})}postVlmUploadPicsZip(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/vlmuploadzip`,r)})}checkFileResult(e,t,r,a=1e3,i,o){return s(this,null,function*(){return new Promise((c,h)=>{const p=()=>{e?i==="vlm"?this.getUploadVlmPicsZipResult(e,t,r).then(l=>{const d=l[0];if(d.state===f.Started||d.state===f.Pending){const g=d.process||0;o&&o(g)}if(d.state===f.Success&&(clearInterval(u),c(d.lastTaskResult)),d.state===f.Failure){clearInterval(u);const g="该文件处理失败";h(Error(g,{cause:{code:-101,message:g,data:d.lastTaskResult}}))}d.state===f.Abort&&(clearInterval(u),c(d.lastTaskResult))}).catch(l=>{clearInterval(u),h(l)}):this.getUploadPicsZipResult(e,t,r).then(l=>{const d=l[0];if(d.state===f.Started||d.state===f.Pending){const g=d.process||0;o&&o(g)}if(d.state===f.Success&&(clearInterval(u),c(d.lastTaskResult)),d.state===f.Failure){clearInterval(u);const g="该文件处理失败";h(Error(g,{cause:{code:-101,message:g,data:d.lastTaskResult}}))}d.state===f.Abort&&(clearInterval(u),c(d.lastTaskResult))}).catch(l=>{clearInterval(u),h(l)}):c(null)},u=setInterval(p,a);p()})})}getUploadPicsZipResult(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/uploadzip`,r)})}getUploadVlmPicsZipResult(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/vlmuploadzip`,r)})}getUploadabort(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/uploadabort`,r)})}postPreLabelTask(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/prelabeltask`,r)})}getPreLabelTask(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/prelabeltask`)})}delPreLabelTask(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/prelabeltask/${r}`)})}getAllConfirmSamples(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/confirm`)})}getDataSetCopyTask(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/copyDataset`)})}postDataSetCopyTask(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/copyDataset`,r)})}deleteDatasetCopyTask(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/copyDataset`,r)})}getDatasetsIdVersionsVidConfigs(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/labels`)})}saveVisionLabelConfigs(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/labels`,r)})}postGenerateVlmKieQa(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/samples/generator/vlm_kie_qa`,r)})}getDefaultQaTemplates(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/defaultQaTemplates`)})}getDatasetVersionCompareSummary(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/compare/summary`,t)})}getDatasetVersionCompareSamples(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/compare/samples`,t)})}}class Oe extends m{constructor(e,t){super(e!=null?e:v.create(),t)}listModelServices(e){return s(this,null,function*(){return this.listPaged("/modelService",e)})}postModelService(e){return s(this,null,function*(){return this.post("/modelService",e)})}getModelServiceById(e){return s(this,null,function*(){return this.get(`/modelService/${e}`)})}patchModelServiceById(e,t){return s(this,null,function*(){return this.patch(`/modelService/${e}`,t)})}deleteModelService(e){return s(this,null,function*(){return this.delete(`/modelService/${e}`)})}getEnableModelService(e){return s(this,null,function*(){return this.get(`/modelService/${e}/enable`)})}getDisableModelService(e){return s(this,null,function*(){return this.get(`/modelService/${e}/disable`)})}getModelServiceList(e){return s(this,null,function*(){return this.get(`/modelService/${e}/list`)})}getModelServiceDelist(e){return s(this,null,function*(){return this.get(`/modelService/${e}/delist`)})}importService(e){return s(this,null,function*(){return this.post("/modelService/import",e)})}patchModelService(e,t){return s(this,null,function*(){return this.patch(`/modelService/${e}`,t)})}openModelServices(e){return s(this,null,function*(){return this.get("/openModelService",e)})}importMirronService(e){return s(this,null,function*(){return this.post("/modelService/importMirron",e)})}patchMirronService(e,t){return s(this,null,function*(){return this.patch(`/modelService/importMirron/${e}`,t)})}getServiceSignList(e){return s(this,null,function*(){return this.get("/serviceSign",e)})}}var ye=(n=>(n[n.minio=0]="minio",n[n.pvc=1]="pvc",n))(ye||{}),me=(n=>(n.common="A100",n.idcard="A104",n.bankcard="A108",n.page="A112",n.rmwatermark="A115",n.seal="A116",n.rmseal="A117",n.table="A118",n))(me||{}),$e=(n=>(n.User="user",n.Assistant="assistant",n.System="system",n))($e||{});class He extends m{constructor(e,t){super(e!=null?e:v.create(),t)}ocr(e,t){return s(this,null,function*(){if(t.modelStore===ye.pvc){const r=this.convertToBatchParams(t),a=yield this.ocrPvcBatch(e,r);return this.convertToMinioResult(a)}else return this.ocrMinio(e,t)})}convertToBatchParams(e){return{pages:[{image:e.image}]}}convertToMinioResult(e){var t;return(t=e.pages)==null?void 0:t.flatMap(r=>{var a;return((a=r.textItems)==null?void 0:a.map(i=>({box:i.bbox})))||[]})}ocrMinio(e,t){return s(this,null,function*(){return t.image&&t.image.split("base64,").length>1&&(t.image=t.image.split("base64,")[1]),this.post(`/v2/infer?serviceId=${e}`,t)})}ocrPvcBatch(e,t){return s(this,null,function*(){return this.post(`/v2/infer?serviceId=${e}`,t)})}getSleep(e){return s(this,null,function*(){return new Promise(t=>{setTimeout(()=>{t(!0)},e*1e3)})})}postChatCompletions(e){return s(this,null,function*(){return this.postNonStandard("/v1/chat/completions",e)})}detection(e,t){return s(this,null,function*(){return this.post(`/v2/infer?serviceId=${e}`,t)})}detectionLayout(e,t){return s(this,null,function*(){if("pages"in t){const r=yield this.post(`/v2/infer?serviceId=${e}`,t);return this.convertLayoutToDetection(r)}else return this.post(`/v2/infer?serviceId=${e}`,t)})}convertLayoutToDetection(e){var t,r;return{prediction:((r=(t=e.pages[0])==null?void 0:t.layout)==null?void 0:r.map(a=>({box:a.bbox,label:a.type,score:a.score})))||[]}}getBaseModel(e){return s(this,null,function*(){return this.get("/v1/baseModel",{serviceId:e})})}postEmbeddings(e){return s(this,null,function*(){return this.postNonStandard("/v1/embeddings",e)})}postFile(e,t){return s(this,null,function*(){const r=new FormData;r.append("file",e,e.name);const a=yield this.http.post("/v1/files",r,{onUploadProgress:o=>{t==null||t(o.loaded,o.total||e.size)}}),i=q(a);if(!i)throw new Error("平台文件服务请求失败");return i})}getFile(e){return s(this,null,function*(){var t;try{const r=yield this.http.get(`/v1/files/${encodeURIComponent(e)}`);return q(r,!0)}catch(r){const a=r.response;if((a==null?void 0:a.status)===404||((t=a==null?void 0:a.data)==null?void 0:t.code)===fe)return;throw new Error("平台文件服务请求失败")}})}}const fe=11012;function _e(n){return n===0||n>=200&&n<300}function q(n,e=!1){var r;const t=n.data;if(!t||typeof t.code!="number")throw new Error("平台文件服务请求失败");if(t.code===fe){if(e)return;throw new Error("文件不存在")}if(!_e(t.code)||!((r=t.data)!=null&&r.id))throw new Error(t.message||"平台文件服务请求失败");return t.data}class Qe extends m{constructor(e,t){super(e!=null?e:v.create(),t)}listTasks(e){return s(this,null,function*(){return this.get("/tasks",e)})}createTask(e){return s(this,null,function*(){return this.post("/tasks",e)})}getTask(e){return s(this,null,function*(){return this.get(`/tasks/${e}`)})}updateTask(e,t){return s(this,null,function*(){return this.patch(`/tasks/${e}`,t)})}deleteTask(e){return s(this,null,function*(){return this.delete(`/tasks/${e}`)})}listTaskFiles(e){return s(this,null,function*(){return this.get(`/tasks/${e}/files`)})}uploadTaskFile(e,t){return s(this,null,function*(){return this.post(`/tasks/${e}/files`,t)})}listWorkflowExecutions(e){return s(this,null,function*(){return this.get("/workflows/executions",e)})}getWorkflowExecution(e){return s(this,null,function*(){return this.get(`/workflows/executions/${e}`)})}startWorkflowExecution(e){return s(this,null,function*(){return this.post("/workflows/executions",e)})}updateWorkflowExecution(e,t){return s(this,null,function*(){return this.patch(`/workflows/executions/${e}`,t)})}cancelWorkflowExecution(e){return s(this,null,function*(){return this.post(`/workflows/executions/${e}/cancel`,{})})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}}exports.AECPilotApi=Ue;exports.AIShopApi=He;exports.AecKnowledgeFileStatus=T;exports.AecpilotUIApi=Ce;exports.ApplicationTypes=le;exports.ArchiGptUIKeys=ie;exports.AuthApi=Ae;exports.BaseApi=m;exports.BotClientApi=Le;exports.CVForceApi=xe;exports.CVForceDatahubApi=Ne;exports.ChatMessageRole=se;exports.ChatMode=te;exports.ContralyzeApi=Qe;exports.DataApi=Te;exports.FileProccessStatus=re;exports.GenerateStatus=ue;exports.IChatRole=$e;exports.IDatasetLevel=ge;exports.IFileOrigin=ee;exports.IHistoryRole=b;exports.ISourceType=G;exports.ISpacetwinStatus=j;exports.IThinkingStatus=Z;exports.IversionInfo=X;exports.KnowledgeFileStatus=ae;exports.KnowledgeType=ce;exports.ModelServiceApi=Oe;exports.OCRServiceId=me;exports.PROMPT_SEARCH_MAX_LENGTH=D;exports.PROMPT_TITLE_MAX_LENGTH=Ke;exports.PanoramaApi=be;exports.PanoramaPluginMgrApi=Pe;exports.PreLabelTaskStatus=he;exports.PromptStatus=oe;exports.PromptVariableType=de;exports.RecordStatus=Y;exports.SourceType=ne;exports.SubsectionStatus=pe;exports.UploadZipsStatus=f;exports.needPrettifyMsg=J;exports.prettifyMsg=z;
|
|
@@ -22,6 +22,21 @@ export interface IArrange {
|
|
|
22
22
|
thinkingModeOpen?: boolean;
|
|
23
23
|
thinkingTextOpen?: boolean;
|
|
24
24
|
autoGenerateSessionTitle?: boolean;
|
|
25
|
+
/** 编排绑定的 MCP。本地服务可以不带 funcs。 */
|
|
26
|
+
mcps?: {
|
|
27
|
+
id?: string;
|
|
28
|
+
name?: string;
|
|
29
|
+
/** 1 广场,2 自建。 */
|
|
30
|
+
type?: number;
|
|
31
|
+
/** cloud 云端,local 本地。缺省视为 cloud。 */
|
|
32
|
+
runtime?: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
funcs?: {
|
|
35
|
+
funcId?: string;
|
|
36
|
+
funcCode?: string;
|
|
37
|
+
funcSummary?: string;
|
|
38
|
+
}[];
|
|
39
|
+
}[];
|
|
25
40
|
}
|
|
26
41
|
export interface IApplication {
|
|
27
42
|
id: string;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { ApiErrorHandler, BaseApi } from '../base';
|
|
3
|
+
import { IApplication, ICommentParam, IAecFile as IFile, IAecFileDataParam as IFileDataParam, IHistory, IAecKnowledge, IAecPrompt as IPrompt, IAecPromptParam as IPromptParam, IPromptType, IQuestion, IAecSessionParam as ISessionParam, IAecSession as ISession, KnowledgeFileMetadata, KnowledgeFileMetadataParams, IFileParams, IKnowledgeFileParams } from '../aecpilot/model';
|
|
4
|
+
import { IBaseModel, IUploadParam, IUploadTicket, MinioConfig } from './model';
|
|
5
|
+
import { IGeneques, IPromptVariables, ISessionPrompt } from '../aecpilotui/model';
|
|
6
|
+
export declare class BotClientUIApi extends BaseApi {
|
|
7
|
+
private axiosInstance;
|
|
8
|
+
private getToken;
|
|
9
|
+
constructor(axiosInstance: AxiosInstance, getToken: () => string, errorHandler?: ApiErrorHandler);
|
|
10
|
+
getApplicationIdSessions(appId: string): Promise<ISession[]>;
|
|
11
|
+
getApplicationId(id: string): Promise<IApplication>;
|
|
12
|
+
postApplicationIdSession(params: ISessionParam): Promise<ISession>;
|
|
13
|
+
getApplicationIdSessionsId(appId: string, id: string): Promise<ISession>;
|
|
14
|
+
patchApplicationIdSessionsId(appId: string, id: string, params: ISessionParam): Promise<ISession>;
|
|
15
|
+
patchApplicationIdSessionsIdContext(id: string, sid: string): Promise<unknown>;
|
|
16
|
+
delApplicationIdSessionsId(appId: string, id: string): Promise<ISession>;
|
|
17
|
+
postComments(id: string, sid: string, params: ICommentParam): Promise<unknown>;
|
|
18
|
+
getChatHistorySessionId(appId: string, sessionId: string): Promise<IHistory[]>;
|
|
19
|
+
postChatV2EventSource(applicationId: string, sessionId: string, params: any, signal: AbortSignal, options: {
|
|
20
|
+
onopen?: any;
|
|
21
|
+
onmessage?: any;
|
|
22
|
+
onerror?: any;
|
|
23
|
+
onclose?: any;
|
|
24
|
+
}, onAppStatusError?: (error: any) => void): Promise<void>;
|
|
25
|
+
getKnowledgeIdFileIdData(id: string, fid: string, did: string): Promise<IFileDataParam[]>;
|
|
26
|
+
getKnowledgeIdFileId(id: string, fid: string): Promise<IFile>;
|
|
27
|
+
getKnowledgeId(id: string): Promise<IAecKnowledge>;
|
|
28
|
+
getSessionKnowledgeFile(sessionId: string, fileId: string): Promise<KnowledgeFileMetadata>;
|
|
29
|
+
sleep(ms: number): Promise<unknown>;
|
|
30
|
+
getBaseModelInfo(serviceId: string): Promise<IBaseModel>;
|
|
31
|
+
uploadFiles(path: string, files: File[]): Promise<string[]>;
|
|
32
|
+
postFile(path: string, file: File, type?: number): Promise<string>;
|
|
33
|
+
postTicket(params: IUploadParam): Promise<IUploadTicket>;
|
|
34
|
+
uploadFile(path: string, file: File): Promise<string>;
|
|
35
|
+
uploadMinioFile(minioConfig: MinioConfig, file: File): Promise<string>;
|
|
36
|
+
getRecommendQues(appId: string): Promise<IQuestion[]>;
|
|
37
|
+
postPrompts(appId: string, params: IPromptParam): Promise<{
|
|
38
|
+
id: string;
|
|
39
|
+
}>;
|
|
40
|
+
listPrompt(appId: string, params?: {
|
|
41
|
+
title?: string;
|
|
42
|
+
type?: IPromptType;
|
|
43
|
+
}): Promise<IPrompt[]>;
|
|
44
|
+
getPrompt(appId: string, id: string): Promise<IPrompt>;
|
|
45
|
+
updatePrompt(appId: string, id: string, params: IPromptParam): Promise<string>;
|
|
46
|
+
deletePrompt(appId: string, id: string): Promise<string>;
|
|
47
|
+
postGeneques(params: {
|
|
48
|
+
content: string;
|
|
49
|
+
}, config?: AxiosRequestConfig): Promise<IGeneques>;
|
|
50
|
+
getApplicationIdSessionKnowledgeFiles(appId: string, sessionId: string, params?: {
|
|
51
|
+
enabled: number;
|
|
52
|
+
}): Promise<KnowledgeFileMetadata[]>;
|
|
53
|
+
checkFileReady(appId: string, sessionId: string, fileId?: string, shouldContinueFunc?: () => boolean, interval?: number, upateFileFn?: any): Promise<KnowledgeFileMetadata | null>;
|
|
54
|
+
getApplicationIdSessionKnowledgeFileId(appId: string, sessionId: string, fileId: string, params?: any, errInvisable?: boolean): Promise<KnowledgeFileMetadata>;
|
|
55
|
+
delApplicationIdSessionKnowledgeFileId(appId: string, sessionId: string, fileId: string): Promise<string>;
|
|
56
|
+
postApplicationIdSessionKnowledgeSessionFile(appId: string, sessionId: string, data: KnowledgeFileMetadataParams, params?: any, config?: AxiosRequestConfig): Promise<string>;
|
|
57
|
+
delApplicationIdSessionKnowledgeFile(appId: string, sessionId: string, params: {
|
|
58
|
+
files: IFileParams[];
|
|
59
|
+
}): Promise<any>;
|
|
60
|
+
deleteSessionKnowledgeFiles(sessionId: string, params: {
|
|
61
|
+
files: IFileParams[];
|
|
62
|
+
}): Promise<any>;
|
|
63
|
+
patchApplicationIdKnowledgeIdFileId(appId: string, sessionId: string, fid: string, params: IKnowledgeFileParams): Promise<IFile>;
|
|
64
|
+
getApplicationIdSessionIdPromptVariables(appId: string, sessionId: string): Promise<ISessionPrompt[]>;
|
|
65
|
+
getApplicationIdPromptVariables(appId: string, params?: {
|
|
66
|
+
status: number;
|
|
67
|
+
}): Promise<IPromptVariables[]>;
|
|
68
|
+
patchApplicationIdSessionpromptVariablesId(appId: string, sid: string, id: string, params: Partial<ISessionPrompt>): Promise<IPrompt[]>;
|
|
69
|
+
updateSession(appId: any, sid: string, params: ISessionParam): Promise<string>;
|
|
70
|
+
getSession(appId: string, sid: string): Promise<ISession>;
|
|
71
|
+
}
|
|
72
|
+
export * from './model';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface IBaseModel {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
baseModelName: string;
|
|
5
|
+
maxModelLength: number;
|
|
6
|
+
}
|
|
7
|
+
export interface IUploadTicket {
|
|
8
|
+
minio: {
|
|
9
|
+
accessKey: string;
|
|
10
|
+
secretKey: string;
|
|
11
|
+
bucket: string;
|
|
12
|
+
expiredAt: number;
|
|
13
|
+
prefix: string;
|
|
14
|
+
endpoints: string[];
|
|
15
|
+
region: string;
|
|
16
|
+
useSSL: boolean;
|
|
17
|
+
fileKeys: string[];
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface IUploadParam {
|
|
21
|
+
files: string[];
|
|
22
|
+
isv: string;
|
|
23
|
+
knowledgeId: string;
|
|
24
|
+
}
|
|
25
|
+
export interface MinioConfig {
|
|
26
|
+
accessKey: string;
|
|
27
|
+
secretKey: string;
|
|
28
|
+
bucket: string;
|
|
29
|
+
expiredAt: number;
|
|
30
|
+
prefix: string;
|
|
31
|
+
endpoints: string[];
|
|
32
|
+
region: string;
|
|
33
|
+
useSSL: boolean;
|
|
34
|
+
fileKeys: string[];
|
|
35
|
+
}
|
|
36
|
+
export interface ISessionParams {
|
|
37
|
+
name?: string;
|
|
38
|
+
netOpen?: number;
|
|
39
|
+
}
|
|
@@ -5,7 +5,17 @@ export interface IBaseModel {
|
|
|
5
5
|
maxModelLength: number;
|
|
6
6
|
}
|
|
7
7
|
export interface IUploadTicket {
|
|
8
|
-
minio:
|
|
8
|
+
minio: {
|
|
9
|
+
accessKey: string;
|
|
10
|
+
secretKey: string;
|
|
11
|
+
bucket: string;
|
|
12
|
+
expiredAt: number;
|
|
13
|
+
prefix: string;
|
|
14
|
+
endpoints: string[];
|
|
15
|
+
region: string;
|
|
16
|
+
useSSL: boolean;
|
|
17
|
+
fileKeys: string[];
|
|
18
|
+
};
|
|
9
19
|
}
|
|
10
20
|
export interface IUploadParam {
|
|
11
21
|
files: string[];
|
|
@@ -22,8 +32,6 @@ export interface MinioConfig {
|
|
|
22
32
|
region: string;
|
|
23
33
|
useSSL: boolean;
|
|
24
34
|
fileKeys: string[];
|
|
25
|
-
pathStyle?: boolean;
|
|
26
|
-
sessionToken?: string;
|
|
27
35
|
}
|
|
28
36
|
export interface ISessionArtifact {
|
|
29
37
|
name: string;
|
|
@@ -79,6 +79,8 @@ export interface IUploadParam {
|
|
|
79
79
|
files: string[];
|
|
80
80
|
isv: string;
|
|
81
81
|
knowledgeId: string;
|
|
82
|
+
/** 1:对象可直接按地址访问,图片和其他附件都用这个值。 */
|
|
83
|
+
type?: number;
|
|
82
84
|
}
|
|
83
85
|
export interface MinioConfig {
|
|
84
86
|
accessKey: string;
|
|
@@ -298,6 +300,14 @@ export interface IRelatedQuestionApp {
|
|
|
298
300
|
includeUserQuestion?: boolean;
|
|
299
301
|
includeAiAnswer?: boolean;
|
|
300
302
|
}
|
|
303
|
+
export interface IArrangeSkill {
|
|
304
|
+
skillId: string;
|
|
305
|
+
name: string;
|
|
306
|
+
displayName?: string;
|
|
307
|
+
description?: string;
|
|
308
|
+
/** 当前已发布版本。小于 1 的条目不同步。 */
|
|
309
|
+
version?: number;
|
|
310
|
+
}
|
|
301
311
|
export interface IArrange {
|
|
302
312
|
llmModel: string;
|
|
303
313
|
prePrompt: string;
|
|
@@ -319,6 +329,25 @@ export interface IArrange {
|
|
|
319
329
|
thinkingModeOpen?: boolean;
|
|
320
330
|
thinkingTextOpen?: boolean;
|
|
321
331
|
autoGenerateSessionTitle?: boolean;
|
|
332
|
+
/** 编排绑定的平台技能。缺省或空数组表示没有技能。 */
|
|
333
|
+
skills?: IArrangeSkill[];
|
|
334
|
+
/** 编排绑定的 MCP。本地服务可以不带 funcs。 */
|
|
335
|
+
mcps?: IArrangeMcp[];
|
|
336
|
+
}
|
|
337
|
+
export interface IArrangeMcp {
|
|
338
|
+
id?: string;
|
|
339
|
+
name?: string;
|
|
340
|
+
/** 1 广场,2 自建。 */
|
|
341
|
+
type?: number;
|
|
342
|
+
/** cloud 云端,local 本地。缺省视为 cloud。 */
|
|
343
|
+
runtime?: string;
|
|
344
|
+
description?: string;
|
|
345
|
+
funcs?: IArrangeMcpFunc[];
|
|
346
|
+
}
|
|
347
|
+
export interface IArrangeMcpFunc {
|
|
348
|
+
funcId?: string;
|
|
349
|
+
funcCode?: string;
|
|
350
|
+
funcSummary?: string;
|
|
322
351
|
}
|
|
323
352
|
export interface IApplication {
|
|
324
353
|
id: string;
|