@glodon-aiot/apis 3.25.1-alpha.7 → 3.26.0-alpha.10

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,116 +1,167 @@
1
- var i = (u, t, e) => new Promise((r, o) => {
2
- var n = (s) => {
1
+ var i = (n, e, t) => new Promise((o, r) => {
2
+ var c = (s) => {
3
3
  try {
4
- c(e.next(s));
5
- } catch (a) {
6
- o(a);
4
+ u(t.next(s));
5
+ } catch (p) {
6
+ r(p);
7
7
  }
8
- }, p = (s) => {
8
+ }, a = (s) => {
9
9
  try {
10
- c(e.throw(s));
11
- } catch (a) {
12
- o(a);
10
+ u(t.throw(s));
11
+ } catch (p) {
12
+ r(p);
13
13
  }
14
- }, c = (s) => s.done ? r(s.value) : Promise.resolve(s.value).then(n, p);
15
- c((e = e.apply(u, t)).next());
14
+ }, u = (s) => s.done ? o(s.value) : Promise.resolve(s.value).then(c, a);
15
+ u((t = t.apply(n, e)).next());
16
16
  });
17
- import h from "axios";
18
- import { ImodelStoreEnum as v } from "../cvforce-modelservice/model.mjs";
19
- import { BaseApi as d } from "../base/index.mjs";
20
- class f extends d {
21
- constructor(t, e) {
22
- super(t != null ? t : h.create(), e);
17
+ import l from "axios";
18
+ import { ImodelStoreEnum as m } from "../cvforce-modelservice/model.mjs";
19
+ import { BaseApi as f } from "../base/index.mjs";
20
+ class E extends f {
21
+ constructor(e, t) {
22
+ super(e != null ? e : l.create(), t);
23
23
  }
24
24
  //之前用的接口,处理单个逻辑(兼容不同传参和响应格式)
25
- ocr(t, e) {
25
+ ocr(e, t) {
26
26
  return i(this, null, function* () {
27
- if (e.modelStore === v.pvc) {
28
- const r = this.convertToBatchParams(e), o = yield this.ocrPvcBatch(t, r);
29
- return this.convertToMinioResult(o);
27
+ if (t.modelStore === m.pvc) {
28
+ const o = this.convertToBatchParams(t), r = yield this.ocrPvcBatch(e, o);
29
+ return this.convertToMinioResult(r);
30
30
  } else
31
- return this.ocrMinio(t, e);
31
+ return this.ocrMinio(e, t);
32
32
  });
33
33
  }
34
- convertToBatchParams(t) {
34
+ convertToBatchParams(e) {
35
35
  return {
36
36
  pages: [{
37
- image: t.image
37
+ image: e.image
38
38
  }]
39
39
  };
40
40
  }
41
- convertToMinioResult(t) {
42
- var e;
43
- return (e = t.pages) == null ? void 0 : e.flatMap((r) => {
44
- var o;
45
- return ((o = r.textItems) == null ? void 0 : o.map((n) => ({
46
- box: n.bbox
41
+ convertToMinioResult(e) {
42
+ var t;
43
+ return (t = e.pages) == null ? void 0 : t.flatMap((o) => {
44
+ var r;
45
+ return ((r = o.textItems) == null ? void 0 : r.map((c) => ({
46
+ box: c.bbox
47
47
  }))) || [];
48
48
  });
49
49
  }
50
50
  //旧接口minio,处理单个逻辑
51
- ocrMinio(t, e) {
51
+ ocrMinio(e, t) {
52
52
  return i(this, null, function* () {
53
- return e.image && e.image.split("base64,").length > 1 && (e.image = e.image.split("base64,")[1]), this.post(`/v2/infer?serviceId=${t}`, e);
53
+ return t.image && t.image.split("base64,").length > 1 && (t.image = t.image.split("base64,")[1]), this.post(`/v2/infer?serviceId=${e}`, t);
54
54
  });
55
55
  }
56
56
  //新接口pvc,处理批量逻辑
57
- ocrPvcBatch(t, e) {
57
+ ocrPvcBatch(e, t) {
58
58
  return i(this, null, function* () {
59
- return this.post(`/v2/infer?serviceId=${t}`, e);
59
+ return this.post(`/v2/infer?serviceId=${e}`, t);
60
60
  });
61
61
  }
62
62
  // 接口延迟
63
- getSleep(t) {
63
+ getSleep(e) {
64
64
  return i(this, null, function* () {
65
- return new Promise((e) => {
65
+ return new Promise((t) => {
66
66
  setTimeout(() => {
67
- e(!0);
68
- }, t * 1e3);
67
+ t(!0);
68
+ }, e * 1e3);
69
69
  });
70
70
  });
71
71
  }
72
- postChatCompletions(t) {
72
+ postChatCompletions(e) {
73
73
  return i(this, null, function* () {
74
- return this.postNonStandard("/v1/chat/completions", t);
74
+ return this.postNonStandard("/v1/chat/completions", e);
75
75
  });
76
76
  }
77
- detection(t, e) {
77
+ detection(e, t) {
78
78
  return i(this, null, function* () {
79
- return this.post(`/v2/infer?serviceId=${t}`, e);
79
+ return this.post(`/v2/infer?serviceId=${e}`, t);
80
80
  });
81
81
  }
82
- detectionLayout(t, e) {
82
+ detectionLayout(e, t) {
83
83
  return i(this, null, function* () {
84
- if ("pages" in e) {
85
- const r = yield this.post(`/v2/infer?serviceId=${t}`, e);
86
- return this.convertLayoutToDetection(r);
84
+ if ("pages" in t) {
85
+ const o = yield this.post(`/v2/infer?serviceId=${e}`, t);
86
+ return this.convertLayoutToDetection(o);
87
87
  } else
88
- return this.post(`/v2/infer?serviceId=${t}`, e);
88
+ return this.post(`/v2/infer?serviceId=${e}`, t);
89
89
  });
90
90
  }
91
- convertLayoutToDetection(t) {
92
- var e, r;
91
+ convertLayoutToDetection(e) {
92
+ var t, o;
93
93
  return {
94
- prediction: ((r = (e = t.pages[0]) == null ? void 0 : e.layout) == null ? void 0 : r.map((o) => ({
95
- box: o.bbox,
96
- label: o.type,
97
- score: o.score
94
+ prediction: ((o = (t = e.pages[0]) == null ? void 0 : t.layout) == null ? void 0 : o.map((r) => ({
95
+ box: r.bbox,
96
+ label: r.type,
97
+ score: r.score
98
98
  }))) || []
99
99
  };
100
100
  }
101
- getBaseModel(t) {
101
+ getBaseModel(e) {
102
102
  return i(this, null, function* () {
103
103
  return this.get("/v1/baseModel", {
104
- serviceId: t
104
+ serviceId: e
105
105
  });
106
106
  });
107
107
  }
108
- postEmbeddings(t) {
108
+ postEmbeddings(e) {
109
109
  return i(this, null, function* () {
110
- return this.postNonStandard("/v1/embeddings", t);
110
+ return this.postNonStandard("/v1/embeddings", e);
111
111
  });
112
112
  }
113
+ /**
114
+ * 上传文件到平台。省略 purpose / saveTo,由服务端按 infer 和默认存储处理。
115
+ * 返回体里的 url 是预签名链接,由调用方放进工具结果交给模型。
116
+ */
117
+ postFile(e, t) {
118
+ return i(this, null, function* () {
119
+ const o = new FormData();
120
+ o.append("file", e, e.name);
121
+ const r = yield this.http.post("/v1/files", o, {
122
+ onUploadProgress: (a) => {
123
+ t == null || t(a.loaded, a.total || e.size);
124
+ }
125
+ }), c = d(r);
126
+ if (!c)
127
+ throw new Error("平台文件服务请求失败");
128
+ return c;
129
+ });
130
+ }
131
+ /** 查询文件并在签名将过期时由服务端续签。文件不存在时返回 undefined。 */
132
+ getFile(e) {
133
+ return i(this, null, function* () {
134
+ var t;
135
+ try {
136
+ const o = yield this.http.get(`/v1/files/${encodeURIComponent(e)}`);
137
+ return d(o, !0);
138
+ } catch (o) {
139
+ const r = o.response;
140
+ if ((r == null ? void 0 : r.status) === 404 || ((t = r == null ? void 0 : r.data) == null ? void 0 : t.code) === h)
141
+ return;
142
+ throw new Error("平台文件服务请求失败");
143
+ }
144
+ });
145
+ }
146
+ }
147
+ const h = 11012;
148
+ function v(n) {
149
+ return n === 0 || n >= 200 && n < 300;
150
+ }
151
+ function d(n, e = !1) {
152
+ var o;
153
+ const t = n.data;
154
+ if (!t || typeof t.code != "number")
155
+ throw new Error("平台文件服务请求失败");
156
+ if (t.code === h) {
157
+ if (e)
158
+ return;
159
+ throw new Error("文件不存在");
160
+ }
161
+ if (!v(t.code) || !((o = t.data) != null && o.id))
162
+ throw new Error(t.message || "平台文件服务请求失败");
163
+ return t.data;
113
164
  }
114
165
  export {
115
- f as AIShopApi
166
+ E as AIShopApi
116
167
  };
@@ -29,6 +29,9 @@ class R {
29
29
  constructor(s, t) {
30
30
  this.axios = s, this.errorHandler = t;
31
31
  }
32
+ get http() {
33
+ return this.axios;
34
+ }
32
35
  get(s, t, e) {
33
36
  return n(this, null, function* () {
34
37
  const r = this.axios.get(s, {
@@ -2,12 +2,12 @@ var v = Object.defineProperty, S = Object.defineProperties;
2
2
  var w = Object.getOwnPropertyDescriptors;
3
3
  var g = Object.getOwnPropertySymbols;
4
4
  var A = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable;
5
- var y = (l, e, t) => e in l ? v(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t, f = (l, e) => {
5
+ var f = (l, e, t) => e in l ? v(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t, y = (l, e) => {
6
6
  for (var t in e || (e = {}))
7
- A.call(e, t) && y(l, t, e[t]);
7
+ A.call(e, t) && f(l, t, e[t]);
8
8
  if (g)
9
9
  for (var t of g(e))
10
- R.call(e, t) && y(l, t, e[t]);
10
+ R.call(e, t) && f(l, t, e[t]);
11
11
  return l;
12
12
  }, $ = (l, e) => S(l, w(e));
13
13
  var s = (l, e, t) => new Promise((a, i) => {
@@ -101,7 +101,7 @@ class x extends K {
101
101
  isAgree: 0
102
102
  },
103
103
  isReplying: !1
104
- }, c = yield this.getToken(), p = $(f({}, a), {
104
+ }, c = yield this.getToken(), p = $(y({}, a), {
105
105
  stream: !0
106
106
  });
107
107
  H(`https://aiot-dev.glodon.com/api/cvforcepd/chat/v2/chat?applicationId=${e}&sessionId=${t}`, {
@@ -412,6 +412,11 @@ class x extends K {
412
412
  return this.get(`/data/v1/application/${e}/sessions/${t}`);
413
413
  });
414
414
  }
415
+ getSessionArtifacts(e, t) {
416
+ return s(this, null, function* () {
417
+ return this.get(`/data/v1/application/${e}/sessions/${t}/artifacts`, void 0, !0);
418
+ });
419
+ }
415
420
  getSilenceDuration() {
416
421
  return s(this, null, function* () {
417
422
  return this.get("/data/v1/silenceDuration");
@@ -95,6 +95,11 @@ class k extends h {
95
95
  return this.get(`/application/${e}/sessions/${t}`);
96
96
  });
97
97
  }
98
+ getSessionArtifacts(e, t) {
99
+ return s(this, null, function* () {
100
+ return this.get(`/application/${e}/sessions/${t}/artifacts`);
101
+ });
102
+ }
98
103
  patchSessionsId(e, t, n) {
99
104
  return s(this, null, function* () {
100
105
  return this.patch(`/application/${e}/sessions/${t}`, n);
@@ -115,6 +120,21 @@ class k extends h {
115
120
  return this.post(`/application/${e}session/${t}/file`, n);
116
121
  });
117
122
  }
123
+ postUploadTicket(e) {
124
+ return s(this, null, function* () {
125
+ return this.post("/ticket", e);
126
+ });
127
+ }
128
+ postApplicationIdSessionFile(e, t, n) {
129
+ return s(this, null, function* () {
130
+ return this.post(`/application/${e}/session/${t}/sessionfile`, n);
131
+ });
132
+ }
133
+ getApplicationIdSessionFile(e, t, n) {
134
+ return s(this, null, function* () {
135
+ return this.get(`/application/${e}/session/${t}/file/${n}`);
136
+ });
137
+ }
118
138
  /**
119
139
  * 异步提交会话评论信息
120
140
  * @param appid - 应用的 ID,用于标识具体的应用
package/dist/lib/index.js CHANGED
@@ -1,3 +1,3 @@
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=(a,e,t)=>e in a?ve(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,y=(a,e)=>{for(var t in e||(e={}))H.call(e,t)&&N(a,t,e[t]);if(M)for(var t of M(e))O.call(e,t)&&N(a,t,e[t]);return a},I=(a,e)=>Se(a,Ie(e));var Q=(a,e)=>{var t={};for(var r in a)H.call(a,r)&&e.indexOf(r)<0&&(t[r]=a[r]);if(a!=null&&M)for(var r of M(a))e.indexOf(r)<0&&O.call(a,r)&&(t[r]=a[r]);return t};var s=(a,e,t)=>new Promise((r,n)=>{var i=h=>{try{c(t.next(h))}catch(p){n(p)}},o=h=>{try{c(t.throw(h))}catch(p){n(p)}},c=h=>h.done?r(h.value):Promise.resolve(h.value).then(i,o);c((t=t.apply(a,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("axios"),A=require("@glodon-aiot/minio"),V=require("uuid"),U=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 n=this.axios.get(e,{params:t});return this.handleResponse(n,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,n){return s(this,null,function*(){const i=this.axios.post(e,t,y({params:r},n));return this.handleResponse(i)})}postForm(e,t,r){return s(this,null,function*(){const n=this.axios.post(e,t,{params:r,headers:{"Content-Type":"multipart/form-data"}});return this.handleResponse(n)})}patch(e,t,r){return s(this,null,function*(){const n=this.axios.patch(e,t,{params:r});return this.handleResponse(n)})}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 n=this.axios.post(e,t,y({},r));return this.handleResponse(n)})}getNonStandard(e,t){return s(this,null,function*(){const r=this.axios.get(e,t);try{const n=yield r;if(n.status===200)return n}catch(n){throw this.handleError(n)}})}postNonStandard(e,t,r,n){return s(this,null,function*(){var c,h;const o=yield this.axios.post(e,t,y({params:r},n));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=a=>a>=10002&&a<=10012,J=(a,e)=>q(a)?"数据操作错误":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,n="3600",i){return s(this,null,function*(){return this.post("/refresh-token",{oldToken:e,tenant:t,orgId:r,expired:n,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",n){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/menu?groupCode=${r}`,{level:n})})}getUserInfo(e){return s(this,null,function*(){return this.get(`/users/${e}`)})}uipermission(e,t,r="web"){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/uipermission?groupCode=${r}`)})}getAppInfo(e){return s(this,null,function*(){return this.get(`/products/${e}/apps`)})}getTenantUserInfo(e,t){return s(this,null,function*(){return this.get(`/tenant/${e}/users/${t}`)})}uploadFile(e){return s(this,null,function*(){return this.upload("/upload",e)})}getUserIdProductCodeOrg(e,t){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/org`)})}getOrg(e){return s(this,null,function*(){return this.get(`/org/${e}`)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}putAppInfo(e,t){return s(this,null,function*(){return this.put(`/products/${e}/apps`,t)})}getTenantKeySecret(e){return s(this,null,function*(){return this.get(`/tenant/${e}/key`)})}resetTenantKeySecret(e){return s(this,null,function*(){return this.post(`/tenant/${e}/resetSecret`,void 0)})}getProductsCode(e){return s(this,null,function*(){return this.get(`/products/${e}`)})}getLongtermTokens(e){return s(this,null,function*(){return this.listPaged("/longterm-token",e)})}postLongtermToken(e){return s(this,null,function*(){return this.post("/longterm-token",e)})}deleteLongtermToken(e){return s(this,null,function*(){return this.delete(`/longterm-token/${e}`)})}getMyUserInfo(){return s(this,null,function*(){return this.get("/user/me")})}}var z=(a=>(a.Collecting="采集中",a.CollectionTimeout="超时",a.CollectionFinish="完成",a.WaitUpload="等待上传",a.Uploading="上传中",a.UploadFinish="上传完成",a.UploadFailed="上传失败",a.WaitMerge="等待合成",a.CreateMergeTaskFailed="创建合成任务失败",a.Merging="合成中",a.MergeFailed="合成失败",a.MergeFinish="合成成功",a))(z||{}),Y=(a=>(a.Collecting="采集中",a.CollectionTimeout="超时",a.CollectionFinish="完成",a.WaitUpload="等待上传",a.Uploading="上传中",a.UploadFinish="上传完成",a.UploadFailed="上传失败",a.WaitMerge="等待合成",a.CreateMergeTaskFailed="创建合成任务失败",a.Merging="合成中",a.MergeFailed="合成失败",a.MergeFinish="合成成功",a))(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(n=>{if(n.status!==200)throw console.error(n),Error(JSON.stringify(n));return n.json()}).then(n=>{if(n.code!==200)throw Error(JSON.stringify(n));return n.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=(a=>(a[a.None=0]="None",a[a.SourceFile=1]="SourceFile",a[a.WebLink=2]="WebLink",a))(j||{}),G=(a=>(a.Unprotected="不受著作权保护",a.ProtectAuthorize="受著作权保护,已获得授权",a.ProtectUnauthorize="受著作权保护,未获得授权",a))(G||{}),b=(a=>(a[a.Robot=1]="Robot",a[a.User=2]="User",a[a.System=3]="System",a))(b||{}),X=(a=>(a.Start="start",a.End="end",a))(X||{}),T=(a=>(a[a.Processing=1]="Processing",a[a.Success=2]="Success",a[a.Failed=3]="Failed",a))(T||{}),Z=(a=>(a.AECPILOT="aecpilot",a))(Z||{});function be(a,e){return s(this,null,function*(){const t=a.getReader();let r;for(;!(r=yield t.read()).done;)e(r.value)})}function Pe(a){let e,t,r,n=!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;){n&&(e[t]===10&&(p=++t),n=!1);let u=-1;for(;t<h&&u===-1;++t)switch(e[t]){case 58:r===-1&&(r=t-p);break;case 13:n=!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;a(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(a,e,t){let r=_();const n=new TextDecoder;return function(o,c,h){if(o.length===0)t==null||t(r),r=_();else if(c>0){const p=n.decode(o.subarray(0,c)),u=c+(o[c+1]===32?2:1);let l=n.decode(o.subarray(u));switch(h&&(l+=`
1
+ "use strict";var we=Object.defineProperty,Ie=Object.defineProperties;var ke=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var N=(n,e,t)=>e in n?we(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,y=(n,e)=>{for(var t in e||(e={}))O.call(e,t)&&N(n,t,e[t]);if(M)for(var t of M(e))H.call(e,t)&&N(n,t,e[t]);return n},w=(n,e)=>Ie(n,ke(e));var _=(n,e)=>{var t={};for(var r in n)O.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&M)for(var r of M(n))e.indexOf(r)<0&&H.call(n,r)&&(t[r]=n[r]);return t};var s=(n,e,t)=>new Promise((r,a)=>{var i=h=>{try{c(t.next(h))}catch(p){a(p)}},o=h=>{try{c(t.throw(h))}catch(p){a(p)}},c=h=>h.done?r(h.value):Promise.resolve(h.value).then(i,o);c((t=t.apply(n,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("axios"),A=require("@glodon-aiot/minio"),F=require("uuid"),C=require("dayjs"),x=require("buffer");class m{constructor(e,t){this.axios=e,this.errorHandler=t}get http(){return this.axios}get(e,t,r){return s(this,null,function*(){const a=this.axios.get(e,{params:t});return this.handleResponse(a,r)})}listPaged(e,t){return s(this,null,function*(){const r=this.axios.get(e,{params:t});return this.handleResponse(r)})}list(e,t){return s(this,null,function*(){const r=this.axios.get(e,{params:t});return this.handleResponse(r)})}delete(e,t){return s(this,null,function*(){const r=this.axios.delete(e,{params:t});return this.handleResponse(r)})}post(e,t,r,a){return s(this,null,function*(){const i=this.axios.post(e,t,y({params:r},a));return this.handleResponse(i)})}postForm(e,t,r){return s(this,null,function*(){const a=this.axios.post(e,t,{params:r,headers:{"Content-Type":"multipart/form-data"}});return this.handleResponse(a)})}patch(e,t,r){return s(this,null,function*(){const a=this.axios.patch(e,t,{params:r});return this.handleResponse(a)})}put(e,t){return s(this,null,function*(){const r=this.axios.put(e,t);return this.handleResponse(r)})}upload(e,t,r){return s(this,null,function*(){const a=this.axios.post(e,t,y({},r));return this.handleResponse(a)})}getNonStandard(e,t){return s(this,null,function*(){const r=this.axios.get(e,t);try{const a=yield r;if(a.status===200)return a}catch(a){throw this.handleError(a)}})}postNonStandard(e,t,r,a){return s(this,null,function*(){var c,h;const o=yield this.axios.post(e,t,y({params:r},a));if(o.status===200)if((c=o.data)!=null&&c.code)(h=this.errorHandler)!=null&&h.onAppStatusError&&this.errorHandler.onAppStatusError(o.data.code,o.data.message);else return o.data})}handleResponse(e,t){return s(this,null,function*(){try{const r=yield e;return this.handleAppError(r.data,t).data}catch(r){throw this.handleError(r)}})}handleAppError(e,t){var r;if(e.code<200||e.code>=300)throw(r=this.errorHandler)!=null&&r.onAppStatusError?this.errorHandler.onAppStatusError(e.code,z(e.code,e.message),t):console.error("未处理应用错误:",e),{isAxiosError:!1,message:e.message};return e}handleError(e){var t,r;return e.response?(t=this.errorHandler)!=null&&t.onHttpStatusError&&(console.log("HTTP 错误",this.errorHandler),this.errorHandler.onHttpStatusError(e.response.status,"",e.response)):e.request?(console.log(e.request),(r=this.errorHandler)!=null&&r.onNetworkError&&this.errorHandler.onNetworkError()):console.error("axios request config error:",e),new Error(e.message)}}const J=n=>n>=10002&&n<=10012,z=(n,e)=>J(n)?"数据操作错误":e||"未知接口错误";class Ae extends m{constructor(e,t){super(e!=null?e:v.create(),t)}getLoginUrl(){return s(this,null,function*(){return this.get("/openAddress")})}getToken(e,t){return s(this,null,function*(){return this.get(e,t)})}getAIoTTokenByGTeamToken(e){return s(this,null,function*(){return this.post("/validate/glodonCloud",e).then(t=>t.accessToken)})}postRefreshToken(e,t,r,a="3600",i){return s(this,null,function*(){return this.post("/refresh-token",{oldToken:e,tenant:t,orgId:r,expired:a,product:i})})}logout(){return s(this,null,function*(){return this.post("/logout",{})})}}class Te extends m{constructor(e,t){super(e!=null?e:v.create(),t)}getTenant(e){return s(this,null,function*(){return this.get(`/tenant/${e}`)})}listProduct(){return s(this,null,function*(){return this.list("/products")})}listProvinces(){return s(this,null,function*(){return this.list("/regions/provinces")})}listCities(e){return s(this,null,function*(){return this.list(`/regions/provinces/${e}/city`)})}listCounties(e,t){return s(this,null,function*(){return this.list(`/regions/provinces/${e}/city/${t}/county`)})}getOrgList(e){return s(this,null,function*(){return this.list("/org",e)})}getUserIdOrgList(e,t){return s(this,null,function*(){return this.list(`/users/${e}/org`,t)})}delOrg(e){return s(this,null,function*(){return this.delete(`/org/${e}`)})}postOrg(e){return s(this,null,function*(){return this.post("/org",e)})}patchOrg(e,t){return s(this,null,function*(){return this.patch(`/org/${e}`,t)})}getUsers(e,t){return s(this,null,function*(){return this.list(`/tenant/${e}/users`,t)})}delUser(e,t){return s(this,null,function*(){return this.delete(`/tenant/${e}/users/${t}`)})}postUser(e,t){return s(this,null,function*(){return this.post(`/tenant/${e}/users`,t)})}patchUser(e,t,r){return s(this,null,function*(){return this.patch(`tenant/${e}/users/${t}`,r)})}getTenantList(){return s(this,null,function*(){return this.get("/tenant")})}getUserIdRoles(e){return s(this,null,function*(){return this.get(`/users/${e}/role`)})}getProductCodeRole(e){return s(this,null,function*(){return this.get(`/products/${e}/role`)})}postUserRole(e,t){return s(this,null,function*(){return this.post(`/users/${e}/role`,t)})}patchUserRole(e,t,r){return s(this,null,function*(){return this.patch(`/users/${e}/role/${t}`,r)})}deleteUserRole(e,t){return s(this,null,function*(){return this.delete(`/users/${e}/role/${t}`)})}getUsersIdProductCodeMenu(e,t,r="web",a){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/menu?groupCode=${r}`,{level:a})})}getUserInfo(e){return s(this,null,function*(){return this.get(`/users/${e}`)})}uipermission(e,t,r="web"){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/uipermission?groupCode=${r}`)})}getAppInfo(e){return s(this,null,function*(){return this.get(`/products/${e}/apps`)})}getTenantUserInfo(e,t){return s(this,null,function*(){return this.get(`/tenant/${e}/users/${t}`)})}uploadFile(e){return s(this,null,function*(){return this.upload("/upload",e)})}getUserIdProductCodeOrg(e,t){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/org`)})}getOrg(e){return s(this,null,function*(){return this.get(`/org/${e}`)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}putAppInfo(e,t){return s(this,null,function*(){return this.put(`/products/${e}/apps`,t)})}getTenantKeySecret(e){return s(this,null,function*(){return this.get(`/tenant/${e}/key`)})}resetTenantKeySecret(e){return s(this,null,function*(){return this.post(`/tenant/${e}/resetSecret`,void 0)})}getProductsCode(e){return s(this,null,function*(){return this.get(`/products/${e}`)})}getLongtermTokens(e){return s(this,null,function*(){return this.listPaged("/longterm-token",e)})}postLongtermToken(e){return s(this,null,function*(){return this.post("/longterm-token",e)})}deleteLongtermToken(e){return s(this,null,function*(){return this.delete(`/longterm-token/${e}`)})}getMyUserInfo(){return s(this,null,function*(){return this.get("/user/me")})}}var Y=(n=>(n.Collecting="采集中",n.CollectionTimeout="超时",n.CollectionFinish="完成",n.WaitUpload="等待上传",n.Uploading="上传中",n.UploadFinish="上传完成",n.UploadFailed="上传失败",n.WaitMerge="等待合成",n.CreateMergeTaskFailed="创建合成任务失败",n.Merging="合成中",n.MergeFailed="合成失败",n.MergeFinish="合成成功",n))(Y||{}),j=(n=>(n.Collecting="采集中",n.CollectionTimeout="超时",n.CollectionFinish="完成",n.WaitUpload="等待上传",n.Uploading="上传中",n.UploadFinish="上传完成",n.UploadFailed="上传失败",n.WaitMerge="等待合成",n.CreateMergeTaskFailed="创建合成任务失败",n.Merging="合成中",n.MergeFailed="合成失败",n.MergeFinish="合成成功",n))(j||{});class be extends m{constructor(e,t){super(e!=null?e:v.create(),t)}static parseApiToken(e){const t=window.atob(e.split(".")[1]);return JSON.parse(t)}static loadApiToken(e,t,r){return s(this,null,function*(){return fetch(`${e}${t}/viewtoken/${r}/create_apitoken`,{method:"POST"}).then(a=>{if(a.status!==200)throw console.error(a),Error(JSON.stringify(a));return a.json()}).then(a=>{if(a.code!==200)throw Error(JSON.stringify(a));return a.data.apiToken})})}listRecord(e){return s(this,null,function*(){return this.listPaged("/spacetwins",e)})}postRecord(e){return s(this,null,function*(){return this.post("/spacetwins",e)})}getRecordOverview(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}`)})}getRecordViewtoken(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}/viewtoken`)})}listScene(e){return s(this,null,function*(){return this.list(`/spacetwins/${e}/scenes`)})}getScenesByTimestamp(e,t){return s(this,null,function*(){return this.list(`/spacetwins/${e}/scenes_timestamp`,{timestamp:t})})}recomputeTrack(e,t){return s(this,null,function*(){return this.patch(`/spacetwins/${e}/track`,{points:t})})}updateRecordUploadStatus(e,t){return s(this,null,function*(){return this.post(`/spacetwins/${e}/update_upload_status`,t)})}getApiToken(e){return s(this,null,function*(){return this.post(`/viewtoken/${e}/create_apitoken`,{})})}getSpacetwins(e){return s(this,null,function*(){return this.listPaged("/spacetwins",e)})}postSpacetwins(e){return s(this,null,function*(){return this.post("/spacetwins",e)})}updateInspection(e,t){return s(this,null,function*(){return this.patch(`/patrolInspection/${e}`,t)})}getSpacetwinsIdViewtoken(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}/viewtoken`)})}postSpacetwinsIdUpdateUploadStatus(e,t){return s(this,null,function*(){return this.post(`/spacetwins/${e}/update_upload_status`,t)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/upload/ticket",e)})}getDownloadUrl(e){return s(this,null,function*(){return this.get(`/download/url?isv=${e.isv}&key=${e.key}`)})}listTrack(e,t){return s(this,null,function*(){return this.list(`/spacetwins/${e}/track`,{type:t})})}}class Pe extends m{constructor(e,t){super(e!=null?e:v.create(),t)}listPlugin(e){return s(this,null,function*(){return this.list("/plugins",e)})}postPlugin(e){return s(this,null,function*(){return this.post("/plugins",e)})}getPlugin(e){return s(this,null,function*(){return this.get(`/plugins/${e}`)})}updatePlugin(e,t){return s(this,null,function*(){return this.patch(`/plugins/${e}`,t)})}listPluginData(e,t){return s(this,null,function*(){return this.list(`/plugins/${e}/datas`,t)})}postPluginData(e,t){return s(this,null,function*(){return this.post(`/plugins/${e}/datas`,t)})}getPluginData(e,t){return s(this,null,function*(){return this.get(`/plugins/${e}/datas/${t}`).then(r=>w(y({},r),{arguments:JSON.parse(r.arguments)}))})}updatePluginData(e,t,r){return s(this,null,function*(){return this.patch(`/plugins/${e}/datas/${t}`,r)})}deletePluginData(e,t){return s(this,null,function*(){return this.delete(`/plugins/${e}/datas/${t}`)})}}var G=(n=>(n[n.None=0]="None",n[n.SourceFile=1]="SourceFile",n[n.WebLink=2]="WebLink",n))(G||{}),X=(n=>(n.Unprotected="不受著作权保护",n.ProtectAuthorize="受著作权保护,已获得授权",n.ProtectUnauthorize="受著作权保护,未获得授权",n))(X||{}),b=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(b||{}),Z=(n=>(n.Start="start",n.End="end",n))(Z||{}),T=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(T||{}),ee=(n=>(n.AECPILOT="aecpilot",n))(ee||{});function Re(n,e){return s(this,null,function*(){const t=n.getReader();let r;for(;!(r=yield t.read()).done;)e(r.value)})}function Me(n){let e,t,r,a=!1,i;return function(c){e===void 0?(e=c,t=0,r=-1,i=!1):e=Ve(e,c);const h=e.length;let p=0;for(;t<h;){a&&(e[t]===10&&(p=++t),a=!1);let u=-1;for(;t<h&&u===-1;++t)switch(e[t]){case 58:r===-1&&(r=t-p);break;case 13:a=!1,t+4<h&&e[t+1]===10&&e[t+2]!==13&&e[t-1]!==10&&e[t-2]!==13&&(i=!0);case 10:u=t;break}if(u===-1)break;n(e.subarray(p,u),r,i),p=t,r=-1,i=!1}p===h?e=void 0:p!==0&&(e=e.subarray(p),t-=p)}}function Fe(n,e,t){let r=Q();const a=new TextDecoder;return function(o,c,h){if(o.length===0)t==null||t(r),r=Q();else if(c>0){const p=a.decode(o.subarray(0,c)),u=c+(o[c+1]===32?2:1);let l=a.decode(o.subarray(u));switch(h&&(l+=`
2
2
  `),p){case"data":r.data=r.data?r.data+`
3
- `+l:l;break;case"event":r.event=l;break;case"id":a(r.id=l);break;case"retry":const d=parseInt(l,10);isNaN(d)||e(r.retry=d);break}}}}function Me(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function _(){return{data:"",event:"",id:"",retry:void 0}}const C="text/event-stream",Ve=1e3,W="last-event-id";function F(a,u){var l=u,{signal:e,headers:t,onopen:r,onmessage:n,onclose:i,onerror:o,openWhenHidden:c,fetch:h}=l,p=Q(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||L()}c||document.addEventListener("visibilitychange",k);let P=Ve,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:Fe;function L(){return s(this,null,function*(){var B;$=new AbortController;try{const R=yield $e(a,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},n))),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(L,w)}catch(w){E(),g(w)}}})}L()})}function Fe(a){const e=a.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,n)=>{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(n=>this.uploadMinioFile(n,t)).catch(n=>{throw Error(n)})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(n=>n.name),isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(n=>Promise.all(t.map(i=>this.uploadMinioFile(n,i)))).catch(n=>{throw Error(n)})})}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,n=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,n);h()})})}postChat(e,t){return s(this,null,function*(){return this.post("/chat",e,t)})}postChatV2EventSource(e,t,r,n){return s(this,null,function*(){var h;const i={code:0,messageId:V.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});F(`${(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&&n!=null&&n.onopen&&n.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:U(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(n==null?void 0:n.onmessage)&&n.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};n!=null&&n.onmessage&&n.onmessage(l)}},onerror(){n!=null&&n.onerror&&n.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};n!=null&&n.onclose&&n.onclose(p)}})})}postChatV3EventSource(e,t,r,n){return s(this,null,function*(){var h,p;const i={code:0,messageId:V.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});F(`${(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&&n!=null&&n.onopen&&n.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}n!=null&&n.onmessage&&n.onmessage(i)},onerror(){n!=null&&n.onerror&&n.onerror()},onclose(){const u=I(y({},i),{isReplying:!1});n!=null&&n.onclose&&n.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,n,i,o){return s(this,null,function*(){const c={code:0,messageId:V.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});F(`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:n,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:U(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(n=>n.name),isv:"minio",knowledgeId:e};return this.postTicket(r).then(n=>Promise.all(t.map(i=>this.uploadMinioFile(n.minio,i)))).catch(n=>{throw Error(n)})})}postFile(e,t,r){return s(this,null,function*(){const n={files:[t.name],isv:"minio",knowledgeId:e,type:r};return this.postTicket(n).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(n=>this.uploadMinioFile(n.minio,t)).catch(n=>{throw Error(n)})})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,n)=>{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,n=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((c,h)=>{const p=()=>{if(!n()){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,n,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${r}`,n,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,n,i){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`,r,n,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,n){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${r}`,n)})}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,n){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${r}`,n)})}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}`)})}getSilenceDuration(){return s(this,null,function*(){return this.get("/data/v1/silenceDuration")})}}globalThis.Buffer=x.Buffer;class Le extends m{constructor(e,t,r){super(e!=null?e:v.create(),r),this.axiosInstance=e,this.getToken=t}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}postGeneques(e){return s(this,null,function*(){return this.post("/data/v1/geneques",e)})}getApplicationId(e){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`)})}getApplicationIdSessions(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessionsa`,t)})}postApplicationIdSession(e){return s(this,null,function*(){return this.post(`/data/v1/application/${e.applicationId}/sessions`,e)})}getApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}patchApplicationIdSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}delApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/sessions/${t}`)})}getApplicationIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/promptVariables`,t)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`)})}patchApplicationIdSessionpromptVariablesId(e,t,r,n){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${r}`,n)})}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,n,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${r}`,n,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,n){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${r}`,n)})}checkFileReady(e,t,r,n=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((c,h)=>{const p=()=>{if(!n()){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(n=>this.uploadMinioFile(n.minio,t)).catch(n=>{throw Error(n)})})}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,n)=>{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,n,i){return s(this,null,function*(){var p;const o={code:0,messageId:V.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});F(`${(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:n,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:U(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=(a=>(a[a.Dialog=0]="Dialog",a[a.TextGenerate=1]="TextGenerate",a[a.FileSummery=2]="FileSummery",a))(ee||{}),te=(a=>(a[a.Robot=1]="Robot",a[a.User=2]="User",a[a.System=3]="System",a))(te||{}),se=(a=>(a[a.Processing=1]="Processing",a[a.Done=2]="Done",a[a.Failed=3]="Failed",a))(se||{}),re=(a=>(a[a.File=0]="File",a[a.WebLink=1]="WebLink",a))(re||{}),ae=(a=>(a[a.Processing=1]="Processing",a[a.Success=2]="Success",a[a.Failed=3]="Failed",a))(ae||{}),ne=(a=>(a.InputFile="ui.input.file",a.LLMModel="ui.llm.model",a))(ne||{}),ie=(a=>(a[a.Idle=0]="Idle",a[a.Quoted=1]="Quoted",a))(ie||{}),oe=(a=>(a[a.Basic=0]="Basic",a[a.Pro=1]="Pro",a))(oe||{}),ce=(a=>(a[a.Dialog=0]="Dialog",a[a.Text=1]="Text",a[a.Agent=2]="Agent",a[a.All=3]="All",a))(ce||{}),le=(a=>(a.User="instruction",a.System="settings",a))(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,n)=>{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(n=>this.uploadMinioFile(n.minio,t)).catch(n=>{throw Error(n)})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(n=>n.name),isv:"minio",knowledgeId:e};return this.getUploadTicket(r).then(n=>Promise.all(t.map(i=>this.uploadMinioFile(n.minio,i)))).catch(n=>{throw Error(n)})})}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,n){return s(this,null,function*(){return this.patch(`/application/${e}/session/${t}/promptVariables/${r}`,n)})}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,n){return s(this,null,function*(){return this.patch(`/knowledge/${e}/file/${t}/data/${r}`,{data:n})})}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=(a=>(a[a.inital=0]="inital",a[a.success=1]="success",a[a.processing=2]="processing",a[a.failed=3]="failed",a))(de||{}),pe=(a=>(a[a.inital=0]="inital",a[a.processing=1]="processing",a[a.paused=2]="paused",a[a.failed=3]="failed",a[a.done=4]="done",a))(pe||{}),f=(a=>(a.Pending="PENDING",a.Started="STARTED",a.Failure="FAILURE",a.Success="SUCCESS",a.Abort="ABORT",a))(f||{}),ue=(a=>(a.Pending="PENDING",a.Started="STARTED",a.Success="SUCCESS",a.Failure="FAILURE ",a))(ue||{}),he=(a=>(a[a.all=0]="all",a[a.general=1]="general",a[a.major=2]="major",a))(he||{});function Ue(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){const e=Math.random()*16|0;return(a=="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,n){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/samples`,{samples:r,confirmStatus:n})})}delDatasetsIdVersionsVidSamplesId(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/samples/${r}`)})}delDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/samples`,{sampleIds:r})})}delDatasetsIdVersionsVidLlmSamplesId(e,t,r){return s(this,null,function*(){return this.delete(`datasets/${e}/versions/${t}/llmSamples/${r}`)})}getDatasetsIdVersionsVidSsamplesSid(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/samples/${r}`).then(n=>I(y({},n),{labels:n.labels?n.labels.map(i=>I(y({},i),{uuid:i.uuid||Ue()})):[]}))})}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,n){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamples/${r}`,n)})}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,n){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection`,n)})}postSubsection(e,t,r,n){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection`,n)})}updateSubsection(e,t,r,n,i){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection/${n}`,i)})}deleteSubsection(e,t,r,n){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection/${n}`)})}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,n){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamplesV2/${r}`,n)})}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,n){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/${r}/previewSubsection`,n)})}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,n=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,n);p()})})}getUploadPicsZipResult(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/uploadzip`,r)})}getUploadVlmPicsZipResult(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/vlmuploadzip`,r)})}getUploadabort(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/uploadabort`,r)})}postPreLabelTask(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/prelabeltask`,r)})}getPreLabelTask(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/prelabeltask`)})}delPreLabelTask(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/prelabeltask/${r}`)})}getAllConfirmSamples(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/confirm`)})}getDataSetCopyTask(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/copyDataset`)})}postDataSetCopyTask(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/copyDataset`,r)})}deleteDatasetCopyTask(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/copyDataset`,r)})}getDatasetsIdVersionsVidConfigs(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/labels`)})}saveVisionLabelConfigs(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/labels`,r)})}postGenerateVlmKieQa(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/samples/generator/vlm_kie_qa`,r)})}getDefaultQaTemplates(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/defaultQaTemplates`)})}getDatasetVersionCompareSummary(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/compare/summary`,t)})}getDatasetVersionCompareSamples(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/compare/samples`,t)})}}class 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=(a=>(a[a.minio=0]="minio",a[a.pvc=1]="pvc",a))(ge||{}),ye=(a=>(a.common="A100",a.idcard="A104",a.bankcard="A108",a.page="A112",a.rmwatermark="A115",a.seal="A116",a.rmseal="A117",a.table="A118",a))(ye||{}),me=(a=>(a.User="user",a.Assistant="assistant",a.System="system",a))(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),n=yield this.ocrPvcBatch(e,r);return this.convertToMinioResult(n)}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 n;return((n=r.textItems)==null?void 0:n.map(i=>({box:i.bbox})))||[]})}ocrMinio(e,t){return s(this,null,function*(){return t.image&&t.image.split("base64,").length>1&&(t.image=t.image.split("base64,")[1]),this.post(`/v2/infer?serviceId=${e}`,t)})}ocrPvcBatch(e,t){return s(this,null,function*(){return this.post(`/v2/infer?serviceId=${e}`,t)})}getSleep(e){return s(this,null,function*(){return new Promise(t=>{setTimeout(()=>{t(!0)},e*1e3)})})}postChatCompletions(e){return s(this,null,function*(){return this.postNonStandard("/v1/chat/completions",e)})}detection(e,t){return s(this,null,function*(){return this.post(`/v2/infer?serviceId=${e}`,t)})}detectionLayout(e,t){return s(this,null,function*(){if("pages"in t){const r=yield this.post(`/v2/infer?serviceId=${e}`,t);return this.convertLayoutToDetection(r)}else return this.post(`/v2/infer?serviceId=${e}`,t)})}convertLayoutToDetection(e){var t,r;return{prediction:((r=(t=e.pages[0])==null?void 0:t.layout)==null?void 0:r.map(n=>({box:n.bbox,label:n.type,score:n.score})))||[]}}getBaseModel(e){return s(this,null,function*(){return this.get("/v1/baseModel",{serviceId:e})})}postEmbeddings(e){return s(this,null,function*(){return this.postNonStandard("/v1/embeddings",e)})}}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=Le;exports.ApplicationTypes=ce;exports.ArchiGptUIKeys=ne;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=ae;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;
3
+ `+l:l;break;case"event":r.event=l;break;case"id":n(r.id=l);break;case"retry":const d=parseInt(l,10);isNaN(d)||e(r.retry=d);break}}}}function Ve(n,e){const t=new Uint8Array(n.length+e.length);return t.set(n),t.set(e,n.length),t}function Q(){return{data:"",event:"",id:"",retry:void 0}}const L="text/event-stream",De=1e3,W="last-event-id";function V(n,u){var l=u,{signal:e,headers:t,onopen:r,onmessage:a,onclose:i,onerror:o,openWhenHidden:c,fetch:h}=l,p=_(l,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((d,g)=>{const S=y({},t);S.accept||(S.accept=L);let $;function I(){$.abort(),document.hidden||U()}c||document.addEventListener("visibilitychange",I);let P=De,E=0;function K(){document.removeEventListener("visibilitychange",I),window.clearTimeout(E),$.abort()}e==null||e.addEventListener("abort",()=>{K(),d()});const ve=h!=null?h:window.fetch,Se=r!=null?r:Ee;function U(){return s(this,null,function*(){var B;$=new AbortController;try{const R=yield ve(n,w(y({},p),{headers:S,signal:$.signal}));yield Se(R),yield Re(R.body,Me(Fe(k=>{k?S[W]=k:delete S[W]},k=>{P=k},a))),i==null||i(),K(),d()}catch(R){if(!$.signal.aborted)try{const k=(B=o==null?void 0:o(R))!=null?B:P;window.clearTimeout(E),E=window.setTimeout(U,k)}catch(k){K(),g(k)}}})}U()})}function Ee(n){const e=n.headers.get("content-type");if(!(e!=null&&e.startsWith(L)))throw new Error(`Expected content-type to be ${L}, Actual: ${e}`)}const D=128,Ke=20;class Ue extends m{constructor(e,t,r){super(e!=null?e:v.create(),r),this.axiosInstance=e,this.getToken=t}getSessions(){return s(this,null,function*(){return this.get("/chatSession")})}postSession(e){return s(this,null,function*(){return this.post("/chatSession",e)})}getSession(e){return s(this,null,function*(){return this.get(`/chatSession/${e}`)})}updateSession(e,t){return s(this,null,function*(){return this.patch(`/chatSession/${e}`,t)})}deleteSession(e){return s(this,null,function*(){return this.delete(`/chatSession/${e}`)})}getSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.get(`chatSession/${e}/file`,t)})}postSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.post(`chatSession/${e}/file`,t)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`chatSession/${e}/file`,t)})}getSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.get(`chatSession/${e}/file/${t}`)})}deleteSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.delete(`chatSession/${e}/file/${t}`)})}getSessionChatHistory(e,t){return s(this,null,function*(){return this.get(`/chatSession/${e}/history`,t)})}postMessage(e,t,r){return s(this,null,function*(){return this.post(`/config/tenantApplication?applicationId=${e}&sessionId=${t}`,r)})}postComments(e,t){return s(this,null,function*(){return this.post(`/chatSession/${e}/comments`,t)})}listApplications(){return s(this,null,function*(){return this.list("/applications")})}getApplication(){return s(this,null,function*(){return this.get("/config/tenantApplication")})}postApplication(e){return s(this,null,function*(){return this.post("/config/tenantApplication",{applicationId:e})})}getRecommendQues(){return s(this,null,function*(){return this.get("/recommendQues")})}postRecommendQues(e){return s(this,null,function*(){return this.post("/recommendQues",e)})}patchRecommendQues(e,t){return s(this,null,function*(){return this.patch(`/recommendQues/${e}`,t)})}delRecommendQues(e){return s(this,null,function*(){return this.delete(`/recommendQues/${e}`)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{A.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const c=new Uint8Array(o.target.result),h={"Content-Type":"application/octet-stream"};A.putObjectBuffer(e.bucket,e.fileKeys[0],c,h,p=>{if(p)throw console.error(p),Error(p);r(e.fileKeys[0])})}})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>this.uploadMinioFile(a,t)).catch(a=>{throw Error(a)})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a,i)))).catch(a=>{throw Error(a)})})}getKnowledge(e,t){return s(this,null,function*(){return this.get("/knowledge",{docId:e,name:t})})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}`)})}updateKnowledgeIdFileId(e,t,r){return s(this,null,function*(){return this.patch(`/chatSession/${e}/file/${t}`,r)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}/data/${r}`)})}checkFileReady(e,t,r=()=>!0,a=1e4,i){return s(this,null,function*(){return new Promise((o,c)=>{const h=()=>{if(!r()){clearInterval(p);return}t?this.getSessionKnowledgeFile(e,t).then(l=>{if(i==null||i(l),l.status===T.Success&&(clearInterval(p),o(l)),l.status===T.Failed){clearInterval(p);const d="该文件无法读取,请上传可编辑pdf,doc,docx文档";c(Error(d,{cause:{code:-101,message:d,data:l}}))}}).catch(l=>{clearInterval(p),c(l)}):o(null)},p=setInterval(h,a);h()})})}postChat(e,t){return s(this,null,function*(){return this.post("/chat",e,t)})}postChatV2EventSource(e,t,r,a){return s(this,null,function*(){var h;const i={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},o=yield this.getToken(),c=w(y({},t),{stream:!0});V(`${(h=this.axiosInstance)==null?void 0:h.defaults.baseURL}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(c),openWhenHidden:!0,signal:r,onopen(p){return p.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(p){if(!p.data&&!p.event&&!p.id&&!p.retry)return;if(!p.data.includes('{"code": ')){let l={};try{l=JSON.parse(p.data)}catch(g){}(l==null?void 0:l.mtype)==="search"?i.searchReference.push(l):i.content=i.content+p.data;const d={content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:C(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(a==null?void 0:a.onmessage)&&a.onmessage(d)}const u=JSON.parse(p.data);if(i.reference=u.data.reference,i.messageTime=u.data.messageTime,i.messageId=u.data.messageId,i.llmModel=u.data.llmModel,i.code=u.code,u.code===200){const l={code:i.code,content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:i.messageTime,isReplying:!0};a!=null&&a.onmessage&&a.onmessage(l)}},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const p={code:i.code,content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:i.messageTime,comment:{isAgree:0},isReplying:!1};a!=null&&a.onclose&&a.onclose(p)}})})}postChatV3EventSource(e,t,r,a){return s(this,null,function*(){var h,p;const i={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,reasoningContent:"",thinkingSecs:"",thinkingStatus:"",searchingStatus:""},o=yield this.getToken(),c=w(y({},t),{stream:!0});V(`${(p=(h=this.axiosInstance)==null?void 0:h.defaults.baseURL)==null?void 0:p.replace("/v1","/v3")}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(c),openWhenHidden:!0,signal:r,onopen(u){return u.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(u){if(!u.data&&!u.event&&!u.id&&!u.retry)return;let l={};try{l=JSON.parse(u.data)}catch($){console.log("eventData",u.data)}const d=l.data.type,g=l.data.payload;i.isReplying=!0,d==="error"&&(i.code=l.code,i.message=l.message);const S=()=>{if(!i.searchingStatus){i.searchingStatus="start";return}if(i.searchingStatus==="start"){i.searchingStatus="end";return}};if(d==="beforeSearch"&&S(),d==="search"&&(i.code=l.code,i.message=l.message,i.searchReference.push(g)),d==="thinking"){S(),i.code=l.code,i.message=l.message,i.thinkingStatus="start";const I=g.choices[0];i.reasoningContent=i.reasoningContent+I.delta.reasoningContent}if(d==="thinkingOver"){i.code=l.code,i.message=l.message,i.thinkingStatus="end";const $=g.thinkingSecs;i.thinkingSecs=$}if(d==="text"){S(),i.code=l.code,i.message=l.message;const I=g.choices[0];i.content=i.content+I.delta.content}if(d==="reference"&&(i.code=l.code,i.message=l.message,i.reference=g),d==="result"){i.code=l.code,i.message=l.message;const $=g.messageId,I=g.llmModel,P=g.messageTime;i.messageId=$,i.llmModel=I,i.messageTime=P,i.sessionId=e}a!=null&&a.onmessage&&a.onmessage(i)},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const u=w(y({},i),{isReplying:!1});a!=null&&a.onclose&&a.onclose(u)}})})}getResourceToken(e){return s(this,null,function*(){return this.get("/resourceToken",e)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/upload/ticket",e)})}postPrompts(e){return s(this,null,function*(){return this.post("/prompts",e)})}listPrompt(e){return s(this,null,function*(){return e!=null&&e.title&&e.title.length>D?[]:this.get("/prompts",e)})}getPrompt(e){return s(this,null,function*(){return this.get(`/prompts/${e}`)})}updatePrompt(e,t){return s(this,null,function*(){return this.put(`/prompts/${e}`,t)})}deletePrompt(e){return s(this,null,function*(){return this.delete(`/prompts/${e}`)})}chatSessionIdContext(e){return s(this,null,function*(){return this.patch(`/chatSession/${e}/context`,{})})}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}getApplicationId(e){return s(this,null,function*(){return this.get(`/applications/${e}`)})}getAppService(){return s(this,null,function*(){return this.get("/appservice")})}}window.Buffer=x.Buffer;class Le extends m{constructor(e,t,r){super(e!=null?e:v.create(),r),this.axiosInstance=e,this.getToken=t}getApplicationIdSessions(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session`)})}getApplicationId(e,t){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`,t)})}postApplicationIdSession(e){return s(this,null,function*(){return this.post(`/data/v1/application/${e.applicationId}/sessions`,e)})}getApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}patchApplicationIdSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}/context`,{})})}delApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/sessions/${t}`)})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/sessions/${t}/comments`,r)})}getChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/chatHistory/${t}`)})}postChatV2EventSource(e,t,r,a,i,o){return s(this,null,function*(){const c={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},h=yield this.getToken(),p=w(y({},r),{stream:!0});V(`https://aiot-dev.glodon.com/api/cvforcepd/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${h}`,"Content-Type":"application/json"},body:JSON.stringify(p),openWhenHidden:!0,signal:a,onopen(u){return u.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(u){if(!u.data.includes('{"code": ')){let d={};try{d=JSON.parse(u.data)}catch(S){}(d==null?void 0:d.mtype)==="search"?c.searchReference.push(d):c.content=c.content+u.data;const g={content:c.content,role:1,reference:c.reference,searchReference:c.searchReference,messageId:c.messageId,sessionId:t,messageTime:C(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(i==null?void 0:i.onmessage)&&i.onmessage(g)}const l=JSON.parse(u.data);if(c.reference=l.data.reference,c.searchReference=l.data.searchReference,c.messageTime=l.data.messageTime,c.messageId=l.data.messageId,c.llmModel=l.data.llmModel,c.content=l.data.content,c.code=l.code,l.code===200){const d={code:c.code,content:c.content,role:1,reference:c.reference,searchReference:c.searchReference,messageId:c.messageId,sessionId:t,messageTime:c.messageTime,isReplying:!0};i!=null&&i.onmessage&&i.onmessage(d)}else return o&&o({code:l.code,message:l.message})},onerror(){i!=null&&i.onerror&&i.onerror()},onclose(){const u={code:c.code,content:c.content,role:1,reference:c.reference,searchReference:c.searchReference,messageId:c.messageId,sessionId:t,messageTime:c.messageTime,comment:{isAgree:0},isReplying:!1};i!=null&&i.onclose&&i.onclose(u)}})})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}/data/${r}`)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}`)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}`)})}getSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.get(`/data/v1/chatSession/${e}/file/${t}`)})}sleep(e){return s(this,null,function*(){return new Promise(t=>{setTimeout(()=>{t("")},e)})})}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.postTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a.minio,i)))).catch(a=>{throw Error(a)})})}postFile(e,t,r){return s(this,null,function*(){const a={files:[t.name],isv:"minio",knowledgeId:e,type:r};return this.postTicket(a).then(i=>this.uploadMinioFile(i.minio,t)).catch(i=>{throw Error(i)})})}postTicket(e){return s(this,null,function*(){return this.post("/data/v1/ticket",e)})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{A.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const c=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};A.putObjectBuffer(e.bucket,e.fileKeys[0],c,h,p=>{if(p)throw console.error(p),Error(p);r(e.fileKeys[0])})}})})}getRecommendQues(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/recommendQues`)})}postPrompts(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/prompts`,t)})}listPrompt(e,t){return s(this,null,function*(){return t!=null&&t.title&&t.title.length>D?[]:this.get(`/data/v1/application/${e}/prompts`,t)})}getPrompt(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/prompts/${t}`)})}updatePrompt(e,t,r){return s(this,null,function*(){return this.put(`/data/v1/application/${e}/prompts/${t}`,r)})}deletePrompt(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/prompts/${t}`)})}postGeneques(e,t){return s(this,null,function*(){return this.post("/data/v1/geneques",e,{},t)})}getApplicationIdSessionKnowledgeFiles(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file`,r)})}checkFileReady(e,t,r,a=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((c,h)=>{const p=()=>{if(!a()){clearInterval(u);return}r?this.getApplicationIdSessionKnowledgeFileId(e,t,r,{},!0).then(d=>{if(o==null||o(d),d.status===T.Success&&(clearInterval(u),c(d)),d.status===T.Failed){clearInterval(u);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:d}}))}}).catch(d=>{clearInterval(u),h(d)}):c(null)},u=setInterval(p,i);p()})})}getApplicationIdSessionKnowledgeFileId(e,t,r,a,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${r}`,a,i)})}delApplicationIdSessionKnowledgeFileId(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file/${r}`)})}postApplicationIdSessionKnowledgeSessionFile(e,t,r,a,i){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`,r,a,i)})}delApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file`,r)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`/data/v1/chatSession/${e}/file`,t)})}patchApplicationIdKnowledgeIdFileId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${r}`,a)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`)})}getApplicationIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/promptVariables`,t)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${r}`,a)})}updateSession(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}getSession(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}getSessionArtifacts(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}/artifacts`,void 0,!0)})}getSilenceDuration(){return s(this,null,function*(){return this.get("/data/v1/silenceDuration")})}}globalThis.Buffer=x.Buffer;class Ce extends m{constructor(e,t,r){super(e!=null?e:v.create(),r),this.axiosInstance=e,this.getToken=t}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}postGeneques(e){return s(this,null,function*(){return this.post("/data/v1/geneques",e)})}getApplicationId(e){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`)})}getApplicationIdSessions(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessionsa`,t)})}postApplicationIdSession(e){return s(this,null,function*(){return this.post(`/data/v1/application/${e.applicationId}/sessions`,e)})}getApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}patchApplicationIdSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}delApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/sessions/${t}`)})}getApplicationIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/promptVariables`,t)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${r}`,a)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`/data/v1/chatSession/${e}/file`,t)})}getRecommendQues(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/recommendQues`)})}postRecommendQues(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/recommendQues`,t)})}delRecommendQues(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/recommendQues/${t}`)})}getChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/chatHistory/${t}`)})}postPrompts(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/prompts`,t)})}listPrompt(e,t){return s(this,null,function*(){return t!=null&&t.title&&t.title.length>D?[]:this.get(`/data/v1/application/${e}/prompts`,t)})}getPrompt(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/prompts/${t}`)})}updatePrompt(e,t,r){return s(this,null,function*(){return this.put(`/data/v1/application/${e}/prompts/${t}`,r)})}deletePrompt(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/prompts/${t}`)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}/context`,{})})}getApplicationIdSessionKnowledgeFiles(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file`,r)})}postApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/file`,r)})}postApplicationIdSessionKnowledgeSessionFile(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`,r)})}delApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file`,r)})}getApplicationIdSessionKnowledgeFileId(e,t,r,a,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${r}`,a,i)})}delApplicationIdSessionKnowledgeFileId(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file/${r}`)})}patchApplicationIdKnowledgeIdFileId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${r}`,a)})}checkFileReady(e,t,r,a=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((c,h)=>{const p=()=>{if(!a()){clearInterval(u);return}r?this.getApplicationIdSessionKnowledgeFileId(e,t,r,{},!0).then(d=>{if(o==null||o(d),d.status===T.Success&&(clearInterval(u),c(d)),d.status===T.Failed){clearInterval(u);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:d}}))}}).catch(d=>{clearInterval(u),h(d)}):c(null)},u=setInterval(p,i);p()})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}postUploadTicket(e){return s(this,null,function*(){return this.post("/data/v1/ticket",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{A.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const c=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};A.putObjectBuffer(e.bucket,e.fileKeys[0],c,h,p=>{if(p)throw console.error(p),Error(p);r(e.fileKeys[0])})}})})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/sessions/${t}/comments`,r)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}`)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}`)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}/data/${r}`)})}postChatV2EventSource(e,t,r,a,i){return s(this,null,function*(){var p;const o={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,message:""},c=yield this.getToken(),h=w(y({},r),{stream:!0});V(`${(p=this.axiosInstance)==null?void 0:p.defaults.baseURL}/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${c}`,"Content-Type":"application/json"},body:JSON.stringify(h),openWhenHidden:!0,signal:a,onopen(u){return u.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(u){if(!u.data&&!u.event&&!u.id&&!u.retry)return;if(!u.data.includes('{"code": ')){let d={};try{d=JSON.parse(u.data)}catch(S){}(d==null?void 0:d.mtype)==="search"?o.searchReference.push(d):o.content=o.content+u.data;const g={content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:C(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(i==null?void 0:i.onmessage)&&i.onmessage(g)}const l=JSON.parse(u.data);if(o.reference=l.data.reference,o.messageTime=l.data.messageTime,o.messageId=l.data.messageId,o.llmModel=l.data.llmModel,o.code=l.code,o.message=l.message,l.code===200){const d={code:o.code,content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:o.messageTime,isReplying:!0};i!=null&&i.onmessage&&i.onmessage(d)}},onerror(){i!=null&&i.onerror&&i.onerror()},onclose(){const u={code:o.code,content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:o.messageTime,comment:{isAgree:0},isReplying:!1,message:o.message};i!=null&&i.onclose&&i.onclose(u)}})})}postChat(e,t){return s(this,null,function*(){var r;return this.post(`${(r=this.axiosInstance)==null?void 0:r.defaults.baseURL}/chat/v2/chat`,e,t)})}}var te=(n=>(n[n.Dialog=0]="Dialog",n[n.TextGenerate=1]="TextGenerate",n[n.FileSummery=2]="FileSummery",n))(te||{}),se=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(se||{}),re=(n=>(n[n.Processing=1]="Processing",n[n.Done=2]="Done",n[n.Failed=3]="Failed",n))(re||{}),ne=(n=>(n[n.File=0]="File",n[n.WebLink=1]="WebLink",n))(ne||{}),ae=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(ae||{}),ie=(n=>(n.InputFile="ui.input.file",n.LLMModel="ui.llm.model",n))(ie||{}),oe=(n=>(n[n.Idle=0]="Idle",n[n.Quoted=1]="Quoted",n))(oe||{}),ce=(n=>(n[n.Basic=0]="Basic",n[n.Pro=1]="Pro",n))(ce||{}),le=(n=>(n[n.Dialog=0]="Dialog",n[n.Text=1]="Text",n[n.Agent=2]="Agent",n[n.All=3]="All",n))(le||{}),de=(n=>(n.User="instruction",n.System="settings",n))(de||{});class xe extends m{constructor(e,t){super(e!=null?e:v.create(),t)}getKnowledge(e,t){return s(this,null,function*(){return this.get("/knowledge",{docId:e,name:t})})}postKnowledge(e){return s(this,null,function*(){return this.post("/knowledge",e)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/knowledge/${e}`)})}patchKnowledgeId(e,t){return s(this,null,function*(){return this.patch(`/knowledge/${e}`,t)})}delKnowledgeId(e){return s(this,null,function*(){return this.delete(`/knowledge/${e}`)})}getKnowledgeIdFile(e){return s(this,null,function*(){return this.get(`/knowledge/${e}/file`)})}getKnowledgeIdFileList(e,t){return s(this,null,function*(){return this.listPaged(`/knowledge/${e}/file`,t)})}postKnowledgeIdFile(e,t){return s(this,null,function*(){return this.post(`/knowledge/${e}/file`,t)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}delKnowledgeIdFileFid(e,t){return s(this,null,function*(){return this.delete(`/knowledge/${e}/file/${t}`)})}patchKnowledgeIdFileFid(e,t,r){return s(this,null,function*(){return this.patch(`/knowledge/${e}/file/${t}`,r)})}listSessions(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessionsa`,t)})}postSession(e,t){return s(this,null,function*(){return this.post(`/application/${e}/sessions`,t)})}getSession(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessions/${t}`)})}getSessionArtifacts(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessions/${t}/artifacts`)})}patchSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/application/${e}/sessions/${t}`,r)})}delSessionsId(e,t){return s(this,null,function*(){return this.delete(`/application/${e}/sessions/${t}`)})}getSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.get(`/application/${e}session/${t}/file/${r}`)})}postSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}session/${t}/file`,r)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/ticket",e)})}postApplicationIdSessionFile(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}/session/${t}/sessionfile`,r)})}getApplicationIdSessionFile(e,t,r){return s(this,null,function*(){return this.get(`/application/${e}/session/${t}/file/${r}`)})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}/sessions/${t}/comments`,r)})}getChatHistorySessionId(e,t,r){return s(this,null,function*(){return this.get(`application/${e}/chatHistory/${t}`,r)})}postChatHistorySessionId(e,t){return s(this,null,function*(){return this.post(`/chatHistory/${e}`,t)})}getApplications(e){return s(this,null,function*(){return this.get("/applications",e)})}postApplication(e){return s(this,null,function*(){return this.post("/applications",e)})}getApplicationId(e,t){return s(this,null,function*(){return this.get(`/applications/${e}`,t)})}patchApplicationId(e,t){return s(this,null,function*(){return this.patch(`/applications/${e}`,t)})}delApplicationId(e){return s(this,null,function*(){return this.delete(`/applications/${e}`)})}getApplicationIdSessions(e){return s(this,null,function*(){return this.get(`/applications/${e}/session`)})}patchFileId(e,t){return s(this,null,function*(){return this.patch(`/file/${e}`,t)})}getCvforceResource(e){return s(this,null,function*(){return this.get("/cvforce/resource",e)})}postKnowledgeIdComposedFiles(e,t){return s(this,null,function*(){return this.post(`/knowledge/${e}/composedFiles`,t)})}getTokensApplicationId(e,t){return s(this,null,function*(){return this.get(`/tokens/${e}`,t)})}getTokens(e){return s(this,null,function*(){return this.get("/tokens",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{A.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const c=x.Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};A.putObjectBuffer(e.bucket,e.fileKeys[0],c,h,p=>{if(p)throw console.error(p),Error(p);r(e.fileKeys[0])})}})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.getUploadTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.getUploadTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a.minio,i)))).catch(a=>{throw Error(a)})})}getAecModels(){return s(this,null,function*(){return this.get("/aecModels")})}postTextFilter(e){return s(this,null,function*(){return this.post("/textFilter",e)})}getTenantModel(){return s(this,null,function*(){return this.get("/tenantModel")})}getPrompts(e,t){return s(this,null,function*(){return this.get(`application/${e}/promptVariables`,t)})}postPrompt(e,t){return s(this,null,function*(){return this.post(`application/${e}/promptVariables`,t)})}patchPromptId(e,t,r){return s(this,null,function*(){return this.patch(`application/${e}/promptVariables/${t}`,r)})}delPromptId(e,t){return s(this,null,function*(){return this.delete(`application/${e}/promptVariables/${t}`)})}getSessionPrompts(e){return s(this,null,function*(){return this.get(`session/${e}/promptVariables`)})}patchSessionPromptId(e,t,r){return s(this,null,function*(){return this.patch(`session/${t}/promptVariables/${e}`,r)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/application/${e}/session/${t}/promptVariables`)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/application/${e}/session/${t}/promptVariables/${r}`,a)})}getPresetApplication(e){return s(this,null,function*(){return this.get("presetApplication",e)})}postKnowledgeConfig(e){return s(this,null,function*(){return this.post("/knowledgeConfig",e)})}getKnowledgeConfig(e){return s(this,null,function*(){return this.get(`/knowledgeConfig/${e}`)})}patchKnowledgeConfig(e,t){return s(this,null,function*(){return this.patch(`/knowledgeConfig/${e}`,t)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}`)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.listPaged(`/knowledge/${e}/file/${t}/data`,r)})}postKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.post(`/knowledge/${e}/file/${t}/data`,{data:r})})}patchKnowledgeIdFileIdData(e,t,r,a){return s(this,null,function*(){return this.patch(`/knowledge/${e}/file/${t}/data/${r}`,{data:a})})}delKnowledgeIdFileIdDataDid(e,t,r){return s(this,null,function*(){return this.delete(`/knowledge/${e}/file/${t}/data/${r}`)})}getPresetKnowledge(e){return s(this,null,function*(){return this.get("/presetKnowledge",e)})}patchSessionsIdContext(e){return s(this,null,function*(){return this.patch(`/sessions/${e}/context`,{})})}postResourceToken(e){return s(this,null,function*(){return this.post("/resourceToken",e)})}getApplicationIdSession(e){return s(this,null,function*(){return this.get(`/application/${e}/session`)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/application/${e}/sessions/${t}/context`,{})})}postApplicationIdSessions(e,t){return s(this,null,function*(){return this.post(`/application/${e}/sessions`,t)})}getApplicationIdChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/application/${e}/chatHistory/${t}`)})}postApplicationIdChatHistorySessionIdComments(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}/sessions/${t}/comments`,r)})}getApplicationIdPrompts(e,t){return s(this,null,function*(){return this.get(`/application/${e}/promptVariables`,t)})}postKnowledgeSourceFile(e,t,r){return s(this,null,function*(){return this.post(`/knowledge/${e}/sourceFile/${t}`,r)})}getMetadata(e){return s(this,null,function*(){return this.get("/metadata",e)})}postGeneques(e){return s(this,null,function*(){return this.post("/geneques",e)})}getBaseModel(e){return s(this,null,function*(){return this.get("/baseModelInfo",{serviceId:e})})}}var pe=(n=>(n[n.inital=0]="inital",n[n.success=1]="success",n[n.processing=2]="processing",n[n.failed=3]="failed",n))(pe||{}),ue=(n=>(n[n.inital=0]="inital",n[n.processing=1]="processing",n[n.paused=2]="paused",n[n.failed=3]="failed",n[n.done=4]="done",n))(ue||{}),f=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Failure="FAILURE",n.Success="SUCCESS",n.Abort="ABORT",n))(f||{}),he=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Success="SUCCESS",n.Failure="FAILURE ",n))(he||{}),ge=(n=>(n[n.all=0]="all",n[n.general=1]="general",n[n.major=2]="major",n))(ge||{});function Be(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){const e=Math.random()*16|0;return(n=="x"?e:e&3|8).toString(16)})}class Ne extends m{constructor(e,t){super(e!=null?e:v.create(),t)}getDatasets(e){return s(this,null,function*(){return this.get("/datasets",e)})}postDatasets(e){return s(this,null,function*(){return this.post("/datasets",e)})}getDatasetsId(e){return s(this,null,function*(){return this.get(`/datasets/${e}`)})}delDatasetsId(e){return s(this,null,function*(){return this.delete(`/datasets/${e}`)})}patchDatasetsId(e,t){return s(this,null,function*(){return this.patch(`/datasets/${e}`,t)})}getDatasetsIdVersions(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions?pageNo=${t}&pageSize=${r}`)})}getDatasetsIdVersionsVidNextno(e){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/nextno`)})}getS3Iam(e,t){return s(this,null,function*(){return this.post("/s3/iam",{datasetId:e,publicBucket:t})})}postDatasetsIdVersions(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/versions`,t)})}patchDatasetsIdVersionsVid(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}`,r)})}getDatasetsIdVersionsVid(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}`)})}delDatasetsIdVersionsVid(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}`)})}getDatasetsIdVersionsNo(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/no`,t)})}listDatasetsIdLabels(e,t){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/labels`,t)})}getDatasetsIdVersionsVidLabelcount(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/labelcount`,r)})}getDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/samples`,r)})}updateSamples(e,t,r,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/samples`,{samples:r,confirmStatus:a})})}delDatasetsIdVersionsVidSamplesId(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/samples/${r}`)})}delDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/samples`,{sampleIds:r})})}delDatasetsIdVersionsVidLlmSamplesId(e,t,r){return s(this,null,function*(){return this.delete(`datasets/${e}/versions/${t}/llmSamples/${r}`)})}getDatasetsIdVersionsVidSsamplesSid(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/samples/${r}`).then(a=>w(y({},a),{labels:a.labels?a.labels.map(i=>w(y({},i),{uuid:i.uuid||Be()})):[]}))})}getImportInfo(){return s(this,null,function*(){return this.get("/importInfo")})}getOptionsMarkType(){return s(this,null,function*(){return this.get("/options/markType")})}getOptionsOcrMarkTmpl(){return s(this,null,function*(){return this.get("/options/ocrMarkTmpl")})}getOptionsLlmMarkTmpl(){return s(this,null,function*(){return this.get("/options/llmMarkTmpl")})}getOptionsLlmResponseSort(){return s(this,null,function*(){return this.get("/options/llmResponseSort")})}getOptionsImgproxy(){return s(this,null,function*(){return this.get("/options/imgproxy")})}getDeduplication(e,t){return s(this,null,function*(){return this.post("/files/deduplication",{md5s:e,datasetId:t})})}postDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/samples`,r)})}patchDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/samples`,r)})}listCategory(e){return s(this,null,function*(){return this.list(`/datasets/${e}/catagory`)})}postCategory(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/catagory`,{name:t})})}updateCategory(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/catagory/${t}`,{name:r})})}deleteCategory(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/catagory/${t}`)})}postDatasetIdVersionIdFilesDeduplication(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/files/deduplication`,r)})}postDatasetIdVersionIdLlmSamples(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples`,r)})}patchDatasetIdVersionIdLlmSampleId(e,t,r,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamples/${r}`,a)})}postLlmSamplesSubsection(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/subsection`,r)})}generatellmSamplesSubsection(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/subsection`,r)})}listSubsection(e,t,r,a){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection`,a)})}postSubsection(e,t,r,a){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection`,a)})}updateSubsection(e,t,r,a,i){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection/${a}`,i)})}deleteSubsection(e,t,r,a){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection/${a}`)})}llmSupervisedRecordGenerate(e){return s(this,null,function*(){return this.post("/llm/supervisedRecord/generatedata",e)})}llmSupervisedRecordAbordTask(e){return s(this,null,function*(){return this.post("/llm/supervisedRecord/abortTask",e)})}llmSupervisedRecordPauseTask(e){return s(this,null,function*(){return this.post("/llm/supervisedRecord/pauseTask",e)})}getLlmSupervisedRecord(e){return s(this,null,function*(){return this.get(`/llm/supervisedRecord/${e}`)})}getDatasetsIdVersionsIdLlmSamplesV2(e,t,r){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/versions/${t}/llmSamplesV2`,r)})}postDatasetsIdVersionsIdLlmSamplesV2(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamplesV2`,r)})}getDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/llmSamplesV2/${r}`)})}patchDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,r,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamplesV2/${r}`,a)})}delDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/llmSamplesV2/${r}`)})}getDatasetsIdVersionsIdExportLLMSamples(e,t){return s(this,null,function*(){return this.getNonStandard(`/datasets/${e}/versions/${t}/exportLLMSamples`,{responseType:"blob"})})}llmSamplesSubsectionView(e,t,r,a){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/${r}/previewSubsection`,a)})}listLabels(e,t){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/labels`,t)})}postLabels(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/labels`,t)})}patchLabel(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/labels/${t}`,r)})}deleteLabel(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/labels/${t}`)})}postUploadPicsZip(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/uploadzip`,r)})}postVlmUploadPicsZip(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/vlmuploadzip`,r)})}checkFileResult(e,t,r,a=1e3,i,o){return s(this,null,function*(){return new Promise((c,h)=>{const p=()=>{e?i==="vlm"?this.getUploadVlmPicsZipResult(e,t,r).then(l=>{const d=l[0];if(d.state===f.Started||d.state===f.Pending){const g=d.process||0;o&&o(g)}if(d.state===f.Success&&(clearInterval(u),c(d.lastTaskResult)),d.state===f.Failure){clearInterval(u);const g="该文件处理失败";h(Error(g,{cause:{code:-101,message:g,data:d.lastTaskResult}}))}d.state===f.Abort&&(clearInterval(u),c(d.lastTaskResult))}).catch(l=>{clearInterval(u),h(l)}):this.getUploadPicsZipResult(e,t,r).then(l=>{const d=l[0];if(d.state===f.Started||d.state===f.Pending){const g=d.process||0;o&&o(g)}if(d.state===f.Success&&(clearInterval(u),c(d.lastTaskResult)),d.state===f.Failure){clearInterval(u);const g="该文件处理失败";h(Error(g,{cause:{code:-101,message:g,data:d.lastTaskResult}}))}d.state===f.Abort&&(clearInterval(u),c(d.lastTaskResult))}).catch(l=>{clearInterval(u),h(l)}):c(null)},u=setInterval(p,a);p()})})}getUploadPicsZipResult(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/uploadzip`,r)})}getUploadVlmPicsZipResult(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/vlmuploadzip`,r)})}getUploadabort(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/uploadabort`,r)})}postPreLabelTask(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/prelabeltask`,r)})}getPreLabelTask(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/prelabeltask`)})}delPreLabelTask(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/prelabeltask/${r}`)})}getAllConfirmSamples(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/confirm`)})}getDataSetCopyTask(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/copyDataset`)})}postDataSetCopyTask(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/copyDataset`,r)})}deleteDatasetCopyTask(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/copyDataset`,r)})}getDatasetsIdVersionsVidConfigs(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/labels`)})}saveVisionLabelConfigs(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/labels`,r)})}postGenerateVlmKieQa(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/samples/generator/vlm_kie_qa`,r)})}getDefaultQaTemplates(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/defaultQaTemplates`)})}getDatasetVersionCompareSummary(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/compare/summary`,t)})}getDatasetVersionCompareSamples(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/compare/samples`,t)})}}class Oe extends m{constructor(e,t){super(e!=null?e:v.create(),t)}listModelServices(e){return s(this,null,function*(){return this.listPaged("/modelService",e)})}postModelService(e){return s(this,null,function*(){return this.post("/modelService",e)})}getModelServiceById(e){return s(this,null,function*(){return this.get(`/modelService/${e}`)})}patchModelServiceById(e,t){return s(this,null,function*(){return this.patch(`/modelService/${e}`,t)})}deleteModelService(e){return s(this,null,function*(){return this.delete(`/modelService/${e}`)})}getEnableModelService(e){return s(this,null,function*(){return this.get(`/modelService/${e}/enable`)})}getDisableModelService(e){return s(this,null,function*(){return this.get(`/modelService/${e}/disable`)})}getModelServiceList(e){return s(this,null,function*(){return this.get(`/modelService/${e}/list`)})}getModelServiceDelist(e){return s(this,null,function*(){return this.get(`/modelService/${e}/delist`)})}importService(e){return s(this,null,function*(){return this.post("/modelService/import",e)})}patchModelService(e,t){return s(this,null,function*(){return this.patch(`/modelService/${e}`,t)})}openModelServices(e){return s(this,null,function*(){return this.get("/openModelService",e)})}importMirronService(e){return s(this,null,function*(){return this.post("/modelService/importMirron",e)})}patchMirronService(e,t){return s(this,null,function*(){return this.patch(`/modelService/importMirron/${e}`,t)})}getServiceSignList(e){return s(this,null,function*(){return this.get("/serviceSign",e)})}}var ye=(n=>(n[n.minio=0]="minio",n[n.pvc=1]="pvc",n))(ye||{}),me=(n=>(n.common="A100",n.idcard="A104",n.bankcard="A108",n.page="A112",n.rmwatermark="A115",n.seal="A116",n.rmseal="A117",n.table="A118",n))(me||{}),$e=(n=>(n.User="user",n.Assistant="assistant",n.System="system",n))($e||{});class He extends m{constructor(e,t){super(e!=null?e:v.create(),t)}ocr(e,t){return s(this,null,function*(){if(t.modelStore===ye.pvc){const r=this.convertToBatchParams(t),a=yield this.ocrPvcBatch(e,r);return this.convertToMinioResult(a)}else return this.ocrMinio(e,t)})}convertToBatchParams(e){return{pages:[{image:e.image}]}}convertToMinioResult(e){var t;return(t=e.pages)==null?void 0:t.flatMap(r=>{var a;return((a=r.textItems)==null?void 0:a.map(i=>({box:i.bbox})))||[]})}ocrMinio(e,t){return s(this,null,function*(){return t.image&&t.image.split("base64,").length>1&&(t.image=t.image.split("base64,")[1]),this.post(`/v2/infer?serviceId=${e}`,t)})}ocrPvcBatch(e,t){return s(this,null,function*(){return this.post(`/v2/infer?serviceId=${e}`,t)})}getSleep(e){return s(this,null,function*(){return new Promise(t=>{setTimeout(()=>{t(!0)},e*1e3)})})}postChatCompletions(e){return s(this,null,function*(){return this.postNonStandard("/v1/chat/completions",e)})}detection(e,t){return s(this,null,function*(){return this.post(`/v2/infer?serviceId=${e}`,t)})}detectionLayout(e,t){return s(this,null,function*(){if("pages"in t){const r=yield this.post(`/v2/infer?serviceId=${e}`,t);return this.convertLayoutToDetection(r)}else return this.post(`/v2/infer?serviceId=${e}`,t)})}convertLayoutToDetection(e){var t,r;return{prediction:((r=(t=e.pages[0])==null?void 0:t.layout)==null?void 0:r.map(a=>({box:a.bbox,label:a.type,score:a.score})))||[]}}getBaseModel(e){return s(this,null,function*(){return this.get("/v1/baseModel",{serviceId:e})})}postEmbeddings(e){return s(this,null,function*(){return this.postNonStandard("/v1/embeddings",e)})}postFile(e,t){return s(this,null,function*(){const r=new FormData;r.append("file",e,e.name);const a=yield this.http.post("/v1/files",r,{onUploadProgress:o=>{t==null||t(o.loaded,o.total||e.size)}}),i=q(a);if(!i)throw new Error("平台文件服务请求失败");return i})}getFile(e){return s(this,null,function*(){var t;try{const r=yield this.http.get(`/v1/files/${encodeURIComponent(e)}`);return q(r,!0)}catch(r){const a=r.response;if((a==null?void 0:a.status)===404||((t=a==null?void 0:a.data)==null?void 0:t.code)===fe)return;throw new Error("平台文件服务请求失败")}})}}const fe=11012;function _e(n){return n===0||n>=200&&n<300}function q(n,e=!1){var r;const t=n.data;if(!t||typeof t.code!="number")throw new Error("平台文件服务请求失败");if(t.code===fe){if(e)return;throw new Error("文件不存在")}if(!_e(t.code)||!((r=t.data)!=null&&r.id))throw new Error(t.message||"平台文件服务请求失败");return t.data}class Qe extends m{constructor(e,t){super(e!=null?e:v.create(),t)}listTasks(e){return s(this,null,function*(){return this.get("/tasks",e)})}createTask(e){return s(this,null,function*(){return this.post("/tasks",e)})}getTask(e){return s(this,null,function*(){return this.get(`/tasks/${e}`)})}updateTask(e,t){return s(this,null,function*(){return this.patch(`/tasks/${e}`,t)})}deleteTask(e){return s(this,null,function*(){return this.delete(`/tasks/${e}`)})}listTaskFiles(e){return s(this,null,function*(){return this.get(`/tasks/${e}/files`)})}uploadTaskFile(e,t){return s(this,null,function*(){return this.post(`/tasks/${e}/files`,t)})}listWorkflowExecutions(e){return s(this,null,function*(){return this.get("/workflows/executions",e)})}getWorkflowExecution(e){return s(this,null,function*(){return this.get(`/workflows/executions/${e}`)})}startWorkflowExecution(e){return s(this,null,function*(){return this.post("/workflows/executions",e)})}updateWorkflowExecution(e,t){return s(this,null,function*(){return this.patch(`/workflows/executions/${e}`,t)})}cancelWorkflowExecution(e){return s(this,null,function*(){return this.post(`/workflows/executions/${e}/cancel`,{})})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}}exports.AECPilotApi=Ue;exports.AIShopApi=He;exports.AecKnowledgeFileStatus=T;exports.AecpilotUIApi=Ce;exports.ApplicationTypes=le;exports.ArchiGptUIKeys=ie;exports.AuthApi=Ae;exports.BaseApi=m;exports.BotClientApi=Le;exports.CVForceApi=xe;exports.CVForceDatahubApi=Ne;exports.ChatMessageRole=se;exports.ChatMode=te;exports.ContralyzeApi=Qe;exports.DataApi=Te;exports.FileProccessStatus=re;exports.GenerateStatus=ue;exports.IChatRole=$e;exports.IDatasetLevel=ge;exports.IFileOrigin=ee;exports.IHistoryRole=b;exports.ISourceType=G;exports.ISpacetwinStatus=j;exports.IThinkingStatus=Z;exports.IversionInfo=X;exports.KnowledgeFileStatus=ae;exports.KnowledgeType=ce;exports.ModelServiceApi=Oe;exports.OCRServiceId=me;exports.PROMPT_SEARCH_MAX_LENGTH=D;exports.PROMPT_TITLE_MAX_LENGTH=Ke;exports.PanoramaApi=be;exports.PanoramaPluginMgrApi=Pe;exports.PreLabelTaskStatus=he;exports.PromptStatus=oe;exports.PromptVariableType=de;exports.RecordStatus=Y;exports.SourceType=ne;exports.SubsectionStatus=pe;exports.UploadZipsStatus=f;exports.needPrettifyMsg=J;exports.prettifyMsg=z;
@@ -21,6 +21,7 @@ export interface IArrange {
21
21
  greetings?: string;
22
22
  thinkingModeOpen?: boolean;
23
23
  thinkingTextOpen?: boolean;
24
+ autoGenerateSessionTitle?: boolean;
24
25
  }
25
26
  export interface IApplication {
26
27
  id: string;
@@ -0,0 +1,72 @@
1
+ import { AxiosInstance, AxiosRequestConfig } from 'axios';
2
+ import { ApiErrorHandler, BaseApi } from '../base';
3
+ import { IApplication, ICommentParam, IAecFile as IFile, IAecFileDataParam as IFileDataParam, IHistory, IAecKnowledge, IAecPrompt as IPrompt, IAecPromptParam as IPromptParam, IPromptType, IQuestion, IAecSessionParam as ISessionParam, IAecSession as ISession, KnowledgeFileMetadata, KnowledgeFileMetadataParams, IFileParams, IKnowledgeFileParams } from '../aecpilot/model';
4
+ import { IBaseModel, IUploadParam, IUploadTicket, MinioConfig } from './model';
5
+ import { IGeneques, IPromptVariables, ISessionPrompt } from '../aecpilotui/model';
6
+ export declare class BotClientUIApi extends BaseApi {
7
+ private axiosInstance;
8
+ private getToken;
9
+ constructor(axiosInstance: AxiosInstance, getToken: () => string, errorHandler?: ApiErrorHandler);
10
+ getApplicationIdSessions(appId: string): Promise<ISession[]>;
11
+ getApplicationId(id: string): Promise<IApplication>;
12
+ postApplicationIdSession(params: ISessionParam): Promise<ISession>;
13
+ getApplicationIdSessionsId(appId: string, id: string): Promise<ISession>;
14
+ patchApplicationIdSessionsId(appId: string, id: string, params: ISessionParam): Promise<ISession>;
15
+ patchApplicationIdSessionsIdContext(id: string, sid: string): Promise<unknown>;
16
+ delApplicationIdSessionsId(appId: string, id: string): Promise<ISession>;
17
+ postComments(id: string, sid: string, params: ICommentParam): Promise<unknown>;
18
+ getChatHistorySessionId(appId: string, sessionId: string): Promise<IHistory[]>;
19
+ postChatV2EventSource(applicationId: string, sessionId: string, params: any, signal: AbortSignal, options: {
20
+ onopen?: any;
21
+ onmessage?: any;
22
+ onerror?: any;
23
+ onclose?: any;
24
+ }, onAppStatusError?: (error: any) => void): Promise<void>;
25
+ getKnowledgeIdFileIdData(id: string, fid: string, did: string): Promise<IFileDataParam[]>;
26
+ getKnowledgeIdFileId(id: string, fid: string): Promise<IFile>;
27
+ getKnowledgeId(id: string): Promise<IAecKnowledge>;
28
+ getSessionKnowledgeFile(sessionId: string, fileId: string): Promise<KnowledgeFileMetadata>;
29
+ sleep(ms: number): Promise<unknown>;
30
+ getBaseModelInfo(serviceId: string): Promise<IBaseModel>;
31
+ uploadFiles(path: string, files: File[]): Promise<string[]>;
32
+ postFile(path: string, file: File, type?: number): Promise<string>;
33
+ postTicket(params: IUploadParam): Promise<IUploadTicket>;
34
+ uploadFile(path: string, file: File): Promise<string>;
35
+ uploadMinioFile(minioConfig: MinioConfig, file: File): Promise<string>;
36
+ getRecommendQues(appId: string): Promise<IQuestion[]>;
37
+ postPrompts(appId: string, params: IPromptParam): Promise<{
38
+ id: string;
39
+ }>;
40
+ listPrompt(appId: string, params?: {
41
+ title?: string;
42
+ type?: IPromptType;
43
+ }): Promise<IPrompt[]>;
44
+ getPrompt(appId: string, id: string): Promise<IPrompt>;
45
+ updatePrompt(appId: string, id: string, params: IPromptParam): Promise<string>;
46
+ deletePrompt(appId: string, id: string): Promise<string>;
47
+ postGeneques(params: {
48
+ content: string;
49
+ }, config?: AxiosRequestConfig): Promise<IGeneques>;
50
+ getApplicationIdSessionKnowledgeFiles(appId: string, sessionId: string, params?: {
51
+ enabled: number;
52
+ }): Promise<KnowledgeFileMetadata[]>;
53
+ checkFileReady(appId: string, sessionId: string, fileId?: string, shouldContinueFunc?: () => boolean, interval?: number, upateFileFn?: any): Promise<KnowledgeFileMetadata | null>;
54
+ getApplicationIdSessionKnowledgeFileId(appId: string, sessionId: string, fileId: string, params?: any, errInvisable?: boolean): Promise<KnowledgeFileMetadata>;
55
+ delApplicationIdSessionKnowledgeFileId(appId: string, sessionId: string, fileId: string): Promise<string>;
56
+ postApplicationIdSessionKnowledgeSessionFile(appId: string, sessionId: string, data: KnowledgeFileMetadataParams, params?: any, config?: AxiosRequestConfig): Promise<string>;
57
+ delApplicationIdSessionKnowledgeFile(appId: string, sessionId: string, params: {
58
+ files: IFileParams[];
59
+ }): Promise<any>;
60
+ deleteSessionKnowledgeFiles(sessionId: string, params: {
61
+ files: IFileParams[];
62
+ }): Promise<any>;
63
+ patchApplicationIdKnowledgeIdFileId(appId: string, sessionId: string, fid: string, params: IKnowledgeFileParams): Promise<IFile>;
64
+ getApplicationIdSessionIdPromptVariables(appId: string, sessionId: string): Promise<ISessionPrompt[]>;
65
+ getApplicationIdPromptVariables(appId: string, params?: {
66
+ status: number;
67
+ }): Promise<IPromptVariables[]>;
68
+ patchApplicationIdSessionpromptVariablesId(appId: string, sid: string, id: string, params: Partial<ISessionPrompt>): Promise<IPrompt[]>;
69
+ updateSession(appId: any, sid: string, params: ISessionParam): Promise<string>;
70
+ getSession(appId: string, sid: string): Promise<ISession>;
71
+ }
72
+ export * from './model';
@@ -0,0 +1,39 @@
1
+ export interface IBaseModel {
2
+ id: string;
3
+ name: string;
4
+ baseModelName: string;
5
+ maxModelLength: number;
6
+ }
7
+ export interface IUploadTicket {
8
+ minio: {
9
+ accessKey: string;
10
+ secretKey: string;
11
+ bucket: string;
12
+ expiredAt: number;
13
+ prefix: string;
14
+ endpoints: string[];
15
+ region: string;
16
+ useSSL: boolean;
17
+ fileKeys: string[];
18
+ };
19
+ }
20
+ export interface IUploadParam {
21
+ files: string[];
22
+ isv: string;
23
+ knowledgeId: string;
24
+ }
25
+ export interface MinioConfig {
26
+ accessKey: string;
27
+ secretKey: string;
28
+ bucket: string;
29
+ expiredAt: number;
30
+ prefix: string;
31
+ endpoints: string[];
32
+ region: string;
33
+ useSSL: boolean;
34
+ fileKeys: string[];
35
+ }
36
+ export interface ISessionParams {
37
+ name?: string;
38
+ netOpen?: number;
39
+ }
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { OCRMinioParams, OCRResult, IChatCompletion, DetectionParam, IDetectionResult, OCRPvcBatchParams, OCRBatchResult, IEmbedding, LayoutV1DetectionParam, LayoutV1IDetectionResult } from './model';
2
+ import { OCRMinioParams, OCRResult, IChatCompletion, DetectionParam, IDetectionResult, OCRPvcBatchParams, OCRBatchResult, IEmbedding, IAishopFile, LayoutV1DetectionParam, LayoutV1IDetectionResult } from './model';
3
3
  import { ApiErrorHandler, BaseApi } from '../base';
4
4
  import { IBaseModel } from '../aecpilotui/model';
5
5
  export declare class AIShopApi extends BaseApi {
@@ -24,5 +24,12 @@ export declare class AIShopApi extends BaseApi {
24
24
  convertLayoutToDetection(result: LayoutV1IDetectionResult): IDetectionResult;
25
25
  getBaseModel(serviceId: string): Promise<IBaseModel>;
26
26
  postEmbeddings(params: IEmbedding): Promise<any>;
27
+ /**
28
+ * 上传文件到平台。省略 purpose / saveTo,由服务端按 infer 和默认存储处理。
29
+ * 返回体里的 url 是预签名链接,由调用方放进工具结果交给模型。
30
+ */
31
+ postFile(file: File, onProgress?: (loaded: number, total: number) => void): Promise<IAishopFile>;
32
+ /** 查询文件并在签名将过期时由服务端续签。文件不存在时返回 undefined。 */
33
+ getFile(id: string): Promise<IAishopFile | undefined>;
27
34
  }
28
35
  export * from './model';
@@ -1,3 +1,12 @@
1
+ /** POST/GET /v1/files 的文件记录。url 是带签名的下载链接,不要写入日志。 */
2
+ export interface IAishopFile {
3
+ id: string;
4
+ bytes: number;
5
+ /** 已废弃,固定为 infer。 */
6
+ purpose?: string;
7
+ saveTo?: 'minio' | 'obs' | 'cos' | 'tos' | string;
8
+ url: string;
9
+ }
1
10
  export declare enum OCRServiceId {
2
11
  common = "A100",
3
12
  idcard = "A104",
@@ -4,6 +4,7 @@ export declare class BaseApi {
4
4
  private axios;
5
5
  private errorHandler?;
6
6
  constructor(axios: AxiosInstance, errorHandler?: ApiErrorHandler | undefined);
7
+ protected get http(): AxiosInstance;
7
8
  get<T>(path: string, params?: any, errInvisable?: boolean): Promise<T>;
8
9
  listPaged<T>(path: string, params?: any): Promise<Paged<T>>;
9
10
  list<T>(path: string, params?: any): Promise<T>;
@@ -1,7 +1,7 @@
1
1
  import { AxiosInstance, AxiosRequestConfig } from 'axios';
2
2
  import { ApiErrorHandler, BaseApi } from '../base';
3
3
  import { IApplication, ICommentParam, IAecFile as IFile, IAecFileDataParam as IFileDataParam, IHistory, IAecKnowledge, IAecPrompt as IPrompt, IAecPromptParam as IPromptParam, IPromptType, IQuestion, IAecSessionParam as ISessionParam, IAecSession as ISession, KnowledgeFileMetadata, KnowledgeFileMetadataParams, IFileParams, IKnowledgeFileParams } from '../aecpilot/model';
4
- import { IBaseModel, IUploadParam, IUploadTicket, MinioConfig } from './model';
4
+ import { IBaseModel, ISessionArtifacts, IUploadParam, IUploadTicket, MinioConfig } from './model';
5
5
  import { IGeneques, IPromptVariables, ISessionPrompt } from '../aecpilotui/model';
6
6
  import { PromptVariableType } from '../cvforce/model';
7
7
  export declare class BotClientApi extends BaseApi {
@@ -70,6 +70,7 @@ export declare class BotClientApi extends BaseApi {
70
70
  patchApplicationIdSessionpromptVariablesId(appId: string, sid: string, id: string, params: Partial<ISessionPrompt>): Promise<IPrompt[]>;
71
71
  updateSession(appId: any, sid: string, params: ISessionParam): Promise<string>;
72
72
  getSession(appId: string, sid: string): Promise<ISession>;
73
+ getSessionArtifacts(appId: string, sessionId: string): Promise<ISessionArtifacts>;
73
74
  getSilenceDuration(): Promise<any>;
74
75
  }
75
76
  export * from './model';
@@ -33,6 +33,15 @@ export interface MinioConfig {
33
33
  useSSL: boolean;
34
34
  fileKeys: string[];
35
35
  }
36
+ export interface ISessionArtifact {
37
+ name: string;
38
+ size: number;
39
+ url: string;
40
+ }
41
+ export interface ISessionArtifacts {
42
+ sessionId: string;
43
+ artifacts: ISessionArtifact[];
44
+ }
36
45
  export interface ISessionParams {
37
46
  name?: string;
38
47
  netOpen?: number;
@@ -1,8 +1,8 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import { ApiErrorHandler, BaseApi } from '../base';
3
- import { IKnowledge, IKnowledgeParam, IFileParam, IFile, IUploadParam, IUploadTicket, ISessionParam, ISession, ICommentParam, IChatMessage, IHistory, IApplication, IApplicationParam, IFileNameParam, IResource, IResourceParam, IComposedFile, IAppToken, IEmbeddingData, IAppList, MinioConfig, KnowledgeFileMetadata, KnowledgeFileMetadataParams, IAecModel, IPrompt, ISessionPrompt, IAppGetParam, IPresetApplication, IKnowledgeConfig, IFileData, IFileDataParam, IResourceTokenParam, IResourceToken, IPresetKnowledge, IMetaData, IGeneques, SessionQueryParams, ChatHistoryParams, PromptVariableType } from './model';
3
+ import { IKnowledge, IKnowledgeParam, IFileParam, IFile, IUploadParam, IUploadTicket, ISessionParam, ISession, ICommentParam, IChatMessage, IHistory, IApplication, IApplicationParam, IFileNameParam, IResource, IResourceParam, IComposedFile, IAppToken, IEmbeddingData, IAppList, MinioConfig, KnowledgeFileMetadata, KnowledgeFileMetadataParams, SessionFileParams, IAecModel, IPrompt, ISessionPrompt, IAppGetParam, IPresetApplication, IKnowledgeConfig, IFileData, IFileDataParam, IResourceTokenParam, IResourceToken, IPresetKnowledge, IMetaData, IGeneques, SessionQueryParams, ChatHistoryParams, PromptVariableType } from './model';
4
4
  import { PageQueryParams } from '../base/model';
5
- import { IBaseModel } from '../bot-client/model';
5
+ import { IBaseModel, ISessionArtifacts } from '../bot-client/model';
6
6
  export declare class CVForceApi extends BaseApi {
7
7
  constructor(axiosInstance?: AxiosInstance, errorHandler?: ApiErrorHandler);
8
8
  getKnowledge(docId?: string, name?: string): Promise<IKnowledge[]>;
@@ -27,10 +27,14 @@ export declare class CVForceApi extends BaseApi {
27
27
  listSessions(appId: string, params?: SessionQueryParams): Promise<ISession[]>;
28
28
  postSession(appId: string, params: ISessionParam): Promise<ISession>;
29
29
  getSession(appId: string, id: string): Promise<ISession>;
30
+ getSessionArtifacts(appId: string, sessionId: string): Promise<ISessionArtifacts>;
30
31
  patchSessionsId(appId: string, id: string, params: ISessionParam): Promise<ISession>;
31
32
  delSessionsId(appId: string, id: string): Promise<ISession>;
32
33
  getSessionKnowledgeFile(appId: string, sessionId: string, fileId: string): Promise<KnowledgeFileMetadata>;
33
34
  postSessionKnowledgeFile(appId: string, sessionId: string, params: KnowledgeFileMetadataParams): Promise<string>;
35
+ postUploadTicket(params: IUploadParam): Promise<IUploadTicket>;
36
+ postApplicationIdSessionFile(appId: string, sessionId: string, data: SessionFileParams): Promise<string>;
37
+ getApplicationIdSessionFile(appId: string, sessionId: string, fileId: string): Promise<KnowledgeFileMetadata>;
34
38
  /**
35
39
  * 异步提交会话评论信息
36
40
  * @param appid - 应用的 ID,用于标识具体的应用
@@ -318,6 +318,7 @@ export interface IArrange {
318
318
  relatedQuestionApp?: IRelatedQuestionApp;
319
319
  thinkingModeOpen?: boolean;
320
320
  thinkingTextOpen?: boolean;
321
+ autoGenerateSessionTitle?: boolean;
321
322
  }
322
323
  export interface IApplication {
323
324
  id: string;
@@ -409,6 +410,10 @@ export interface KnowledgeFileMetadataParams {
409
410
  url: string;
410
411
  size: number;
411
412
  }
413
+ export interface SessionFileParams extends KnowledgeFileMetadataParams {
414
+ type?: number;
415
+ origin?: string;
416
+ }
412
417
  export declare enum KnowledgeFileStatus {
413
418
  Processing = 1,
414
419
  Success = 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glodon-aiot/apis",
3
- "version": "3.25.1-alpha.7",
3
+ "version": "3.26.0-alpha.10",
4
4
  "author": "glodoncv",
5
5
  "description": "aiot apis",
6
6
  "type": "module",