@glodon-aiot/apis 3.9.0-beta.9 → 3.10.0-alpha.11
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.
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var V = Object.defineProperty, I = Object.defineProperties;
|
|
2
|
+
var b = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var S = Object.getOwnPropertySymbols;
|
|
4
|
+
var D = Object.prototype.hasOwnProperty, k = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var v = (i, s, t) => s in i ? V(i, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[s] = t, y = (i, s) => {
|
|
6
6
|
for (var t in s || (s = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
var a = (
|
|
14
|
-
var
|
|
7
|
+
D.call(s, t) && v(i, t, s[t]);
|
|
8
|
+
if (S)
|
|
9
|
+
for (var t of S(s))
|
|
10
|
+
k.call(s, t) && v(i, t, s[t]);
|
|
11
|
+
return i;
|
|
12
|
+
}, g = (i, s) => I(i, b(s));
|
|
13
|
+
var a = (i, s, t) => new Promise((e, r) => {
|
|
14
|
+
var c = (l) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
} catch (
|
|
18
|
-
r(
|
|
16
|
+
d(t.next(l));
|
|
17
|
+
} catch (h) {
|
|
18
|
+
r(h);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, m = (l) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
23
|
-
} catch (
|
|
24
|
-
r(
|
|
22
|
+
d(t.throw(l));
|
|
23
|
+
} catch (h) {
|
|
24
|
+
r(h);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, d = (l) => l.done ? e(l.value) : Promise.resolve(l.value).then(c, m);
|
|
27
|
+
d((t = t.apply(i, s)).next());
|
|
28
28
|
});
|
|
29
29
|
import L from "axios";
|
|
30
|
-
import { UploadZipsStatus as
|
|
31
|
-
import { GenerateStatus as A, IDatasetLevel as
|
|
32
|
-
import { BaseApi as
|
|
30
|
+
import { UploadZipsStatus as o } from "./model.mjs";
|
|
31
|
+
import { GenerateStatus as A, IDatasetLevel as O, PreLabelTaskStatus as z, SubsectionStatus as N } from "./model.mjs";
|
|
32
|
+
import { BaseApi as R } from "../base/index.mjs";
|
|
33
33
|
import { getUuid as T } from "../utils/index.mjs";
|
|
34
|
-
class
|
|
34
|
+
class M extends R {
|
|
35
35
|
constructor(s, t) {
|
|
36
36
|
super(s != null ? s : L.create(), t);
|
|
37
37
|
}
|
|
@@ -138,9 +138,9 @@ class x extends k {
|
|
|
138
138
|
}
|
|
139
139
|
getDatasetsIdVersionsVidSsamplesSid(s, t, e) {
|
|
140
140
|
return a(this, null, function* () {
|
|
141
|
-
return this.get(`/datasets/${s}/versions/${t}/samples/${e}`).then((r) => y(
|
|
142
|
-
labels: r.labels ? r.labels.map((
|
|
143
|
-
uuid:
|
|
141
|
+
return this.get(`/datasets/${s}/versions/${t}/samples/${e}`).then((r) => g(y({}, r), {
|
|
142
|
+
labels: r.labels ? r.labels.map((c) => g(y({}, c), {
|
|
143
|
+
uuid: c.uuid || T()
|
|
144
144
|
})) : []
|
|
145
145
|
}));
|
|
146
146
|
});
|
|
@@ -252,9 +252,9 @@ class x extends k {
|
|
|
252
252
|
return this.post(`/datasets/${s}/versions/${t}/llmSamples/${e}/subsection`, r);
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
|
-
updateSubsection(s, t, e, r,
|
|
255
|
+
updateSubsection(s, t, e, r, c) {
|
|
256
256
|
return a(this, null, function* () {
|
|
257
|
-
return this.patch(`/datasets/${s}/versions/${t}/llmSamples/${e}/subsection/${r}`,
|
|
257
|
+
return this.patch(`/datasets/${s}/versions/${t}/llmSamples/${e}/subsection/${r}`, c);
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
260
|
deleteSubsection(s, t, e, r) {
|
|
@@ -344,33 +344,58 @@ class x extends k {
|
|
|
344
344
|
return this.post(`/datasets/${s}/versions/${t}/uploadzip`, e);
|
|
345
345
|
});
|
|
346
346
|
}
|
|
347
|
-
|
|
347
|
+
postVlmUploadPicsZip(s, t, e) {
|
|
348
348
|
return a(this, null, function* () {
|
|
349
|
-
return
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
349
|
+
return this.post(`/datasets/${s}/versions/${t}/vlmuploadzip`, e);
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
checkFileResult(s, t, e, r = 1e3, c, m) {
|
|
353
|
+
return a(this, null, function* () {
|
|
354
|
+
return new Promise((d, l) => {
|
|
355
|
+
const h = () => {
|
|
356
|
+
s ? c === "vlm" ? this.getUploadVlmPicsZipResult(s, t, e).then(($) => {
|
|
357
|
+
const n = $[0];
|
|
358
|
+
if (n.state === o.Started || n.state === o.Pending) {
|
|
359
|
+
const p = n.process || 0;
|
|
360
|
+
m && m(p);
|
|
356
361
|
}
|
|
357
|
-
if (
|
|
358
|
-
clearInterval(
|
|
359
|
-
const
|
|
360
|
-
|
|
362
|
+
if (n.state === o.Success && (clearInterval(u), d(n.lastTaskResult)), n.state === o.Failure) {
|
|
363
|
+
clearInterval(u);
|
|
364
|
+
const p = "该文件处理失败";
|
|
365
|
+
l(Error(p, {
|
|
361
366
|
cause: {
|
|
362
367
|
code: -101,
|
|
363
|
-
message:
|
|
364
|
-
data:
|
|
368
|
+
message: p,
|
|
369
|
+
data: n.lastTaskResult
|
|
365
370
|
}
|
|
366
371
|
}));
|
|
367
372
|
}
|
|
368
|
-
|
|
369
|
-
}).catch((
|
|
370
|
-
clearInterval(
|
|
371
|
-
}) :
|
|
372
|
-
|
|
373
|
-
|
|
373
|
+
n.state === o.Abort && (clearInterval(u), d(n.lastTaskResult));
|
|
374
|
+
}).catch(($) => {
|
|
375
|
+
clearInterval(u), l($);
|
|
376
|
+
}) : this.getUploadPicsZipResult(s, t, e).then(($) => {
|
|
377
|
+
const n = $[0];
|
|
378
|
+
if (n.state === o.Started || n.state === o.Pending) {
|
|
379
|
+
const p = n.process || 0;
|
|
380
|
+
m && m(p);
|
|
381
|
+
}
|
|
382
|
+
if (n.state === o.Success && (clearInterval(u), d(n.lastTaskResult)), n.state === o.Failure) {
|
|
383
|
+
clearInterval(u);
|
|
384
|
+
const p = "该文件处理失败";
|
|
385
|
+
l(Error(p, {
|
|
386
|
+
cause: {
|
|
387
|
+
code: -101,
|
|
388
|
+
message: p,
|
|
389
|
+
data: n.lastTaskResult
|
|
390
|
+
}
|
|
391
|
+
}));
|
|
392
|
+
}
|
|
393
|
+
n.state === o.Abort && (clearInterval(u), d(n.lastTaskResult));
|
|
394
|
+
}).catch(($) => {
|
|
395
|
+
clearInterval(u), l($);
|
|
396
|
+
}) : d(null);
|
|
397
|
+
}, u = setInterval(h, r);
|
|
398
|
+
h();
|
|
374
399
|
});
|
|
375
400
|
});
|
|
376
401
|
}
|
|
@@ -379,6 +404,11 @@ class x extends k {
|
|
|
379
404
|
return this.get(`/datasets/${s}/versions/${t}/uploadzip`, e);
|
|
380
405
|
});
|
|
381
406
|
}
|
|
407
|
+
getUploadVlmPicsZipResult(s, t, e) {
|
|
408
|
+
return a(this, null, function* () {
|
|
409
|
+
return this.get(`/datasets/${s}/versions/${t}/vlmuploadzip`, e);
|
|
410
|
+
});
|
|
411
|
+
}
|
|
382
412
|
getUploadabort(s, t, e) {
|
|
383
413
|
return a(this, null, function* () {
|
|
384
414
|
return this.get(`/datasets/${s}/versions/${t}/uploadabort`, e);
|
|
@@ -420,12 +450,27 @@ class x extends k {
|
|
|
420
450
|
return this.delete(`/datasets/${s}/versions/${t}/copyDataset`, e);
|
|
421
451
|
});
|
|
422
452
|
}
|
|
453
|
+
getDatasetsIdVersionsVidConfigs(s, t) {
|
|
454
|
+
return a(this, null, function* () {
|
|
455
|
+
return this.get(`/datasets/${s}/versions/${t}/labels`);
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
saveVisionLabelConfigs(s, t, e) {
|
|
459
|
+
return a(this, null, function* () {
|
|
460
|
+
return this.patch(`/datasets/${s}/versions/${t}/labels`, e);
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
postGenerateVlmKieQa(s, t, e) {
|
|
464
|
+
return a(this, null, function* () {
|
|
465
|
+
return this.post(`/datasets/${s}/versions/${t}/samples/generator/vlm_kie_qa`, e);
|
|
466
|
+
});
|
|
467
|
+
}
|
|
423
468
|
}
|
|
424
469
|
export {
|
|
425
|
-
|
|
470
|
+
M as CVForceDatahubApi,
|
|
426
471
|
A as GenerateStatus,
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
472
|
+
O as IDatasetLevel,
|
|
473
|
+
z as PreLabelTaskStatus,
|
|
474
|
+
N as SubsectionStatus,
|
|
475
|
+
o as UploadZipsStatus
|
|
431
476
|
};
|
package/dist/lib/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var ve=Object.defineProperty,Se=Object.defineProperties;var we=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var N=(n,e,t)=>e in n?ve(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,y=(n,e)=>{for(var t in e||(e={}))H.call(e,t)&&N(n,t,e[t]);if(M)for(var t of M(e))O.call(e,t)&&N(n,t,e[t]);return n},S=(n,e)=>Se(n,we(e));var W=(n,e)=>{var t={};for(var r in n)H.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&&O.call(n,r)&&(t[r]=n[r]);return t};var s=(n,e,t)=>new Promise((r,a)=>{var i=h=>{try{l(t.next(h))}catch(d){a(d)}},o=h=>{try{l(t.throw(h))}catch(d){a(d)}},l=h=>h.done?r(h.value):Promise.resolve(h.value).then(i,o);l((t=t.apply(n,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("axios"),I=require("@glodon-aiot/minio"),F=require("uuid"),C=require("dayjs"),U=require("buffer");class m{constructor(e,t){this.axios=e,this.errorHandler=t}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 l,h;const o=yield this.axios.post(e,t,y({params:r},a));if(o.status===200)if((l=o.data)!=null&&l.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,J(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 q=n=>n>=10002&&n<=10012,J=(n,e)=>q(n)?"数据操作错误":e||"未知接口错误";class ke extends m{constructor(e,t){super(e!=null?e:f.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 Ie extends m{constructor(e,t){super(e!=null?e:f.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}`)})}}var 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||{}),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||{});class Ae extends m{constructor(e,t){super(e!=null?e:f.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 Te extends m{constructor(e,t){super(e!=null?e:f.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=>S(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 z=(n=>(n[n.None=0]="None",n[n.SourceFile=1]="SourceFile",n[n.WebLink=2]="WebLink",n))(z||{}),G=(n=>(n.Unprotected="不受著作权保护",n.ProtectAuthorize="受著作权保护,已获得授权",n.ProtectUnauthorize="受著作权保护,未获得授权",n))(G||{}),b=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(b||{}),X=(n=>(n.Start="start",n.End="end",n))(X||{}),A=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(A||{}),Z=(n=>(n.AECPILOT="aecpilot",n))(Z||{});function be(n,e){return s(this,null,function*(){const t=n.getReader();let r;for(;!(r=yield t.read()).done;)e(r.value)})}function Pe(n){let e,t,r,a=!1,i;return function(l){e===void 0?(e=l,t=0,r=-1,i=!1):e=Me(e,l);const h=e.length;let d=0;for(;t<h;){a&&(e[t]===10&&(d=++t),a=!1);let p=-1;for(;t<h&&p===-1;++t)switch(e[t]){case 58:r===-1&&(r=t-d);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:p=t;break}if(p===-1)break;n(e.subarray(d,p),r,i),d=t,r=-1,i=!1}d===h?e=void 0:d!==0&&(e=e.subarray(d),t-=d)}}function Re(n,e,t){let r=_();const a=new TextDecoder;return function(o,l,h){if(o.length===0)t==null||t(r),r=_();else if(l>0){const d=a.decode(o.subarray(0,l)),p=l+(o[l+1]===32?2:1);let c=a.decode(o.subarray(p));switch(h&&(c+=`
|
|
2
|
-
`),
|
|
3
|
-
`+c:c;break;case"event":r.event=c;break;case"id":n(r.id=c);break;case"retry":const u=parseInt(c,10);isNaN(u)||e(r.retry=u);break}}}}function Me(n,e){const t=new Uint8Array(n.length+e.length);return t.set(n),t.set(e,n.length),t}function _(){return{data:"",event:"",id:"",retry:void 0}}const x="text/event-stream",Fe=1e3,Q="last-event-id";function V(n,p){var c=p,{signal:e,headers:t,onopen:r,onmessage:a,onclose:i,onerror:o,openWhenHidden:l,fetch:h}=c,d=W(c,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((u,g)=>{const v=y({},t);v.accept||(v.accept=x);let $;function w(){$.abort(),document.hidden||L()}l||document.addEventListener("visibilitychange",w);let P=Fe,K=0;function E(){document.removeEventListener("visibilitychange",w),window.clearTimeout(K),$.abort()}e==null||e.addEventListener("abort",()=>{E(),u()});const $e=h!=null?h:window.fetch,fe=r!=null?r:Ve;function L(){return s(this,null,function*(){var B;$=new AbortController;try{const R=yield $e(n,S(y({},d),{headers:v,signal:$.signal}));yield fe(R),yield be(R.body,Pe(Re(k=>{k?v[Q]=k:delete v[Q]},k=>{P=k},a))),i==null||i(),E(),u()}catch(R){if(!$.signal.aborted)try{const k=(B=o==null?void 0:o(R))!=null?B:P;window.clearTimeout(K),K=window.setTimeout(L,k)}catch(k){E(),g(k)}}})}L()})}function Ve(n){const e=n.headers.get("content-type");if(!(e!=null&&e.startsWith(x)))throw new Error(`Expected content-type to be ${x}, Actual: ${e}`)}const D=128,De=20;class Ke extends m{constructor(e,t,r){super(e!=null?e:f.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=>{I.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const l=new Uint8Array(o.target.result),h={"Content-Type":"application/octet-stream"};I.putObjectBuffer(e.bucket,e.fileKeys[0],l,h,d=>{if(d)throw console.error(d),Error(d);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,l)=>{const h=()=>{if(!r()){clearInterval(d);return}t?this.getSessionKnowledgeFile(e,t).then(c=>{if(i==null||i(c),c.status===A.Success&&(clearInterval(d),o(c)),c.status===A.Failed){clearInterval(d);const u="该文件无法读取,请上传可编辑pdf,doc,docx文档";l(Error(u,{cause:{code:-101,message:u,data:c}}))}}).catch(c=>{clearInterval(d),l(c)}):o(null)},d=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(),l=S(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(l),openWhenHidden:!0,signal:r,onopen(d){return d.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(d){if(!d.data&&!d.event&&!d.id&&!d.retry)return;if(!d.data.includes('{"code": ')){let c={};try{c=JSON.parse(d.data)}catch(g){}(c==null?void 0:c.mtype)==="search"?i.searchReference.push(c):i.content=i.content+d.data;const u={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(u)}const p=JSON.parse(d.data);if(i.reference=p.data.reference,i.messageTime=p.data.messageTime,i.messageId=p.data.messageId,i.llmModel=p.data.llmModel,i.code=p.code,p.code===200){const c={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(c)}},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const d={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(d)}})})}postChatV3EventSource(e,t,r,a){return s(this,null,function*(){var h,d;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(),l=S(y({},t),{stream:!0});V(`${(d=(h=this.axiosInstance)==null?void 0:h.defaults.baseURL)==null?void 0:d.replace("/v1","/v3")}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(l),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;let c={};try{c=JSON.parse(p.data)}catch($){console.log("eventData",p.data)}const u=c.data.type,g=c.data.payload;i.isReplying=!0,u==="error"&&(i.code=c.code,i.message=c.message);const v=()=>{if(!i.searchingStatus){i.searchingStatus="start";return}if(i.searchingStatus==="start"){i.searchingStatus="end";return}};if(u==="beforeSearch"&&v(),u==="search"&&(i.code=c.code,i.message=c.message,i.searchReference.push(g)),u==="thinking"){v(),i.code=c.code,i.message=c.message,i.thinkingStatus="start";const w=g.choices[0];i.reasoningContent=i.reasoningContent+w.delta.reasoningContent}if(u==="thinkingOver"){i.code=c.code,i.message=c.message,i.thinkingStatus="end";const $=g.thinkingSecs;i.thinkingSecs=$}if(u==="text"){v(),i.code=c.code,i.message=c.message;const w=g.choices[0];i.content=i.content+w.delta.content}if(u==="reference"&&(i.code=c.code,i.message=c.message,i.reference=g),u==="result"){i.code=c.code,i.message=c.message;const $=g.messageId,w=g.llmModel,P=g.messageTime;i.messageId=$,i.llmModel=w,i.messageTime=P,i.sessionId=e}a!=null&&a.onmessage&&a.onmessage(i)},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const p=S(y({},i),{isReplying:!1});a!=null&&a.onclose&&a.onclose(p)}})})}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=U.Buffer;class Ee extends m{constructor(e,t,r){super(e!=null?e:f.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 l={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},h=yield this.getToken(),d=S(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(d),openWhenHidden:!0,signal:a,onopen(p){return p.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(p){if(!p.data.includes('{"code": ')){let u={};try{u=JSON.parse(p.data)}catch(v){}(u==null?void 0:u.mtype)==="search"?l.searchReference.push(u):l.content=l.content+p.data;const g={content:l.content,role:1,reference:l.reference,searchReference:l.searchReference,messageId:l.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 c=JSON.parse(p.data);if(l.reference=c.data.reference,l.searchReference=c.data.searchReference,l.messageTime=c.data.messageTime,l.messageId=c.data.messageId,l.llmModel=c.data.llmModel,l.content=c.data.content,l.code=c.code,c.code===200){const u={code:l.code,content:l.content,role:1,reference:l.reference,searchReference:l.searchReference,messageId:l.messageId,sessionId:t,messageTime:l.messageTime,isReplying:!0};i!=null&&i.onmessage&&i.onmessage(u)}else return o&&o({code:c.code,message:c.message})},onerror(){i!=null&&i.onerror&&i.onerror()},onclose(){const p={code:l.code,content:l.content,role:1,reference:l.reference,searchReference:l.searchReference,messageId:l.messageId,sessionId:t,messageTime:l.messageTime,comment:{isAgree:0},isReplying:!1};i!=null&&i.onclose&&i.onclose(p)}})})}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=>{I.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const l=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};I.putObjectBuffer(e.bucket,e.fileKeys[0],l,h,d=>{if(d)throw console.error(d),Error(d);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((l,h)=>{const d=()=>{if(!a()){clearInterval(p);return}r?this.getApplicationIdSessionKnowledgeFileId(e,t,r,{},!0).then(u=>{if(o==null||o(u),u.status===A.Success&&(clearInterval(p),l(u)),u.status===A.Failed){clearInterval(p);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:u}}))}}).catch(u=>{clearInterval(p),h(u)}):l(null)},p=setInterval(d,i);d()})})}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}`)})}}globalThis.Buffer=U.Buffer;class Le extends m{constructor(e,t,r){super(e!=null?e:f.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((l,h)=>{const d=()=>{if(!a()){clearInterval(p);return}r?this.getApplicationIdSessionKnowledgeFileId(e,t,r,{},!0).then(u=>{if(o==null||o(u),u.status===A.Success&&(clearInterval(p),l(u)),u.status===A.Failed){clearInterval(p);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:u}}))}}).catch(u=>{clearInterval(p),h(u)}):l(null)},p=setInterval(d,i);d()})})}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=>{I.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const l=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};I.putObjectBuffer(e.bucket,e.fileKeys[0],l,h,d=>{if(d)throw console.error(d),Error(d);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 d;const o={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,message:""},l=yield this.getToken(),h=S(y({},r),{stream:!0});V(`${(d=this.axiosInstance)==null?void 0:d.defaults.baseURL}/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify(h),openWhenHidden:!0,signal:a,onopen(p){return p.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(p){if(!p.data&&!p.event&&!p.id&&!p.retry)return;if(!p.data.includes('{"code": ')){let u={};try{u=JSON.parse(p.data)}catch(v){}(u==null?void 0:u.mtype)==="search"?o.searchReference.push(u):o.content=o.content+p.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 c=JSON.parse(p.data);if(o.reference=c.data.reference,o.messageTime=c.data.messageTime,o.messageId=c.data.messageId,o.llmModel=c.data.llmModel,o.code=c.code,o.message=c.message,c.code===200){const u={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(u)}},onerror(){i!=null&&i.onerror&&i.onerror()},onclose(){const p={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(p)}})})}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 ee=(n=>(n[n.Dialog=0]="Dialog",n[n.TextGenerate=1]="TextGenerate",n[n.FileSummery=2]="FileSummery",n))(ee||{}),te=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(te||{}),se=(n=>(n[n.Processing=1]="Processing",n[n.Done=2]="Done",n[n.Failed=3]="Failed",n))(se||{}),re=(n=>(n[n.File=0]="File",n[n.WebLink=1]="WebLink",n))(re||{}),ne=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(ne||{}),ae=(n=>(n.InputFile="ui.input.file",n.LLMModel="ui.llm.model",n))(ae||{}),ie=(n=>(n[n.Idle=0]="Idle",n[n.Quoted=1]="Quoted",n))(ie||{}),oe=(n=>(n[n.Basic=0]="Basic",n[n.Pro=1]="Pro",n))(oe||{}),ce=(n=>(n[n.Dialog=0]="Dialog",n[n.Text=1]="Text",n[n.Agent=2]="Agent",n[n.All=3]="All",n))(ce||{}),le=(n=>(n.User="instruction",n.System="settings",n))(le||{});class xe extends m{constructor(e,t){super(e!=null?e:f.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}`)})}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)})}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=>{I.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const l=U.Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};I.putObjectBuffer(e.bucket,e.fileKeys[0],l,h,d=>{if(d)throw console.error(d),Error(d);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 de=(n=>(n[n.inital=0]="inital",n[n.success=1]="success",n[n.processing=2]="processing",n[n.failed=3]="failed",n))(de||{}),pe=(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))(pe||{}),T=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Failure="FAILURE",n.Success="SUCCESS",n.Abort="ABORT",n))(T||{}),ue=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Success="SUCCESS",n.Failure="FAILURE ",n))(ue||{}),he=(n=>(n[n.all=0]="all",n[n.general=1]="general",n[n.major=2]="major",n))(he||{});function Ce(){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 Ue extends m{constructor(e,t){super(e!=null?e:f.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}`)})}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=>S(y({},a),{labels:a.labels?a.labels.map(i=>S(y({},i),{uuid:i.uuid||Ce()})):[]}))})}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)})}checkFileResult(e,t,r,a=1e3,i){return s(this,null,function*(){return new Promise((o,l)=>{const h=()=>{e?this.getUploadPicsZipResult(e,t,r).then(p=>{const c=p[0];if(c.state===T.Started||c.state===T.Pending){const u=c.process||0;i&&i(u)}if(c.state===T.Success&&(clearInterval(d),o(c.lastTaskResult)),c.state===T.Failure){clearInterval(d);const u="该文件处理失败";l(Error(u,{cause:{code:-101,message:u,data:c.lastTaskResult}}))}c.state===T.Abort&&(clearInterval(d),o(c.lastTaskResult))}).catch(p=>{clearInterval(d),l(p)}):o(null)},d=setInterval(h,a);h()})})}getUploadPicsZipResult(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/uploadzip`,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)})}}class Be extends m{constructor(e,t){super(e!=null?e:f.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 ge=(n=>(n[n.minio=0]="minio",n[n.pvc=1]="pvc",n))(ge||{}),ye=(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))(ye||{}),me=(n=>(n.User="user",n.Assistant="assistant",n.System="system",n))(me||{});class Ne extends m{constructor(e,t){super(e!=null?e:f.create(),t)}ocr(e,t){return s(this,null,function*(){if(t.modelStore===ge.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)})}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)})}}class He extends m{constructor(e,t){super(e!=null?e:f.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=Ke;exports.AIShopApi=Ne;exports.AecKnowledgeFileStatus=A;exports.AecpilotUIApi=Le;exports.ApplicationTypes=ce;exports.ArchiGptUIKeys=ae;exports.AuthApi=ke;exports.BaseApi=m;exports.BotClientApi=Ee;exports.CVForceApi=xe;exports.CVForceDatahubApi=Ue;exports.ChatMessageRole=te;exports.ChatMode=ee;exports.ContralyzeApi=He;exports.DataApi=Ie;exports.FileProccessStatus=se;exports.GenerateStatus=pe;exports.IChatRole=me;exports.IDatasetLevel=he;exports.IFileOrigin=Z;exports.IHistoryRole=b;exports.ISourceType=z;exports.ISpacetwinStatus=Y;exports.IThinkingStatus=X;exports.IversionInfo=G;exports.KnowledgeFileStatus=ne;exports.KnowledgeType=oe;exports.ModelServiceApi=Be;exports.OCRServiceId=ye;exports.PROMPT_SEARCH_MAX_LENGTH=D;exports.PROMPT_TITLE_MAX_LENGTH=De;exports.PanoramaApi=Ae;exports.PanoramaPluginMgrApi=Te;exports.PreLabelTaskStatus=ue;exports.PromptStatus=ie;exports.PromptVariableType=le;exports.RecordStatus=j;exports.SourceType=re;exports.SubsectionStatus=de;exports.UploadZipsStatus=T;exports.needPrettifyMsg=q;exports.prettifyMsg=J;
|
|
1
|
+
"use strict";var ve=Object.defineProperty,Se=Object.defineProperties;var Ie=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var N=(n,e,t)=>e in n?ve(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,y=(n,e)=>{for(var t in e||(e={}))H.call(e,t)&&N(n,t,e[t]);if(M)for(var t of M(e))O.call(e,t)&&N(n,t,e[t]);return n},I=(n,e)=>Se(n,Ie(e));var _=(n,e)=>{var t={};for(var r in n)H.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&&O.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(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,J(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 q=n=>n>=10002&&n<=10012,J=(n,e)=>q(n)?"数据操作错误":e||"未知接口错误";class ke 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 we 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}`)})}}var z=(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))(z||{}),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||{});class Ae 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 Te 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=>I(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 j=(n=>(n[n.None=0]="None",n[n.SourceFile=1]="SourceFile",n[n.WebLink=2]="WebLink",n))(j||{}),G=(n=>(n.Unprotected="不受著作权保护",n.ProtectAuthorize="受著作权保护,已获得授权",n.ProtectUnauthorize="受著作权保护,未获得授权",n))(G||{}),b=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(b||{}),X=(n=>(n.Start="start",n.End="end",n))(X||{}),T=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(T||{}),Z=(n=>(n.AECPILOT="aecpilot",n))(Z||{});function be(n,e){return s(this,null,function*(){const t=n.getReader();let r;for(;!(r=yield t.read()).done;)e(r.value)})}function Pe(n){let e,t,r,a=!1,i;return function(c){e===void 0?(e=c,t=0,r=-1,i=!1):e=Me(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 Re(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
|
+
`),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 Me(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",Fe=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 k(){$.abort(),document.hidden||U()}c||document.addEventListener("visibilitychange",k);let P=Fe,K=0;function E(){document.removeEventListener("visibilitychange",k),window.clearTimeout(K),$.abort()}e==null||e.addEventListener("abort",()=>{E(),d()});const $e=h!=null?h:window.fetch,fe=r!=null?r:Ve;function U(){return s(this,null,function*(){var B;$=new AbortController;try{const R=yield $e(n,I(y({},p),{headers:S,signal:$.signal}));yield fe(R),yield be(R.body,Pe(Re(w=>{w?S[W]=w:delete S[W]},w=>{P=w},a))),i==null||i(),E(),d()}catch(R){if(!$.signal.aborted)try{const w=(B=o==null?void 0:o(R))!=null?B:P;window.clearTimeout(K),K=window.setTimeout(U,w)}catch(w){E(),g(w)}}})}U()})}function Ve(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,De=20;class Ke 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=I(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=I(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 k=g.choices[0];i.reasoningContent=i.reasoningContent+k.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 k=g.choices[0];i.content=i.content+k.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,k=g.llmModel,P=g.messageTime;i.messageId=$,i.llmModel=k,i.messageTime=P,i.sessionId=e}a!=null&&a.onmessage&&a.onmessage(i)},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const u=I(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 Ee 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=I(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({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}`)})}}globalThis.Buffer=x.Buffer;class Ue 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=I(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 ee=(n=>(n[n.Dialog=0]="Dialog",n[n.TextGenerate=1]="TextGenerate",n[n.FileSummery=2]="FileSummery",n))(ee||{}),te=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(te||{}),se=(n=>(n[n.Processing=1]="Processing",n[n.Done=2]="Done",n[n.Failed=3]="Failed",n))(se||{}),re=(n=>(n[n.File=0]="File",n[n.WebLink=1]="WebLink",n))(re||{}),ne=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(ne||{}),ae=(n=>(n.InputFile="ui.input.file",n.LLMModel="ui.llm.model",n))(ae||{}),ie=(n=>(n[n.Idle=0]="Idle",n[n.Quoted=1]="Quoted",n))(ie||{}),oe=(n=>(n[n.Basic=0]="Basic",n[n.Pro=1]="Pro",n))(oe||{}),ce=(n=>(n[n.Dialog=0]="Dialog",n[n.Text=1]="Text",n[n.Agent=2]="Agent",n[n.All=3]="All",n))(ce||{}),le=(n=>(n.User="instruction",n.System="settings",n))(le||{});class Ce 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}`)})}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)})}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 de=(n=>(n[n.inital=0]="inital",n[n.success=1]="success",n[n.processing=2]="processing",n[n.failed=3]="failed",n))(de||{}),pe=(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))(pe||{}),f=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Failure="FAILURE",n.Success="SUCCESS",n.Abort="ABORT",n))(f||{}),ue=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Success="SUCCESS",n.Failure="FAILURE ",n))(ue||{}),he=(n=>(n[n.all=0]="all",n[n.general=1]="general",n[n.major=2]="major",n))(he||{});function Le(){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 xe 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}`)})}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=>I(y({},a),{labels:a.labels?a.labels.map(i=>I(y({},i),{uuid:i.uuid||Le()})):[]}))})}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)})}}class Be 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 ge=(n=>(n[n.minio=0]="minio",n[n.pvc=1]="pvc",n))(ge||{}),ye=(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))(ye||{}),me=(n=>(n.User="user",n.Assistant="assistant",n.System="system",n))(me||{});class Ne extends m{constructor(e,t){super(e!=null?e:v.create(),t)}ocr(e,t){return s(this,null,function*(){if(t.modelStore===ge.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)})}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)})}}class He 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=Ke;exports.AIShopApi=Ne;exports.AecKnowledgeFileStatus=T;exports.AecpilotUIApi=Ue;exports.ApplicationTypes=ce;exports.ArchiGptUIKeys=ae;exports.AuthApi=ke;exports.BaseApi=m;exports.BotClientApi=Ee;exports.CVForceApi=Ce;exports.CVForceDatahubApi=xe;exports.ChatMessageRole=te;exports.ChatMode=ee;exports.ContralyzeApi=He;exports.DataApi=we;exports.FileProccessStatus=se;exports.GenerateStatus=pe;exports.IChatRole=me;exports.IDatasetLevel=he;exports.IFileOrigin=Z;exports.IHistoryRole=b;exports.ISourceType=j;exports.ISpacetwinStatus=Y;exports.IThinkingStatus=X;exports.IversionInfo=G;exports.KnowledgeFileStatus=ne;exports.KnowledgeType=oe;exports.ModelServiceApi=Be;exports.OCRServiceId=ye;exports.PROMPT_SEARCH_MAX_LENGTH=D;exports.PROMPT_TITLE_MAX_LENGTH=De;exports.PanoramaApi=Ae;exports.PanoramaPluginMgrApi=Te;exports.PreLabelTaskStatus=ue;exports.PromptStatus=ie;exports.PromptVariableType=le;exports.RecordStatus=z;exports.SourceType=re;exports.SubsectionStatus=de;exports.UploadZipsStatus=f;exports.needPrettifyMsg=q;exports.prettifyMsg=J;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { IDataSet, IDataSetParams, IDataSetResult, IVersion, IAM, ILabel, ISample, IMarkType, IProxy, Deduplication, sampleParams, Category, ISampleTextParams, ILlmSample, ISubsectionParams, ISubsectionSample, ILlmSampleSubsection, GenerateParams, GenerateRecord, ILlmSampleV2, ILlmSampleV2ListParams, IPostLlmSampleV2, ILlmContent, ILlmSamplePostParams, Addition, ILabelList, SampleQueryParams, Label, CreateLabelParams, EditLabelParams, IPicsZipResult, IPrelabelTaskParams, IPreLabelTask, ISampleFileParams, IGetDatasetParams, IDataSetCoptTask, IDataSetCoptTaskParams } from './model';
|
|
2
|
+
import { IDataSet, IDataSetParams, IDataSetResult, IVersion, IAM, ILabel, ISample, IMarkType, IProxy, Deduplication, sampleParams, Category, ISampleTextParams, ILlmSample, ISubsectionParams, ISubsectionSample, ILlmSampleSubsection, GenerateParams, GenerateRecord, ILlmSampleV2, ILlmSampleV2ListParams, IPostLlmSampleV2, ILlmContent, ILlmSamplePostParams, Addition, ILabelList, SampleQueryParams, Label, CreateLabelParams, EditLabelParams, IPicsZipResult, IPrelabelTaskParams, IPreLabelTask, ISampleFileParams, IGetDatasetParams, IDataSetCoptTask, IDataSetCoptTaskParams, IVConfig, IVConfigsParams, IVlmKieQaResult, IVersionQaTemplate } from './model';
|
|
3
3
|
import { ApiErrorHandler, BaseApi, Paged, PageQueryParams } from '..';
|
|
4
4
|
export declare class CVForceDatahubApi extends BaseApi {
|
|
5
5
|
constructor(axiosInstance?: AxiosInstance, errorHandler?: ApiErrorHandler);
|
|
@@ -16,6 +16,7 @@ export declare class CVForceDatahubApi extends BaseApi {
|
|
|
16
16
|
postDatasetsIdVersions(id: string, params: any): Promise<any>;
|
|
17
17
|
patchDatasetsIdVersionsVid(id: string, vid: string, params: {
|
|
18
18
|
description?: string;
|
|
19
|
+
qaTemplate?: IVersionQaTemplate[];
|
|
19
20
|
}): Promise<any>;
|
|
20
21
|
getDatasetsIdVersionsVid(id: string, vid: string): Promise<IVersion>;
|
|
21
22
|
delDatasetsIdVersionsVid(id: string, vid: string): Promise<IVersion>;
|
|
@@ -25,7 +26,7 @@ export declare class CVForceDatahubApi extends BaseApi {
|
|
|
25
26
|
}): Promise<IVersion[]>;
|
|
26
27
|
listDatasetsIdLabels(id: string, params: PageQueryParams): Promise<Paged<ILabelList>>;
|
|
27
28
|
getDatasetsIdVersionsVidLabelcount(id: string, vid: string, params?: {
|
|
28
|
-
label?:
|
|
29
|
+
label?: 'allcode' | string;
|
|
29
30
|
searchName?: string;
|
|
30
31
|
}): Promise<ILabel[]>;
|
|
31
32
|
getDatasetsIdVersionsVidSamples(id: string, vid: string, params: SampleQueryParams): Promise<Paged<ISample>>;
|
|
@@ -48,6 +49,14 @@ export declare class CVForceDatahubApi extends BaseApi {
|
|
|
48
49
|
rowSpan: number;
|
|
49
50
|
colSpan: number;
|
|
50
51
|
};
|
|
52
|
+
shape?: {
|
|
53
|
+
name: string;
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
width: number;
|
|
57
|
+
height: number;
|
|
58
|
+
};
|
|
59
|
+
content?: Record<string, string>;
|
|
51
60
|
}[];
|
|
52
61
|
id: string;
|
|
53
62
|
versionId: string;
|
|
@@ -116,7 +125,7 @@ export declare class CVForceDatahubApi extends BaseApi {
|
|
|
116
125
|
postSubsection(datasetId: string, versionId: string, sampleId: string, params: {
|
|
117
126
|
content: string;
|
|
118
127
|
sectionNo: number;
|
|
119
|
-
addDirect:
|
|
128
|
+
addDirect: 'up' | 'down';
|
|
120
129
|
additionInfo?: {
|
|
121
130
|
key: string;
|
|
122
131
|
value: string;
|
|
@@ -164,12 +173,19 @@ export declare class CVForceDatahubApi extends BaseApi {
|
|
|
164
173
|
zipUrls: string[];
|
|
165
174
|
type?: number;
|
|
166
175
|
}): Promise<any>;
|
|
176
|
+
postVlmUploadPicsZip(id: string, vid: string, params: {
|
|
177
|
+
zipUrl: string;
|
|
178
|
+
type?: number;
|
|
179
|
+
}): Promise<any>;
|
|
167
180
|
checkFileResult(id: string, vid: string, params: {
|
|
168
181
|
taskId: string;
|
|
169
|
-
}, interval?: number, onProgress?: (progress: number) => void): Promise<string | null>;
|
|
182
|
+
}, interval?: number, markType?: string, onProgress?: (progress: number) => void): Promise<string | null>;
|
|
170
183
|
getUploadPicsZipResult(id: string, vid: string, params?: {
|
|
171
184
|
taskId: string;
|
|
172
185
|
}): Promise<IPicsZipResult>;
|
|
186
|
+
getUploadVlmPicsZipResult(id: string, vid: string, params?: {
|
|
187
|
+
taskId: string;
|
|
188
|
+
}): Promise<IPicsZipResult>;
|
|
173
189
|
getUploadabort(id: string, vid: string, params: {
|
|
174
190
|
taskId: string;
|
|
175
191
|
}): Promise<IPicsZipResult>;
|
|
@@ -182,5 +198,12 @@ export declare class CVForceDatahubApi extends BaseApi {
|
|
|
182
198
|
deleteDatasetCopyTask(id: string, vid: string, params: {
|
|
183
199
|
taskId: string;
|
|
184
200
|
}): Promise<unknown>;
|
|
201
|
+
getDatasetsIdVersionsVidConfigs(id: string, vid: string): Promise<IVConfig[]>;
|
|
202
|
+
saveVisionLabelConfigs(id: string, vid: string, params: {
|
|
203
|
+
data: IVConfigsParams[];
|
|
204
|
+
}): Promise<IVConfig>;
|
|
205
|
+
postGenerateVlmKieQa(id: string, vid: string, params: {
|
|
206
|
+
sampleIds: string[];
|
|
207
|
+
}): Promise<IVlmKieQaResult[]>;
|
|
185
208
|
}
|
|
186
209
|
export * from './model';
|
|
@@ -19,7 +19,7 @@ export interface IDataSet {
|
|
|
19
19
|
org: string;
|
|
20
20
|
tenantCode: string;
|
|
21
21
|
updatedAt: string;
|
|
22
|
-
ocrMarkTmpl:
|
|
22
|
+
ocrMarkTmpl: 'StructKVCOCR' | 'BasicOCR' | 'TableOCR' | 'DetectionOCR';
|
|
23
23
|
llmMarkTmpl: string;
|
|
24
24
|
llmResponseSort: string;
|
|
25
25
|
operator: IOperator;
|
|
@@ -64,6 +64,7 @@ export interface IVersion {
|
|
|
64
64
|
unSubsectionFiles: string[];
|
|
65
65
|
effectSamCount: number;
|
|
66
66
|
versionAsyncTask: IPicsZipResult;
|
|
67
|
+
qaTemplate: IVersionQaTemplate[];
|
|
67
68
|
}
|
|
68
69
|
export interface IAM {
|
|
69
70
|
endpoints: string[];
|
|
@@ -204,6 +205,14 @@ export interface TInfer {
|
|
|
204
205
|
rowSpan: number;
|
|
205
206
|
colSpan: number;
|
|
206
207
|
};
|
|
208
|
+
shape?: {
|
|
209
|
+
name: string;
|
|
210
|
+
x: number;
|
|
211
|
+
y: number;
|
|
212
|
+
width: number;
|
|
213
|
+
height: number;
|
|
214
|
+
};
|
|
215
|
+
content?: Record<string, string>;
|
|
207
216
|
}
|
|
208
217
|
export interface Deduplication {
|
|
209
218
|
duplicated: string[];
|
|
@@ -436,3 +445,28 @@ export interface IPagination {
|
|
|
436
445
|
total?: number;
|
|
437
446
|
type?: string;
|
|
438
447
|
}
|
|
448
|
+
export interface IVConfig {
|
|
449
|
+
id: string;
|
|
450
|
+
name: string;
|
|
451
|
+
type: string;
|
|
452
|
+
createdAt: string;
|
|
453
|
+
updatedAt: string;
|
|
454
|
+
}
|
|
455
|
+
export interface IVConfigsParams {
|
|
456
|
+
id: string;
|
|
457
|
+
name: string;
|
|
458
|
+
type: string;
|
|
459
|
+
}
|
|
460
|
+
export interface IVlmKieQaResult {
|
|
461
|
+
sampleId: string;
|
|
462
|
+
qas: {
|
|
463
|
+
name: string;
|
|
464
|
+
q: string;
|
|
465
|
+
a: string;
|
|
466
|
+
}[];
|
|
467
|
+
}
|
|
468
|
+
export interface IVersionQaTemplate {
|
|
469
|
+
name: string;
|
|
470
|
+
q: string;
|
|
471
|
+
a: string;
|
|
472
|
+
}
|