@glodon-aiot/apis 2.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.git.md +73 -0
- package/README.lib.md +135 -0
- package/dist/es/aecpilot/cosntant.mjs +5 -0
- package/dist/es/aecpilot/index.mjs +510 -0
- package/dist/es/aecpilot/model.mjs +9 -0
- package/dist/es/aecpilotui/index.mjs +607 -0
- package/dist/es/agentcliui/index.mjs +418 -0
- package/dist/es/aishop/index.mjs +97 -0
- package/dist/es/aishop/model.mjs +5 -0
- package/dist/es/auth/index.mjs +52 -0
- package/dist/es/base/index.mjs +158 -0
- package/dist/es/contralyze/index.mjs +91 -0
- package/dist/es/cvforce/index.mjs +431 -0
- package/dist/es/cvforce/model.mjs +12 -0
- package/dist/es/cvforce-datahub/index.mjs +435 -0
- package/dist/es/cvforce-datahub/model.mjs +8 -0
- package/dist/es/cvforce-modelservice/index.mjs +114 -0
- package/dist/es/cvforce-modelservice/model.mjs +4 -0
- package/dist/es/index.mjs +62 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +6 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +10 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +9 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +19 -0
- package/dist/es/panorama/index.mjs +136 -0
- package/dist/es/panorama/model.mjs +5 -0
- package/dist/es/pluginmgr/index.mjs +85 -0
- package/dist/es/user/index.mjs +193 -0
- package/dist/es/utils/fetchEventSource/fetch.mjs +112 -0
- package/dist/es/utils/fetchEventSource/parse.mjs +97 -0
- package/dist/es/utils/index.mjs +9 -0
- package/dist/lib/index.js +3 -0
- package/dist/src/aecpilot/cosntant.d.ts +8 -0
- package/dist/src/aecpilot/index.d.ts +79 -0
- package/dist/src/aecpilot/model.d.ts +350 -0
- package/dist/src/aecpilotui/index.d.ts +72 -0
- package/dist/src/aecpilotui/model.d.ts +63 -0
- package/dist/src/agentcliui/index.d.ts +72 -0
- package/dist/src/agentcliui/model.d.ts +39 -0
- package/dist/src/aishop/index.d.ts +26 -0
- package/dist/src/aishop/model.d.ts +111 -0
- package/dist/src/auth/index.d.ts +17 -0
- package/dist/src/auth/model.d.ts +24 -0
- package/dist/src/base/index.d.ts +41 -0
- package/dist/src/base/model.d.ts +20 -0
- package/dist/src/contralyze/index.d.ts +24 -0
- package/dist/src/contralyze/model.d.ts +75 -0
- package/dist/src/cvforce/index.d.ts +130 -0
- package/dist/src/cvforce/model.d.ts +519 -0
- package/dist/src/cvforce-datahub/index.d.ts +186 -0
- package/dist/src/cvforce-datahub/model.d.ts +438 -0
- package/dist/src/cvforce-modelservice/index.d.ts +23 -0
- package/dist/src/cvforce-modelservice/model.d.ts +156 -0
- package/dist/src/index.d.ts +19 -0
- package/dist/src/panorama/index.d.ts +42 -0
- package/dist/src/panorama/model.d.ts +263 -0
- package/dist/src/pluginmgr/index.d.ts +28 -0
- package/dist/src/pluginmgr/model.d.ts +48 -0
- package/dist/src/user/index.d.ts +42 -0
- package/dist/src/user/model.d.ts +247 -0
- package/dist/src/utils/fetchEventSource/fetch.d.ts +44 -0
- package/dist/src/utils/fetchEventSource/index.d.ts +1 -0
- package/dist/src/utils/fetchEventSource/parse.d.ts +36 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
var v = Object.defineProperty, S = Object.defineProperties;
|
|
2
|
+
var w = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var u = Object.getOwnPropertySymbols;
|
|
4
|
+
var A = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var f = (l, e, t) => e in l ? v(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t, y = (l, e) => {
|
|
6
|
+
for (var t in e || (e = {}))
|
|
7
|
+
A.call(e, t) && f(l, t, e[t]);
|
|
8
|
+
if (u)
|
|
9
|
+
for (var t of u(e))
|
|
10
|
+
R.call(e, t) && f(l, t, e[t]);
|
|
11
|
+
return l;
|
|
12
|
+
}, $ = (l, e) => S(l, w(e));
|
|
13
|
+
var s = (l, e, t) => new Promise((a, i) => {
|
|
14
|
+
var n = (c) => {
|
|
15
|
+
try {
|
|
16
|
+
r(t.next(c));
|
|
17
|
+
} catch (p) {
|
|
18
|
+
i(p);
|
|
19
|
+
}
|
|
20
|
+
}, h = (c) => {
|
|
21
|
+
try {
|
|
22
|
+
r(t.throw(c));
|
|
23
|
+
} catch (p) {
|
|
24
|
+
i(p);
|
|
25
|
+
}
|
|
26
|
+
}, r = (c) => c.done ? a(c.value) : Promise.resolve(c.value).then(n, h);
|
|
27
|
+
r((t = t.apply(l, e)).next());
|
|
28
|
+
});
|
|
29
|
+
import T from "axios";
|
|
30
|
+
import { BaseApi as K } from "../base/index.mjs";
|
|
31
|
+
import { initMinio as k, putObjectBuffer as P } from "@glodon-aiot/minio";
|
|
32
|
+
import { IHistoryRole as F, AecKnowledgeFileStatus as I } from "../aecpilot/model.mjs";
|
|
33
|
+
import { fetchEventSource as M } from "../utils/fetchEventSource/fetch.mjs";
|
|
34
|
+
import b from "dayjs";
|
|
35
|
+
import { Buffer as B } from "buffer";
|
|
36
|
+
import { PROMPT_SEARCH_MAX_LENGTH as E } from "../aecpilot/cosntant.mjs";
|
|
37
|
+
import H from "../node_modules/uuid/dist/esm-browser/v4.mjs";
|
|
38
|
+
window.Buffer = B;
|
|
39
|
+
class x extends K {
|
|
40
|
+
constructor(e, t, a) {
|
|
41
|
+
super(e != null ? e : T.create(), a), this.axiosInstance = e, this.getToken = t;
|
|
42
|
+
}
|
|
43
|
+
getApplicationIdSessions(e) {
|
|
44
|
+
return s(this, null, function* () {
|
|
45
|
+
return this.get(`/data/v1/application/${e}/session`);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
getApplicationId(e) {
|
|
49
|
+
return s(this, null, function* () {
|
|
50
|
+
return this.get(`/data/v1/applications/${e}`);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
postApplicationIdSession(e) {
|
|
54
|
+
return s(this, null, function* () {
|
|
55
|
+
return this.post(`/data/v1/application/${e.applicationId}/sessions`, e);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
getApplicationIdSessionsId(e, t) {
|
|
59
|
+
return s(this, null, function* () {
|
|
60
|
+
return this.get(`/data/v1/application/${e}/sessions/${t}`);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
patchApplicationIdSessionsId(e, t, a) {
|
|
64
|
+
return s(this, null, function* () {
|
|
65
|
+
return this.patch(`/data/v1/application/${e}/sessions/${t}`, a);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
patchApplicationIdSessionsIdContext(e, t) {
|
|
69
|
+
return s(this, null, function* () {
|
|
70
|
+
return this.patch(`/data/v1/application/${e}/sessions/${t}/context`, {});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
delApplicationIdSessionsId(e, t) {
|
|
74
|
+
return s(this, null, function* () {
|
|
75
|
+
return this.delete(`/data/v1/application/${e}/sessions/${t}`);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
postComments(e, t, a) {
|
|
79
|
+
return s(this, null, function* () {
|
|
80
|
+
return this.post(`/data/v1/application/${e}/sessions/${t}/comments`, a);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
getChatHistorySessionId(e, t) {
|
|
84
|
+
return s(this, null, function* () {
|
|
85
|
+
return this.get(`/data/v1/application/${e}/chatHistory/${t}`);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
postChatV2EventSource(e, t, a, i, n, h) {
|
|
89
|
+
return s(this, null, function* () {
|
|
90
|
+
const r = {
|
|
91
|
+
code: 0,
|
|
92
|
+
messageId: H(),
|
|
93
|
+
content: "",
|
|
94
|
+
role: F.Robot,
|
|
95
|
+
sessionId: "",
|
|
96
|
+
reference: [],
|
|
97
|
+
searchReference: [],
|
|
98
|
+
messageTime: "",
|
|
99
|
+
llmModel: "",
|
|
100
|
+
comment: {
|
|
101
|
+
isAgree: 0
|
|
102
|
+
},
|
|
103
|
+
isReplying: !1
|
|
104
|
+
}, c = yield this.getToken(), p = $(y({}, a), {
|
|
105
|
+
stream: !0
|
|
106
|
+
});
|
|
107
|
+
M(`https://aiot-dev.glodon.com/api/cvforcepd/chat/v2/chat?applicationId=${e}&sessionId=${t}`, {
|
|
108
|
+
method: "POST",
|
|
109
|
+
headers: {
|
|
110
|
+
Authorization: `Bearer ${c}`,
|
|
111
|
+
"Content-Type": "application/json"
|
|
112
|
+
},
|
|
113
|
+
body: JSON.stringify(p),
|
|
114
|
+
openWhenHidden: !0,
|
|
115
|
+
signal: i,
|
|
116
|
+
onopen(d) {
|
|
117
|
+
return console.log("onopen"), d.ok && n != null && n.onopen && n.onopen(), Promise.resolve();
|
|
118
|
+
},
|
|
119
|
+
onmessage(d) {
|
|
120
|
+
if (!d.data.includes('{"code": ')) {
|
|
121
|
+
let o = {};
|
|
122
|
+
try {
|
|
123
|
+
o = JSON.parse(d.data);
|
|
124
|
+
} catch (V) {
|
|
125
|
+
}
|
|
126
|
+
(o == null ? void 0 : o.mtype) === "search" ? r.searchReference.push(o) : r.content = r.content + d.data;
|
|
127
|
+
const g = {
|
|
128
|
+
content: r.content,
|
|
129
|
+
role: 1,
|
|
130
|
+
reference: r.reference,
|
|
131
|
+
searchReference: r.searchReference,
|
|
132
|
+
messageId: r.messageId,
|
|
133
|
+
sessionId: t,
|
|
134
|
+
messageTime: b(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
|
135
|
+
comment: {
|
|
136
|
+
isAgree: 0
|
|
137
|
+
},
|
|
138
|
+
isReplying: !0
|
|
139
|
+
};
|
|
140
|
+
return (n == null ? void 0 : n.onmessage) && n.onmessage(g);
|
|
141
|
+
}
|
|
142
|
+
const m = JSON.parse(d.data);
|
|
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
|
+
const o = {
|
|
145
|
+
code: r.code,
|
|
146
|
+
content: r.content,
|
|
147
|
+
role: 1,
|
|
148
|
+
reference: r.reference,
|
|
149
|
+
searchReference: r.searchReference,
|
|
150
|
+
messageId: r.messageId,
|
|
151
|
+
sessionId: t,
|
|
152
|
+
messageTime: r.messageTime,
|
|
153
|
+
isReplying: !0
|
|
154
|
+
};
|
|
155
|
+
n != null && n.onmessage && n.onmessage(o);
|
|
156
|
+
} else
|
|
157
|
+
return h && h({
|
|
158
|
+
code: m.code,
|
|
159
|
+
message: m.message
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
onerror() {
|
|
163
|
+
n != null && n.onerror && n.onerror();
|
|
164
|
+
},
|
|
165
|
+
onclose() {
|
|
166
|
+
const d = {
|
|
167
|
+
code: r.code,
|
|
168
|
+
content: r.content,
|
|
169
|
+
role: 1,
|
|
170
|
+
reference: r.reference,
|
|
171
|
+
searchReference: r.searchReference,
|
|
172
|
+
messageId: r.messageId,
|
|
173
|
+
sessionId: t,
|
|
174
|
+
messageTime: r.messageTime,
|
|
175
|
+
comment: {
|
|
176
|
+
isAgree: 0
|
|
177
|
+
},
|
|
178
|
+
isReplying: !1
|
|
179
|
+
};
|
|
180
|
+
n != null && n.onclose && n.onclose(d);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
getKnowledgeIdFileIdData(e, t, a) {
|
|
186
|
+
return s(this, null, function* () {
|
|
187
|
+
return this.get(`/data/v1/knowledge/${e}/file/${t}/data/${a}`);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
getKnowledgeIdFileId(e, t) {
|
|
191
|
+
return s(this, null, function* () {
|
|
192
|
+
return this.get(`/data/v1/knowledge/${e}/file/${t}`);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
getKnowledgeId(e) {
|
|
196
|
+
return s(this, null, function* () {
|
|
197
|
+
return this.get(`/data/v1/knowledge/${e}`);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
getSessionKnowledgeFile(e, t) {
|
|
201
|
+
return s(this, null, function* () {
|
|
202
|
+
return this.get(`/data/v1/chatSession/${e}/file/${t}`);
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
sleep(e) {
|
|
206
|
+
return s(this, null, function* () {
|
|
207
|
+
return new Promise((t) => {
|
|
208
|
+
setTimeout(() => {
|
|
209
|
+
t("");
|
|
210
|
+
}, e);
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
getBaseModelInfo(e) {
|
|
215
|
+
return s(this, null, function* () {
|
|
216
|
+
return this.get("/data/v1/baseModelInfo", {
|
|
217
|
+
serviceId: e
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
uploadFiles(e, t) {
|
|
222
|
+
return s(this, null, function* () {
|
|
223
|
+
const a = {
|
|
224
|
+
files: t.map((i) => i.name),
|
|
225
|
+
isv: "minio",
|
|
226
|
+
knowledgeId: e
|
|
227
|
+
};
|
|
228
|
+
return this.postTicket(a).then((i) => Promise.all(t.map((n) => this.uploadMinioFile(i.minio, n)))).catch((i) => {
|
|
229
|
+
throw Error(i);
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
postFile(e, t, a) {
|
|
234
|
+
return s(this, null, function* () {
|
|
235
|
+
const i = {
|
|
236
|
+
files: [t.name],
|
|
237
|
+
isv: "minio",
|
|
238
|
+
knowledgeId: e,
|
|
239
|
+
type: a
|
|
240
|
+
};
|
|
241
|
+
return this.postTicket(i).then((n) => this.uploadMinioFile(n.minio, t)).catch((n) => {
|
|
242
|
+
throw Error(n);
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
postTicket(e) {
|
|
247
|
+
return s(this, null, function* () {
|
|
248
|
+
return this.post("/data/v1/ticket", e);
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
uploadFile(e, t) {
|
|
252
|
+
return s(this, null, function* () {
|
|
253
|
+
const a = {
|
|
254
|
+
files: [t.name],
|
|
255
|
+
isv: "minio",
|
|
256
|
+
knowledgeId: e
|
|
257
|
+
};
|
|
258
|
+
return this.postTicket(a).then((i) => this.uploadMinioFile(i.minio, t)).catch((i) => {
|
|
259
|
+
throw Error(i);
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
// async postUploadTicket(params: IUploadParam) {
|
|
264
|
+
// return this.post<IUploadTicket>(`/data/v1/upload/ticket`, params);
|
|
265
|
+
// }
|
|
266
|
+
uploadMinioFile(e, t) {
|
|
267
|
+
return s(this, null, function* () {
|
|
268
|
+
return new Promise((a, i) => {
|
|
269
|
+
const n = new FileReader();
|
|
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 = {
|
|
278
|
+
"Content-Type": "application/octet-stream"
|
|
279
|
+
};
|
|
280
|
+
P(e.bucket, e.fileKeys[0], r, c, (p) => {
|
|
281
|
+
if (p)
|
|
282
|
+
throw console.error(p), Error(p);
|
|
283
|
+
a(e.fileKeys[0]);
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
getRecommendQues(e) {
|
|
290
|
+
return s(this, null, function* () {
|
|
291
|
+
return this.get(`/data/v1/application/${e}/recommendQues`);
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
//常用提示词
|
|
295
|
+
postPrompts(e, t) {
|
|
296
|
+
return s(this, null, function* () {
|
|
297
|
+
return this.post(`/data/v1/application/${e}/prompts`, t);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
listPrompt(e, t) {
|
|
301
|
+
return s(this, null, function* () {
|
|
302
|
+
return t != null && t.title && t.title.length > E ? [] : this.get(`/data/v1/application/${e}/prompts`, t);
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
getPrompt(e, t) {
|
|
306
|
+
return s(this, null, function* () {
|
|
307
|
+
return this.get(`/data/v1/application/${e}/prompts/${t}`);
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
updatePrompt(e, t, a) {
|
|
311
|
+
return s(this, null, function* () {
|
|
312
|
+
return this.put(`/data/v1/application/${e}/prompts/${t}`, a);
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
deletePrompt(e, t) {
|
|
316
|
+
return s(this, null, function* () {
|
|
317
|
+
return this.delete(`/data/v1/application/${e}/prompts/${t}`);
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
postGeneques(e, t) {
|
|
321
|
+
return s(this, null, function* () {
|
|
322
|
+
return this.post("/data/v1/geneques", e, {}, t);
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
getApplicationIdSessionKnowledgeFiles(e, t, a) {
|
|
326
|
+
return s(this, null, function* () {
|
|
327
|
+
return this.get(`/data/v1/application/${e}/session/${t}/file`, a);
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
checkFileReady(e, t, a, i = () => !0, n = 1e4, h) {
|
|
331
|
+
return s(this, null, function* () {
|
|
332
|
+
return new Promise((r, c) => {
|
|
333
|
+
const p = () => {
|
|
334
|
+
if (!i()) {
|
|
335
|
+
clearInterval(d);
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
a ? this.getApplicationIdSessionKnowledgeFileId(e, t, a, {}, !0).then((o) => {
|
|
339
|
+
if (h == null || h(o), o.status === I.Success && (clearInterval(d), r(o)), o.status === I.Failed) {
|
|
340
|
+
clearInterval(d);
|
|
341
|
+
const g = "该文件无法读取,请上传可编辑pdf,doc,docx文档";
|
|
342
|
+
c(Error(g, {
|
|
343
|
+
cause: {
|
|
344
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
345
|
+
// @ts-ignore
|
|
346
|
+
code: -101,
|
|
347
|
+
message: g,
|
|
348
|
+
data: o
|
|
349
|
+
}
|
|
350
|
+
}));
|
|
351
|
+
}
|
|
352
|
+
}).catch((o) => {
|
|
353
|
+
clearInterval(d), c(o);
|
|
354
|
+
}) : r(null);
|
|
355
|
+
}, d = setInterval(p, n);
|
|
356
|
+
p();
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
getApplicationIdSessionKnowledgeFileId(e, t, a, i, n) {
|
|
361
|
+
return s(this, null, function* () {
|
|
362
|
+
return this.get(`/data/v1/application/${e}/session/${t}/file/${a}`, i, n);
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
delApplicationIdSessionKnowledgeFileId(e, t, a) {
|
|
366
|
+
return s(this, null, function* () {
|
|
367
|
+
return this.delete(`/data/v1/application/${e}/session/${t}/file/${a}`);
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
postApplicationIdSessionKnowledgeSessionFile(e, t, a, i, n) {
|
|
371
|
+
return s(this, null, function* () {
|
|
372
|
+
return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`, a, i, n);
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
delApplicationIdSessionKnowledgeFile(e, t, a) {
|
|
376
|
+
return s(this, null, function* () {
|
|
377
|
+
return this.delete(`/data/v1/application/${e}/session/${t}/file`, a);
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
deleteSessionKnowledgeFiles(e, t) {
|
|
381
|
+
return s(this, null, function* () {
|
|
382
|
+
return this.delete(`/data/v1/chatSession/${e}/file`, t);
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
patchApplicationIdKnowledgeIdFileId(e, t, a, i) {
|
|
386
|
+
return s(this, null, function* () {
|
|
387
|
+
return this.patch(`/data/v1/application/${e}/session/${t}/file/${a}`, i);
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
getApplicationIdSessionIdPromptVariables(e, t) {
|
|
391
|
+
return s(this, null, function* () {
|
|
392
|
+
return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`);
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
getApplicationIdPromptVariables(e, t) {
|
|
396
|
+
return s(this, null, function* () {
|
|
397
|
+
return this.get(`/data/v1/application/${e}/promptVariables`, t);
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
patchApplicationIdSessionpromptVariablesId(e, t, a, i) {
|
|
401
|
+
return s(this, null, function* () {
|
|
402
|
+
return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${a}`, i);
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
updateSession(e, t, a) {
|
|
406
|
+
return s(this, null, function* () {
|
|
407
|
+
return this.patch(`/data/v1/application/${e}/sessions/${t}`, a);
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
getSession(e, t) {
|
|
411
|
+
return s(this, null, function* () {
|
|
412
|
+
return this.get(`/data/v1/application/${e}/sessions/${t}`);
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
export {
|
|
417
|
+
x as AgentClientUIApi
|
|
418
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
var o = (h, t, e) => new Promise((i, r) => {
|
|
2
|
+
var n = (s) => {
|
|
3
|
+
try {
|
|
4
|
+
c(e.next(s));
|
|
5
|
+
} catch (a) {
|
|
6
|
+
r(a);
|
|
7
|
+
}
|
|
8
|
+
}, m = (s) => {
|
|
9
|
+
try {
|
|
10
|
+
c(e.throw(s));
|
|
11
|
+
} catch (a) {
|
|
12
|
+
r(a);
|
|
13
|
+
}
|
|
14
|
+
}, c = (s) => s.done ? i(s.value) : Promise.resolve(s.value).then(n, m);
|
|
15
|
+
c((e = e.apply(h, t)).next());
|
|
16
|
+
});
|
|
17
|
+
import p from "axios";
|
|
18
|
+
import { ImodelStoreEnum as u } from "../cvforce-modelservice/model.mjs";
|
|
19
|
+
import { BaseApi as d } from "../base/index.mjs";
|
|
20
|
+
class f extends d {
|
|
21
|
+
constructor(t, e) {
|
|
22
|
+
super(t != null ? t : p.create(), e);
|
|
23
|
+
}
|
|
24
|
+
//之前用的接口,处理单个逻辑(兼容不同传参和响应格式)
|
|
25
|
+
ocr(t, e) {
|
|
26
|
+
return o(this, null, function* () {
|
|
27
|
+
if (e.modelStore === u.pvc) {
|
|
28
|
+
const i = this.convertToBatchParams(e), r = yield this.ocrPvcBatch(t, i);
|
|
29
|
+
return this.convertToMinioResult(r);
|
|
30
|
+
} else
|
|
31
|
+
return this.ocrMinio(t, e);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
convertToBatchParams(t) {
|
|
35
|
+
return {
|
|
36
|
+
pages: [{
|
|
37
|
+
image: t.image
|
|
38
|
+
}]
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
convertToMinioResult(t) {
|
|
42
|
+
var e;
|
|
43
|
+
return (e = t.pages) == null ? void 0 : e.flatMap((i) => {
|
|
44
|
+
var r;
|
|
45
|
+
return ((r = i.textItems) == null ? void 0 : r.map((n) => ({
|
|
46
|
+
box: n.bbox
|
|
47
|
+
}))) || [];
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//旧接口minio,处理单个逻辑
|
|
51
|
+
ocrMinio(t, e) {
|
|
52
|
+
return o(this, null, function* () {
|
|
53
|
+
return e.image && e.image.split("base64,").length > 1 && (e.image = e.image.split("base64,")[1]), this.post(`/v2/infer?serviceId=${t}`, e);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//新接口pvc,处理批量逻辑
|
|
57
|
+
ocrPvcBatch(t, e) {
|
|
58
|
+
return o(this, null, function* () {
|
|
59
|
+
return this.post(`/v2/infer?serviceId=${t}`, e);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
// 接口延迟
|
|
63
|
+
getSleep(t) {
|
|
64
|
+
return o(this, null, function* () {
|
|
65
|
+
return new Promise((e) => {
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
e(!0);
|
|
68
|
+
}, t * 1e3);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
postChatCompletions(t) {
|
|
73
|
+
return o(this, null, function* () {
|
|
74
|
+
return this.postNonStandard("/v1/chat/completions", t);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
detection(t, e) {
|
|
78
|
+
return o(this, null, function* () {
|
|
79
|
+
return this.post(`/v2/infer?serviceId=${t}`, e);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
getBaseModel(t) {
|
|
83
|
+
return o(this, null, function* () {
|
|
84
|
+
return this.get("/v1/baseModel", {
|
|
85
|
+
serviceId: t
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
postEmbeddings(t) {
|
|
90
|
+
return o(this, null, function* () {
|
|
91
|
+
return this.postNonStandard("/v1/embeddings", t);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
f as AIShopApi
|
|
97
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var a = /* @__PURE__ */ ((s) => (s.common = "A100", s.idcard = "A104", s.bankcard = "A108", s.page = "A112", s.rmwatermark = "A115", s.seal = "A116", s.rmseal = "A117", s.table = "A118", s))(a || {}), t = /* @__PURE__ */ ((s) => (s.User = "user", s.Assistant = "assistant", s.System = "system", s))(t || {});
|
|
2
|
+
export {
|
|
3
|
+
t as IChatRole,
|
|
4
|
+
a as OCRServiceId
|
|
5
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var o = (g, t, e) => new Promise((n, s) => {
|
|
2
|
+
var p = (r) => {
|
|
3
|
+
try {
|
|
4
|
+
h(e.next(r));
|
|
5
|
+
} catch (u) {
|
|
6
|
+
s(u);
|
|
7
|
+
}
|
|
8
|
+
}, i = (r) => {
|
|
9
|
+
try {
|
|
10
|
+
h(e.throw(r));
|
|
11
|
+
} catch (u) {
|
|
12
|
+
s(u);
|
|
13
|
+
}
|
|
14
|
+
}, h = (r) => r.done ? n(r.value) : Promise.resolve(r.value).then(p, i);
|
|
15
|
+
h((e = e.apply(g, t)).next());
|
|
16
|
+
});
|
|
17
|
+
import T from "axios";
|
|
18
|
+
import { BaseApi as c } from "../base/index.mjs";
|
|
19
|
+
class m extends c {
|
|
20
|
+
constructor(t, e) {
|
|
21
|
+
super(t != null ? t : T.create(), e);
|
|
22
|
+
}
|
|
23
|
+
getLoginUrl() {
|
|
24
|
+
return o(this, null, function* () {
|
|
25
|
+
return this.get("/openAddress");
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
getToken(t, e) {
|
|
29
|
+
return o(this, null, function* () {
|
|
30
|
+
return this.get(t, e);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
getAIoTTokenByGTeamToken(t) {
|
|
34
|
+
return o(this, null, function* () {
|
|
35
|
+
return this.post("/validate/glodonCloud", t).then((e) => e.accessToken);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
postRefreshToken(t, e, n, s = "3600", p) {
|
|
39
|
+
return o(this, null, function* () {
|
|
40
|
+
return this.post("/refresh-token", {
|
|
41
|
+
oldToken: t,
|
|
42
|
+
tenant: e,
|
|
43
|
+
orgId: n,
|
|
44
|
+
expired: s,
|
|
45
|
+
product: p
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
m as AuthApi
|
|
52
|
+
};
|