@glodon-aiot/apis 3.18.0-alpha.10 → 3.18.0-alpha.12

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,32 +1,32 @@
1
- var o = (h, t, e) => new Promise((i, r) => {
1
+ var i = (u, t, e) => new Promise((r, o) => {
2
2
  var n = (s) => {
3
3
  try {
4
4
  c(e.next(s));
5
5
  } catch (a) {
6
- r(a);
6
+ o(a);
7
7
  }
8
- }, m = (s) => {
8
+ }, p = (s) => {
9
9
  try {
10
10
  c(e.throw(s));
11
11
  } catch (a) {
12
- r(a);
12
+ o(a);
13
13
  }
14
- }, c = (s) => s.done ? i(s.value) : Promise.resolve(s.value).then(n, m);
15
- c((e = e.apply(h, t)).next());
14
+ }, c = (s) => s.done ? r(s.value) : Promise.resolve(s.value).then(n, p);
15
+ c((e = e.apply(u, t)).next());
16
16
  });
17
- import p from "axios";
18
- import { ImodelStoreEnum as u } from "../cvforce-modelservice/model.mjs";
17
+ import h from "axios";
18
+ import { ImodelStoreEnum as v } from "../cvforce-modelservice/model.mjs";
19
19
  import { BaseApi as d } from "../base/index.mjs";
20
20
  class f extends d {
21
21
  constructor(t, e) {
22
- super(t != null ? t : p.create(), e);
22
+ super(t != null ? t : h.create(), e);
23
23
  }
24
24
  //之前用的接口,处理单个逻辑(兼容不同传参和响应格式)
25
25
  ocr(t, e) {
26
- return o(this, null, function* () {
27
- if (e.modelStore === u.pvc) {
28
- const i = this.convertToBatchParams(e), r = yield this.ocrPvcBatch(t, i);
29
- return this.convertToMinioResult(r);
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);
30
30
  } else
31
31
  return this.ocrMinio(t, e);
32
32
  });
@@ -40,28 +40,28 @@ class f extends d {
40
40
  }
41
41
  convertToMinioResult(t) {
42
42
  var e;
43
- return (e = t.pages) == null ? void 0 : e.flatMap((i) => {
44
- var r;
45
- return ((r = i.textItems) == null ? void 0 : r.map((n) => ({
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
46
  box: n.bbox
47
47
  }))) || [];
48
48
  });
49
49
  }
50
50
  //旧接口minio,处理单个逻辑
51
51
  ocrMinio(t, e) {
52
- return o(this, null, function* () {
52
+ return i(this, null, function* () {
53
53
  return e.image && e.image.split("base64,").length > 1 && (e.image = e.image.split("base64,")[1]), this.post(`/v2/infer?serviceId=${t}`, e);
54
54
  });
55
55
  }
56
56
  //新接口pvc,处理批量逻辑
57
57
  ocrPvcBatch(t, e) {
58
- return o(this, null, function* () {
58
+ return i(this, null, function* () {
59
59
  return this.post(`/v2/infer?serviceId=${t}`, e);
60
60
  });
61
61
  }
62
62
  // 接口延迟
63
63
  getSleep(t) {
64
- return o(this, null, function* () {
64
+ return i(this, null, function* () {
65
65
  return new Promise((e) => {
66
66
  setTimeout(() => {
67
67
  e(!0);
@@ -70,24 +70,43 @@ class f extends d {
70
70
  });
71
71
  }
72
72
  postChatCompletions(t) {
73
- return o(this, null, function* () {
73
+ return i(this, null, function* () {
74
74
  return this.postNonStandard("/v1/chat/completions", t);
75
75
  });
76
76
  }
77
77
  detection(t, e) {
78
- return o(this, null, function* () {
78
+ return i(this, null, function* () {
79
79
  return this.post(`/v2/infer?serviceId=${t}`, e);
80
80
  });
81
81
  }
82
+ detectionLayout(t, e) {
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);
87
+ } else
88
+ return this.post(`/v2/infer?serviceId=${t}`, e);
89
+ });
90
+ }
91
+ convertLayoutToDetection(t) {
92
+ var e, r;
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
98
+ }))) || []
99
+ };
100
+ }
82
101
  getBaseModel(t) {
83
- return o(this, null, function* () {
102
+ return i(this, null, function* () {
84
103
  return this.get("/v1/baseModel", {
85
104
  serviceId: t
86
105
  });
87
106
  });
88
107
  }
89
108
  postEmbeddings(t) {
90
- return o(this, null, function* () {
109
+ return i(this, null, function* () {
91
110
  return this.postNonStandard("/v1/embeddings", t);
92
111
  });
93
112
  }
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"),F=require("uuid"),L=require("dayjs"),x=require("buffer");class m{constructor(e,t){this.axios=e,this.errorHandler=t}get(e,t,r){return s(this,null,function*(){const 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}`)})}}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 ve=Object.defineProperty,Se=Object.defineProperties;var Ie=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var N=(n,e,t)=>e in n?ve(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,y=(n,e)=>{for(var t in e||(e={}))H.call(e,t)&&N(n,t,e[t]);if(M)for(var t of M(e))O.call(e,t)&&N(n,t,e[t]);return n},I=(n,e)=>Se(n,Ie(e));var Q=(n,e)=>{var t={};for(var r in n)H.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&M)for(var r of M(n))e.indexOf(r)<0&&O.call(n,r)&&(t[r]=n[r]);return t};var s=(n,e,t)=>new Promise((r,a)=>{var i=h=>{try{c(t.next(h))}catch(p){a(p)}},o=h=>{try{c(t.throw(h))}catch(p){a(p)}},c=h=>h.done?r(h.value):Promise.resolve(h.value).then(i,o);c((t=t.apply(n,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("axios"),A=require("@glodon-aiot/minio"),F=require("uuid"),x=require("dayjs"),C=require("buffer");class m{constructor(e,t){this.axios=e,this.errorHandler=t}get(e,t,r){return s(this,null,function*(){const a=this.axios.get(e,{params:t});return this.handleResponse(a,r)})}listPaged(e,t){return s(this,null,function*(){const r=this.axios.get(e,{params:t});return this.handleResponse(r)})}list(e,t){return s(this,null,function*(){const r=this.axios.get(e,{params:t});return this.handleResponse(r)})}delete(e,t){return s(this,null,function*(){const r=this.axios.delete(e,{params:t});return this.handleResponse(r)})}post(e,t,r,a){return s(this,null,function*(){const i=this.axios.post(e,t,y({params:r},a));return this.handleResponse(i)})}postForm(e,t,r){return s(this,null,function*(){const a=this.axios.post(e,t,{params:r,headers:{"Content-Type":"multipart/form-data"}});return this.handleResponse(a)})}patch(e,t,r){return s(this,null,function*(){const a=this.axios.patch(e,t,{params:r});return this.handleResponse(a)})}put(e,t){return s(this,null,function*(){const r=this.axios.put(e,t);return this.handleResponse(r)})}upload(e,t,r){return s(this,null,function*(){const a=this.axios.post(e,t,y({},r));return this.handleResponse(a)})}getNonStandard(e,t){return s(this,null,function*(){const r=this.axios.get(e,t);try{const a=yield r;if(a.status===200)return a}catch(a){throw this.handleError(a)}})}postNonStandard(e,t,r,a){return s(this,null,function*(){var c,h;const o=yield this.axios.post(e,t,y({params:r},a));if(o.status===200)if((c=o.data)!=null&&c.code)(h=this.errorHandler)!=null&&h.onAppStatusError&&this.errorHandler.onAppStatusError(o.data.code,o.data.message);else return o.data})}handleResponse(e,t){return s(this,null,function*(){try{const r=yield e;return this.handleAppError(r.data,t).data}catch(r){throw this.handleError(r)}})}handleAppError(e,t){var r;if(e.code<200||e.code>=300)throw(r=this.errorHandler)!=null&&r.onAppStatusError?this.errorHandler.onAppStatusError(e.code,J(e.code,e.message),t):console.error("未处理应用错误:",e),{isAxiosError:!1,message:e.message};return e}handleError(e){var t,r;return e.response?(t=this.errorHandler)!=null&&t.onHttpStatusError&&(console.log("HTTP 错误",this.errorHandler),this.errorHandler.onHttpStatusError(e.response.status,"",e.response)):e.request?(console.log(e.request),(r=this.errorHandler)!=null&&r.onNetworkError&&this.errorHandler.onNetworkError()):console.error("axios request config error:",e),new Error(e.message)}}const q=n=>n>=10002&&n<=10012,J=(n,e)=>q(n)?"数据操作错误":e||"未知接口错误";class ke extends m{constructor(e,t){super(e!=null?e:v.create(),t)}getLoginUrl(){return s(this,null,function*(){return this.get("/openAddress")})}getToken(e,t){return s(this,null,function*(){return this.get(e,t)})}getAIoTTokenByGTeamToken(e){return s(this,null,function*(){return this.post("/validate/glodonCloud",e).then(t=>t.accessToken)})}postRefreshToken(e,t,r,a="3600",i){return s(this,null,function*(){return this.post("/refresh-token",{oldToken:e,tenant:t,orgId:r,expired:a,product:i})})}logout(){return s(this,null,function*(){return this.post("/logout",{})})}}class we extends m{constructor(e,t){super(e!=null?e:v.create(),t)}getTenant(e){return s(this,null,function*(){return this.get(`/tenant/${e}`)})}listProduct(){return s(this,null,function*(){return this.list("/products")})}listProvinces(){return s(this,null,function*(){return this.list("/regions/provinces")})}listCities(e){return s(this,null,function*(){return this.list(`/regions/provinces/${e}/city`)})}listCounties(e,t){return s(this,null,function*(){return this.list(`/regions/provinces/${e}/city/${t}/county`)})}getOrgList(e){return s(this,null,function*(){return this.list("/org",e)})}getUserIdOrgList(e,t){return s(this,null,function*(){return this.list(`/users/${e}/org`,t)})}delOrg(e){return s(this,null,function*(){return this.delete(`/org/${e}`)})}postOrg(e){return s(this,null,function*(){return this.post("/org",e)})}patchOrg(e,t){return s(this,null,function*(){return this.patch(`/org/${e}`,t)})}getUsers(e,t){return s(this,null,function*(){return this.list(`/tenant/${e}/users`,t)})}delUser(e,t){return s(this,null,function*(){return this.delete(`/tenant/${e}/users/${t}`)})}postUser(e,t){return s(this,null,function*(){return this.post(`/tenant/${e}/users`,t)})}patchUser(e,t,r){return s(this,null,function*(){return this.patch(`tenant/${e}/users/${t}`,r)})}getTenantList(){return s(this,null,function*(){return this.get("/tenant")})}getUserIdRoles(e){return s(this,null,function*(){return this.get(`/users/${e}/role`)})}getProductCodeRole(e){return s(this,null,function*(){return this.get(`/products/${e}/role`)})}postUserRole(e,t){return s(this,null,function*(){return this.post(`/users/${e}/role`,t)})}patchUserRole(e,t,r){return s(this,null,function*(){return this.patch(`/users/${e}/role/${t}`,r)})}deleteUserRole(e,t){return s(this,null,function*(){return this.delete(`/users/${e}/role/${t}`)})}getUsersIdProductCodeMenu(e,t,r="web",a){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/menu?groupCode=${r}`,{level:a})})}getUserInfo(e){return s(this,null,function*(){return this.get(`/users/${e}`)})}uipermission(e,t,r="web"){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/uipermission?groupCode=${r}`)})}getAppInfo(e){return s(this,null,function*(){return this.get(`/products/${e}/apps`)})}getTenantUserInfo(e,t){return s(this,null,function*(){return this.get(`/tenant/${e}/users/${t}`)})}uploadFile(e){return s(this,null,function*(){return this.upload("/upload",e)})}getUserIdProductCodeOrg(e,t){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/org`)})}getOrg(e){return s(this,null,function*(){return this.get(`/org/${e}`)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}putAppInfo(e,t){return s(this,null,function*(){return this.put(`/products/${e}/apps`,t)})}getTenantKeySecret(e){return s(this,null,function*(){return this.get(`/tenant/${e}/key`)})}resetTenantKeySecret(e){return s(this,null,function*(){return this.post(`/tenant/${e}/resetSecret`,void 0)})}getProductsCode(e){return s(this,null,function*(){return this.get(`/products/${e}`)})}getLongtermTokens(e){return s(this,null,function*(){return this.listPaged("/longterm-token",e)})}postLongtermToken(e){return s(this,null,function*(){return this.post("/longterm-token",e)})}deleteLongtermToken(e){return s(this,null,function*(){return this.delete(`/longterm-token/${e}`)})}}var z=(n=>(n.Collecting="采集中",n.CollectionTimeout="超时",n.CollectionFinish="完成",n.WaitUpload="等待上传",n.Uploading="上传中",n.UploadFinish="上传完成",n.UploadFailed="上传失败",n.WaitMerge="等待合成",n.CreateMergeTaskFailed="创建合成任务失败",n.Merging="合成中",n.MergeFailed="合成失败",n.MergeFinish="合成成功",n))(z||{}),Y=(n=>(n.Collecting="采集中",n.CollectionTimeout="超时",n.CollectionFinish="完成",n.WaitUpload="等待上传",n.Uploading="上传中",n.UploadFinish="上传完成",n.UploadFailed="上传失败",n.WaitMerge="等待合成",n.CreateMergeTaskFailed="创建合成任务失败",n.Merging="合成中",n.MergeFailed="合成失败",n.MergeFinish="合成成功",n))(Y||{});class Ae extends m{constructor(e,t){super(e!=null?e:v.create(),t)}static parseApiToken(e){const t=window.atob(e.split(".")[1]);return JSON.parse(t)}static loadApiToken(e,t,r){return s(this,null,function*(){return fetch(`${e}${t}/viewtoken/${r}/create_apitoken`,{method:"POST"}).then(a=>{if(a.status!==200)throw console.error(a),Error(JSON.stringify(a));return a.json()}).then(a=>{if(a.code!==200)throw Error(JSON.stringify(a));return a.data.apiToken})})}listRecord(e){return s(this,null,function*(){return this.listPaged("/spacetwins",e)})}postRecord(e){return s(this,null,function*(){return this.post("/spacetwins",e)})}getRecordOverview(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}`)})}getRecordViewtoken(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}/viewtoken`)})}listScene(e){return s(this,null,function*(){return this.list(`/spacetwins/${e}/scenes`)})}getScenesByTimestamp(e,t){return s(this,null,function*(){return this.list(`/spacetwins/${e}/scenes_timestamp`,{timestamp:t})})}recomputeTrack(e,t){return s(this,null,function*(){return this.patch(`/spacetwins/${e}/track`,{points:t})})}updateRecordUploadStatus(e,t){return s(this,null,function*(){return this.post(`/spacetwins/${e}/update_upload_status`,t)})}getApiToken(e){return s(this,null,function*(){return this.post(`/viewtoken/${e}/create_apitoken`,{})})}getSpacetwins(e){return s(this,null,function*(){return this.listPaged("/spacetwins",e)})}postSpacetwins(e){return s(this,null,function*(){return this.post("/spacetwins",e)})}updateInspection(e,t){return s(this,null,function*(){return this.patch(`/patrolInspection/${e}`,t)})}getSpacetwinsIdViewtoken(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}/viewtoken`)})}postSpacetwinsIdUpdateUploadStatus(e,t){return s(this,null,function*(){return this.post(`/spacetwins/${e}/update_upload_status`,t)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/upload/ticket",e)})}getDownloadUrl(e){return s(this,null,function*(){return this.get(`/download/url?isv=${e.isv}&key=${e.key}`)})}listTrack(e,t){return s(this,null,function*(){return this.list(`/spacetwins/${e}/track`,{type:t})})}}class Te extends m{constructor(e,t){super(e!=null?e:v.create(),t)}listPlugin(e){return s(this,null,function*(){return this.list("/plugins",e)})}postPlugin(e){return s(this,null,function*(){return this.post("/plugins",e)})}getPlugin(e){return s(this,null,function*(){return this.get(`/plugins/${e}`)})}updatePlugin(e,t){return s(this,null,function*(){return this.patch(`/plugins/${e}`,t)})}listPluginData(e,t){return s(this,null,function*(){return this.list(`/plugins/${e}/datas`,t)})}postPluginData(e,t){return s(this,null,function*(){return this.post(`/plugins/${e}/datas`,t)})}getPluginData(e,t){return s(this,null,function*(){return this.get(`/plugins/${e}/datas/${t}`).then(r=>I(y({},r),{arguments:JSON.parse(r.arguments)}))})}updatePluginData(e,t,r){return s(this,null,function*(){return this.patch(`/plugins/${e}/datas/${t}`,r)})}deletePluginData(e,t){return s(this,null,function*(){return this.delete(`/plugins/${e}/datas/${t}`)})}}var j=(n=>(n[n.None=0]="None",n[n.SourceFile=1]="SourceFile",n[n.WebLink=2]="WebLink",n))(j||{}),G=(n=>(n.Unprotected="不受著作权保护",n.ProtectAuthorize="受著作权保护,已获得授权",n.ProtectUnauthorize="受著作权保护,未获得授权",n))(G||{}),b=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(b||{}),X=(n=>(n.Start="start",n.End="end",n))(X||{}),T=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(T||{}),Z=(n=>(n.AECPILOT="aecpilot",n))(Z||{});function be(n,e){return s(this,null,function*(){const t=n.getReader();let r;for(;!(r=yield t.read()).done;)e(r.value)})}function Pe(n){let e,t,r,a=!1,i;return function(c){e===void 0?(e=c,t=0,r=-1,i=!1):e=Me(e,c);const h=e.length;let p=0;for(;t<h;){a&&(e[t]===10&&(p=++t),a=!1);let u=-1;for(;t<h&&u===-1;++t)switch(e[t]){case 58:r===-1&&(r=t-p);break;case 13:a=!1,t+4<h&&e[t+1]===10&&e[t+2]!==13&&e[t-1]!==10&&e[t-2]!==13&&(i=!0);case 10:u=t;break}if(u===-1)break;n(e.subarray(p,u),r,i),p=t,r=-1,i=!1}p===h?e=void 0:p!==0&&(e=e.subarray(p),t-=p)}}function Re(n,e,t){let r=_();const a=new TextDecoder;return function(o,c,h){if(o.length===0)t==null||t(r),r=_();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",Fe=1e3,W="last-event-id";function V(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||U()}c||document.addEventListener("visibilitychange",k);let P=Fe,K=0;function E(){document.removeEventListener("visibilitychange",k),window.clearTimeout(K),$.abort()}e==null||e.addEventListener("abort",()=>{E(),d()});const $e=h!=null?h:window.fetch,fe=r!=null?r:Ve;function U(){return s(this,null,function*(){var B;$=new AbortController;try{const R=yield $e(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(U,w)}catch(w){E(),g(w)}}})}U()})}function Ve(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:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},o=yield this.getToken(),c=I(y({},t),{stream:!0});V(`${(h=this.axiosInstance)==null?void 0:h.defaults.baseURL}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(c),openWhenHidden:!0,signal:r,onopen(p){return p.ok&&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:L(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:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,reasoningContent:"",thinkingSecs:"",thinkingStatus:"",searchingStatus:""},o=yield this.getToken(),c=I(y({},t),{stream:!0});V(`${(p=(h=this.axiosInstance)==null?void 0:h.defaults.baseURL)==null?void 0:p.replace("/v1","/v3")}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(c),openWhenHidden:!0,signal:r,onopen(u){return u.ok&&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:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},h=yield this.getToken(),p=I(y({},r),{stream:!0});V(`https://aiot-dev.glodon.com/api/cvforcepd/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${h}`,"Content-Type":"application/json"},body:JSON.stringify(p),openWhenHidden:!0,signal: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:L(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(i==null?void 0:i.onmessage)&&i.onmessage(g)}const l=JSON.parse(u.data);if(c.reference=l.data.reference,c.searchReference=l.data.searchReference,c.messageTime=l.data.messageTime,c.messageId=l.data.messageId,c.llmModel=l.data.llmModel,c.content=l.data.content,c.code=l.code,l.code===200){const d={code:c.code,content:c.content,role:1,reference:c.reference,searchReference:c.searchReference,messageId:c.messageId,sessionId:t,messageTime:c.messageTime,isReplying:!0};i!=null&&i.onmessage&&i.onmessage(d)}else return o&&o({code:l.code,message:l.message})},onerror(){i!=null&&i.onerror&&i.onerror()},onclose(){const u={code:c.code,content:c.content,role:1,reference:c.reference,searchReference:c.searchReference,messageId:c.messageId,sessionId:t,messageTime:c.messageTime,comment:{isAgree:0},isReplying:!1};i!=null&&i.onclose&&i.onclose(u)}})})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}/data/${r}`)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}`)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}`)})}getSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.get(`/data/v1/chatSession/${e}/file/${t}`)})}sleep(e){return s(this,null,function*(){return new Promise(t=>{setTimeout(()=>{t("")},e)})})}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(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 Ue extends m{constructor(e,t,r){super(e!=null?e:v.create(),r),this.axiosInstance=e,this.getToken=t}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}postGeneques(e){return s(this,null,function*(){return this.post("/data/v1/geneques",e)})}getApplicationId(e){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`)})}getApplicationIdSessions(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessionsa`,t)})}postApplicationIdSession(e){return s(this,null,function*(){return this.post(`/data/v1/application/${e.applicationId}/sessions`,e)})}getApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}patchApplicationIdSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}delApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/sessions/${t}`)})}getApplicationIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/promptVariables`,t)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`)})}patchApplicationIdSessionpromptVariablesId(e,t,r,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:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,message:""},c=yield this.getToken(),h=I(y({},r),{stream:!0});V(`${(p=this.axiosInstance)==null?void 0:p.defaults.baseURL}/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${c}`,"Content-Type":"application/json"},body:JSON.stringify(h),openWhenHidden:!0,signal: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:L(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(i==null?void 0:i.onmessage)&&i.onmessage(g)}const l=JSON.parse(u.data);if(o.reference=l.data.reference,o.messageTime=l.data.messageTime,o.messageId=l.data.messageId,o.llmModel=l.data.llmModel,o.code=l.code,o.message=l.message,l.code===200){const d={code:o.code,content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:o.messageTime,isReplying:!0};i!=null&&i.onmessage&&i.onmessage(d)}},onerror(){i!=null&&i.onerror&&i.onerror()},onclose(){const u={code:o.code,content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:o.messageTime,comment:{isAgree:0},isReplying:!1,message:o.message};i!=null&&i.onclose&&i.onclose(u)}})})}postChat(e,t){return s(this,null,function*(){var r;return this.post(`${(r=this.axiosInstance)==null?void 0:r.defaults.baseURL}/chat/v2/chat`,e,t)})}}var ee=(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 Le(){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||Le()})):[]}))})}getImportInfo(){return s(this,null,function*(){return this.get("/importInfo")})}getOptionsMarkType(){return s(this,null,function*(){return this.get("/options/markType")})}getOptionsOcrMarkTmpl(){return s(this,null,function*(){return this.get("/options/ocrMarkTmpl")})}getOptionsLlmMarkTmpl(){return s(this,null,function*(){return this.get("/options/llmMarkTmpl")})}getOptionsLlmResponseSort(){return s(this,null,function*(){return this.get("/options/llmResponseSort")})}getOptionsImgproxy(){return s(this,null,function*(){return this.get("/options/imgproxy")})}getDeduplication(e,t){return s(this,null,function*(){return this.post("/files/deduplication",{md5s:e,datasetId:t})})}postDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/samples`,r)})}patchDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/samples`,r)})}listCategory(e){return s(this,null,function*(){return this.list(`/datasets/${e}/catagory`)})}postCategory(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/catagory`,{name:t})})}updateCategory(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/catagory/${t}`,{name:r})})}deleteCategory(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/catagory/${t}`)})}postDatasetIdVersionIdFilesDeduplication(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/files/deduplication`,r)})}postDatasetIdVersionIdLlmSamples(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples`,r)})}patchDatasetIdVersionIdLlmSampleId(e,t,r,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`)})}}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)})}getBaseModel(e){return s(this,null,function*(){return this.get("/v1/baseModel",{serviceId:e})})}postEmbeddings(e){return s(this,null,function*(){return this.postNonStandard("/v1/embeddings",e)})}}class He extends m{constructor(e,t){super(e!=null?e:v.create(),t)}listTasks(e){return s(this,null,function*(){return this.get("/tasks",e)})}createTask(e){return s(this,null,function*(){return this.post("/tasks",e)})}getTask(e){return s(this,null,function*(){return this.get(`/tasks/${e}`)})}updateTask(e,t){return s(this,null,function*(){return this.patch(`/tasks/${e}`,t)})}deleteTask(e){return s(this,null,function*(){return this.delete(`/tasks/${e}`)})}listTaskFiles(e){return s(this,null,function*(){return this.get(`/tasks/${e}/files`)})}uploadTaskFile(e,t){return s(this,null,function*(){return this.post(`/tasks/${e}/files`,t)})}listWorkflowExecutions(e){return s(this,null,function*(){return this.get("/workflows/executions",e)})}getWorkflowExecution(e){return s(this,null,function*(){return this.get(`/workflows/executions/${e}`)})}startWorkflowExecution(e){return s(this,null,function*(){return this.post("/workflows/executions",e)})}updateWorkflowExecution(e,t){return s(this,null,function*(){return this.patch(`/workflows/executions/${e}`,t)})}cancelWorkflowExecution(e){return s(this,null,function*(){return this.post(`/workflows/executions/${e}/cancel`,{})})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}}exports.AECPilotApi=Ke;exports.AIShopApi=Ne;exports.AecKnowledgeFileStatus=T;exports.AecpilotUIApi=Ue;exports.ApplicationTypes=ce;exports.ArchiGptUIKeys=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 Me(n,e){const t=new Uint8Array(n.length+e.length);return t.set(n),t.set(e,n.length),t}function _(){return{data:"",event:"",id:"",retry:void 0}}const U="text/event-stream",Fe=1e3,W="last-event-id";function V(n,u){var l=u,{signal:e,headers:t,onopen:r,onmessage:a,onclose:i,onerror:o,openWhenHidden:c,fetch:h}=l,p=Q(l,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((d,g)=>{const S=y({},t);S.accept||(S.accept=U);let $;function k(){$.abort(),document.hidden||L()}c||document.addEventListener("visibilitychange",k);let P=Fe,K=0;function E(){document.removeEventListener("visibilitychange",k),window.clearTimeout(K),$.abort()}e==null||e.addEventListener("abort",()=>{E(),d()});const $e=h!=null?h:window.fetch,fe=r!=null?r:Ve;function L(){return s(this,null,function*(){var B;$=new AbortController;try{const R=yield $e(n,I(y({},p),{headers:S,signal:$.signal}));yield fe(R),yield be(R.body,Pe(Re(w=>{w?S[W]=w:delete S[W]},w=>{P=w},a))),i==null||i(),E(),d()}catch(R){if(!$.signal.aborted)try{const w=(B=o==null?void 0:o(R))!=null?B:P;window.clearTimeout(K),K=window.setTimeout(L,w)}catch(w){E(),g(w)}}})}L()})}function Ve(n){const e=n.headers.get("content-type");if(!(e!=null&&e.startsWith(U)))throw new Error(`Expected content-type to be ${U}, Actual: ${e}`)}const D=128,De=20;class Ke extends m{constructor(e,t,r){super(e!=null?e:v.create(),r),this.axiosInstance=e,this.getToken=t}getSessions(){return s(this,null,function*(){return this.get("/chatSession")})}postSession(e){return s(this,null,function*(){return this.post("/chatSession",e)})}getSession(e){return s(this,null,function*(){return this.get(`/chatSession/${e}`)})}updateSession(e,t){return s(this,null,function*(){return this.patch(`/chatSession/${e}`,t)})}deleteSession(e){return s(this,null,function*(){return this.delete(`/chatSession/${e}`)})}getSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.get(`chatSession/${e}/file`,t)})}postSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.post(`chatSession/${e}/file`,t)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`chatSession/${e}/file`,t)})}getSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.get(`chatSession/${e}/file/${t}`)})}deleteSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.delete(`chatSession/${e}/file/${t}`)})}getSessionChatHistory(e,t){return s(this,null,function*(){return this.get(`/chatSession/${e}/history`,t)})}postMessage(e,t,r){return s(this,null,function*(){return this.post(`/config/tenantApplication?applicationId=${e}&sessionId=${t}`,r)})}postComments(e,t){return s(this,null,function*(){return this.post(`/chatSession/${e}/comments`,t)})}listApplications(){return s(this,null,function*(){return this.list("/applications")})}getApplication(){return s(this,null,function*(){return this.get("/config/tenantApplication")})}postApplication(e){return s(this,null,function*(){return this.post("/config/tenantApplication",{applicationId:e})})}getRecommendQues(){return s(this,null,function*(){return this.get("/recommendQues")})}postRecommendQues(e){return s(this,null,function*(){return this.post("/recommendQues",e)})}patchRecommendQues(e,t){return s(this,null,function*(){return this.patch(`/recommendQues/${e}`,t)})}delRecommendQues(e){return s(this,null,function*(){return this.delete(`/recommendQues/${e}`)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{A.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const c=new Uint8Array(o.target.result),h={"Content-Type":"application/octet-stream"};A.putObjectBuffer(e.bucket,e.fileKeys[0],c,h,p=>{if(p)throw console.error(p),Error(p);r(e.fileKeys[0])})}})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>this.uploadMinioFile(a,t)).catch(a=>{throw Error(a)})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a,i)))).catch(a=>{throw Error(a)})})}getKnowledge(e,t){return s(this,null,function*(){return this.get("/knowledge",{docId:e,name:t})})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}`)})}updateKnowledgeIdFileId(e,t,r){return s(this,null,function*(){return this.patch(`/chatSession/${e}/file/${t}`,r)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}/data/${r}`)})}checkFileReady(e,t,r=()=>!0,a=1e4,i){return s(this,null,function*(){return new Promise((o,c)=>{const h=()=>{if(!r()){clearInterval(p);return}t?this.getSessionKnowledgeFile(e,t).then(l=>{if(i==null||i(l),l.status===T.Success&&(clearInterval(p),o(l)),l.status===T.Failed){clearInterval(p);const d="该文件无法读取,请上传可编辑pdf,doc,docx文档";c(Error(d,{cause:{code:-101,message:d,data:l}}))}}).catch(l=>{clearInterval(p),c(l)}):o(null)},p=setInterval(h,a);h()})})}postChat(e,t){return s(this,null,function*(){return this.post("/chat",e,t)})}postChatV2EventSource(e,t,r,a){return s(this,null,function*(){var h;const i={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},o=yield this.getToken(),c=I(y({},t),{stream:!0});V(`${(h=this.axiosInstance)==null?void 0:h.defaults.baseURL}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(c),openWhenHidden:!0,signal:r,onopen(p){return p.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(p){if(!p.data&&!p.event&&!p.id&&!p.retry)return;if(!p.data.includes('{"code": ')){let l={};try{l=JSON.parse(p.data)}catch(g){}(l==null?void 0:l.mtype)==="search"?i.searchReference.push(l):i.content=i.content+p.data;const d={content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:x(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(a==null?void 0:a.onmessage)&&a.onmessage(d)}const u=JSON.parse(p.data);if(i.reference=u.data.reference,i.messageTime=u.data.messageTime,i.messageId=u.data.messageId,i.llmModel=u.data.llmModel,i.code=u.code,u.code===200){const l={code:i.code,content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:i.messageTime,isReplying:!0};a!=null&&a.onmessage&&a.onmessage(l)}},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const p={code:i.code,content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:i.messageTime,comment:{isAgree:0},isReplying:!1};a!=null&&a.onclose&&a.onclose(p)}})})}postChatV3EventSource(e,t,r,a){return s(this,null,function*(){var h,p;const i={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,reasoningContent:"",thinkingSecs:"",thinkingStatus:"",searchingStatus:""},o=yield this.getToken(),c=I(y({},t),{stream:!0});V(`${(p=(h=this.axiosInstance)==null?void 0:h.defaults.baseURL)==null?void 0:p.replace("/v1","/v3")}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(c),openWhenHidden:!0,signal:r,onopen(u){return u.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(u){if(!u.data&&!u.event&&!u.id&&!u.retry)return;let l={};try{l=JSON.parse(u.data)}catch($){console.log("eventData",u.data)}const d=l.data.type,g=l.data.payload;i.isReplying=!0,d==="error"&&(i.code=l.code,i.message=l.message);const S=()=>{if(!i.searchingStatus){i.searchingStatus="start";return}if(i.searchingStatus==="start"){i.searchingStatus="end";return}};if(d==="beforeSearch"&&S(),d==="search"&&(i.code=l.code,i.message=l.message,i.searchReference.push(g)),d==="thinking"){S(),i.code=l.code,i.message=l.message,i.thinkingStatus="start";const k=g.choices[0];i.reasoningContent=i.reasoningContent+k.delta.reasoningContent}if(d==="thinkingOver"){i.code=l.code,i.message=l.message,i.thinkingStatus="end";const $=g.thinkingSecs;i.thinkingSecs=$}if(d==="text"){S(),i.code=l.code,i.message=l.message;const k=g.choices[0];i.content=i.content+k.delta.content}if(d==="reference"&&(i.code=l.code,i.message=l.message,i.reference=g),d==="result"){i.code=l.code,i.message=l.message;const $=g.messageId,k=g.llmModel,P=g.messageTime;i.messageId=$,i.llmModel=k,i.messageTime=P,i.sessionId=e}a!=null&&a.onmessage&&a.onmessage(i)},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const u=I(y({},i),{isReplying:!1});a!=null&&a.onclose&&a.onclose(u)}})})}getResourceToken(e){return s(this,null,function*(){return this.get("/resourceToken",e)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/upload/ticket",e)})}postPrompts(e){return s(this,null,function*(){return this.post("/prompts",e)})}listPrompt(e){return s(this,null,function*(){return e!=null&&e.title&&e.title.length>D?[]:this.get("/prompts",e)})}getPrompt(e){return s(this,null,function*(){return this.get(`/prompts/${e}`)})}updatePrompt(e,t){return s(this,null,function*(){return this.put(`/prompts/${e}`,t)})}deletePrompt(e){return s(this,null,function*(){return this.delete(`/prompts/${e}`)})}chatSessionIdContext(e){return s(this,null,function*(){return this.patch(`/chatSession/${e}/context`,{})})}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}getApplicationId(e){return s(this,null,function*(){return this.get(`/applications/${e}`)})}getAppService(){return s(this,null,function*(){return this.get("/appservice")})}}window.Buffer=C.Buffer;class Ee extends m{constructor(e,t,r){super(e!=null?e:v.create(),r),this.axiosInstance=e,this.getToken=t}getApplicationIdSessions(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session`)})}getApplicationId(e,t){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`,t)})}postApplicationIdSession(e){return s(this,null,function*(){return this.post(`/data/v1/application/${e.applicationId}/sessions`,e)})}getApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}patchApplicationIdSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}/context`,{})})}delApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/sessions/${t}`)})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/sessions/${t}/comments`,r)})}getChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/chatHistory/${t}`)})}postChatV2EventSource(e,t,r,a,i,o){return s(this,null,function*(){const c={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},h=yield this.getToken(),p=I(y({},r),{stream:!0});V(`https://aiot-dev.glodon.com/api/cvforcepd/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${h}`,"Content-Type":"application/json"},body:JSON.stringify(p),openWhenHidden:!0,signal:a,onopen(u){return u.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(u){if(!u.data.includes('{"code": ')){let d={};try{d=JSON.parse(u.data)}catch(S){}(d==null?void 0:d.mtype)==="search"?c.searchReference.push(d):c.content=c.content+u.data;const g={content:c.content,role:1,reference:c.reference,searchReference:c.searchReference,messageId:c.messageId,sessionId:t,messageTime:x(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}`)})}getSilenceDuration(){return s(this,null,function*(){return this.get("/data/v1/silenceDuration")})}}globalThis.Buffer=C.Buffer;class Le extends m{constructor(e,t,r){super(e!=null?e:v.create(),r),this.axiosInstance=e,this.getToken=t}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}postGeneques(e){return s(this,null,function*(){return this.post("/data/v1/geneques",e)})}getApplicationId(e){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`)})}getApplicationIdSessions(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessionsa`,t)})}postApplicationIdSession(e){return s(this,null,function*(){return this.post(`/data/v1/application/${e.applicationId}/sessions`,e)})}getApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}patchApplicationIdSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}delApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/sessions/${t}`)})}getApplicationIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/promptVariables`,t)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${r}`,a)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`/data/v1/chatSession/${e}/file`,t)})}getRecommendQues(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/recommendQues`)})}postRecommendQues(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/recommendQues`,t)})}delRecommendQues(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/recommendQues/${t}`)})}getChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/chatHistory/${t}`)})}postPrompts(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/prompts`,t)})}listPrompt(e,t){return s(this,null,function*(){return t!=null&&t.title&&t.title.length>D?[]:this.get(`/data/v1/application/${e}/prompts`,t)})}getPrompt(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/prompts/${t}`)})}updatePrompt(e,t,r){return s(this,null,function*(){return this.put(`/data/v1/application/${e}/prompts/${t}`,r)})}deletePrompt(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/prompts/${t}`)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}/context`,{})})}getApplicationIdSessionKnowledgeFiles(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file`,r)})}postApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/file`,r)})}postApplicationIdSessionKnowledgeSessionFile(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`,r)})}delApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file`,r)})}getApplicationIdSessionKnowledgeFileId(e,t,r,a,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${r}`,a,i)})}delApplicationIdSessionKnowledgeFileId(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file/${r}`)})}patchApplicationIdKnowledgeIdFileId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${r}`,a)})}checkFileReady(e,t,r,a=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((c,h)=>{const p=()=>{if(!a()){clearInterval(u);return}r?this.getApplicationIdSessionKnowledgeFileId(e,t,r,{},!0).then(d=>{if(o==null||o(d),d.status===T.Success&&(clearInterval(u),c(d)),d.status===T.Failed){clearInterval(u);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:d}}))}}).catch(d=>{clearInterval(u),h(d)}):c(null)},u=setInterval(p,i);p()})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}postUploadTicket(e){return s(this,null,function*(){return this.post("/data/v1/ticket",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{A.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const c=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};A.putObjectBuffer(e.bucket,e.fileKeys[0],c,h,p=>{if(p)throw console.error(p),Error(p);r(e.fileKeys[0])})}})})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/sessions/${t}/comments`,r)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}`)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}`)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}/data/${r}`)})}postChatV2EventSource(e,t,r,a,i){return s(this,null,function*(){var p;const o={code:0,messageId:F.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,message:""},c=yield this.getToken(),h=I(y({},r),{stream:!0});V(`${(p=this.axiosInstance)==null?void 0:p.defaults.baseURL}/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${c}`,"Content-Type":"application/json"},body:JSON.stringify(h),openWhenHidden:!0,signal:a,onopen(u){return u.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(u){if(!u.data&&!u.event&&!u.id&&!u.retry)return;if(!u.data.includes('{"code": ')){let d={};try{d=JSON.parse(u.data)}catch(S){}(d==null?void 0:d.mtype)==="search"?o.searchReference.push(d):o.content=o.content+u.data;const g={content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:x(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(i==null?void 0:i.onmessage)&&i.onmessage(g)}const l=JSON.parse(u.data);if(o.reference=l.data.reference,o.messageTime=l.data.messageTime,o.messageId=l.data.messageId,o.llmModel=l.data.llmModel,o.code=l.code,o.message=l.message,l.code===200){const d={code:o.code,content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:o.messageTime,isReplying:!0};i!=null&&i.onmessage&&i.onmessage(d)}},onerror(){i!=null&&i.onerror&&i.onerror()},onclose(){const u={code:o.code,content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:o.messageTime,comment:{isAgree:0},isReplying:!1,message:o.message};i!=null&&i.onclose&&i.onclose(u)}})})}postChat(e,t){return s(this,null,function*(){var r;return this.post(`${(r=this.axiosInstance)==null?void 0:r.defaults.baseURL}/chat/v2/chat`,e,t)})}}var ee=(n=>(n[n.Dialog=0]="Dialog",n[n.TextGenerate=1]="TextGenerate",n[n.FileSummery=2]="FileSummery",n))(ee||{}),te=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(te||{}),se=(n=>(n[n.Processing=1]="Processing",n[n.Done=2]="Done",n[n.Failed=3]="Failed",n))(se||{}),re=(n=>(n[n.File=0]="File",n[n.WebLink=1]="WebLink",n))(re||{}),ne=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(ne||{}),ae=(n=>(n.InputFile="ui.input.file",n.LLMModel="ui.llm.model",n))(ae||{}),ie=(n=>(n[n.Idle=0]="Idle",n[n.Quoted=1]="Quoted",n))(ie||{}),oe=(n=>(n[n.Basic=0]="Basic",n[n.Pro=1]="Pro",n))(oe||{}),ce=(n=>(n[n.Dialog=0]="Dialog",n[n.Text=1]="Text",n[n.Agent=2]="Agent",n[n.All=3]="All",n))(ce||{}),le=(n=>(n.User="instruction",n.System="settings",n))(le||{});class Ue extends m{constructor(e,t){super(e!=null?e:v.create(),t)}getKnowledge(e,t){return s(this,null,function*(){return this.get("/knowledge",{docId:e,name:t})})}postKnowledge(e){return s(this,null,function*(){return this.post("/knowledge",e)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/knowledge/${e}`)})}patchKnowledgeId(e,t){return s(this,null,function*(){return this.patch(`/knowledge/${e}`,t)})}delKnowledgeId(e){return s(this,null,function*(){return this.delete(`/knowledge/${e}`)})}getKnowledgeIdFile(e){return s(this,null,function*(){return this.get(`/knowledge/${e}/file`)})}getKnowledgeIdFileList(e,t){return s(this,null,function*(){return this.listPaged(`/knowledge/${e}/file`,t)})}postKnowledgeIdFile(e,t){return s(this,null,function*(){return this.post(`/knowledge/${e}/file`,t)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}delKnowledgeIdFileFid(e,t){return s(this,null,function*(){return this.delete(`/knowledge/${e}/file/${t}`)})}patchKnowledgeIdFileFid(e,t,r){return s(this,null,function*(){return this.patch(`/knowledge/${e}/file/${t}`,r)})}listSessions(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessionsa`,t)})}postSession(e,t){return s(this,null,function*(){return this.post(`/application/${e}/sessions`,t)})}getSession(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessions/${t}`)})}patchSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/application/${e}/sessions/${t}`,r)})}delSessionsId(e,t){return s(this,null,function*(){return this.delete(`/application/${e}/sessions/${t}`)})}getSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.get(`/application/${e}session/${t}/file/${r}`)})}postSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}session/${t}/file`,r)})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}/sessions/${t}/comments`,r)})}getChatHistorySessionId(e,t,r){return s(this,null,function*(){return this.get(`application/${e}/chatHistory/${t}`,r)})}postChatHistorySessionId(e,t){return s(this,null,function*(){return this.post(`/chatHistory/${e}`,t)})}getApplications(e){return s(this,null,function*(){return this.get("/applications",e)})}postApplication(e){return s(this,null,function*(){return this.post("/applications",e)})}getApplicationId(e,t){return s(this,null,function*(){return this.get(`/applications/${e}`,t)})}patchApplicationId(e,t){return s(this,null,function*(){return this.patch(`/applications/${e}`,t)})}delApplicationId(e){return s(this,null,function*(){return this.delete(`/applications/${e}`)})}getApplicationIdSessions(e){return s(this,null,function*(){return this.get(`/applications/${e}/session`)})}patchFileId(e,t){return s(this,null,function*(){return this.patch(`/file/${e}`,t)})}getCvforceResource(e){return s(this,null,function*(){return this.get("/cvforce/resource",e)})}postKnowledgeIdComposedFiles(e,t){return s(this,null,function*(){return this.post(`/knowledge/${e}/composedFiles`,t)})}getTokensApplicationId(e,t){return s(this,null,function*(){return this.get(`/tokens/${e}`,t)})}getTokens(e){return s(this,null,function*(){return this.get("/tokens",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{A.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const c=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])})}})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.getUploadTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.getUploadTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a.minio,i)))).catch(a=>{throw Error(a)})})}getAecModels(){return s(this,null,function*(){return this.get("/aecModels")})}postTextFilter(e){return s(this,null,function*(){return this.post("/textFilter",e)})}getTenantModel(){return s(this,null,function*(){return this.get("/tenantModel")})}getPrompts(e,t){return s(this,null,function*(){return this.get(`application/${e}/promptVariables`,t)})}postPrompt(e,t){return s(this,null,function*(){return this.post(`application/${e}/promptVariables`,t)})}patchPromptId(e,t,r){return s(this,null,function*(){return this.patch(`application/${e}/promptVariables/${t}`,r)})}delPromptId(e,t){return s(this,null,function*(){return this.delete(`application/${e}/promptVariables/${t}`)})}getSessionPrompts(e){return s(this,null,function*(){return this.get(`session/${e}/promptVariables`)})}patchSessionPromptId(e,t,r){return s(this,null,function*(){return this.patch(`session/${t}/promptVariables/${e}`,r)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/application/${e}/session/${t}/promptVariables`)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/application/${e}/session/${t}/promptVariables/${r}`,a)})}getPresetApplication(e){return s(this,null,function*(){return this.get("presetApplication",e)})}postKnowledgeConfig(e){return s(this,null,function*(){return this.post("/knowledgeConfig",e)})}getKnowledgeConfig(e){return s(this,null,function*(){return this.get(`/knowledgeConfig/${e}`)})}patchKnowledgeConfig(e,t){return s(this,null,function*(){return this.patch(`/knowledgeConfig/${e}`,t)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}`)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.listPaged(`/knowledge/${e}/file/${t}/data`,r)})}postKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.post(`/knowledge/${e}/file/${t}/data`,{data:r})})}patchKnowledgeIdFileIdData(e,t,r,a){return s(this,null,function*(){return this.patch(`/knowledge/${e}/file/${t}/data/${r}`,{data:a})})}delKnowledgeIdFileIdDataDid(e,t,r){return s(this,null,function*(){return this.delete(`/knowledge/${e}/file/${t}/data/${r}`)})}getPresetKnowledge(e){return s(this,null,function*(){return this.get("/presetKnowledge",e)})}patchSessionsIdContext(e){return s(this,null,function*(){return this.patch(`/sessions/${e}/context`,{})})}postResourceToken(e){return s(this,null,function*(){return this.post("/resourceToken",e)})}getApplicationIdSession(e){return s(this,null,function*(){return this.get(`/application/${e}/session`)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/application/${e}/sessions/${t}/context`,{})})}postApplicationIdSessions(e,t){return s(this,null,function*(){return this.post(`/application/${e}/sessions`,t)})}getApplicationIdChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/application/${e}/chatHistory/${t}`)})}postApplicationIdChatHistorySessionIdComments(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}/sessions/${t}/comments`,r)})}getApplicationIdPrompts(e,t){return s(this,null,function*(){return this.get(`/application/${e}/promptVariables`,t)})}postKnowledgeSourceFile(e,t,r){return s(this,null,function*(){return this.post(`/knowledge/${e}/sourceFile/${t}`,r)})}getMetadata(e){return s(this,null,function*(){return this.get("/metadata",e)})}postGeneques(e){return s(this,null,function*(){return this.post("/geneques",e)})}getBaseModel(e){return s(this,null,function*(){return this.get("/baseModelInfo",{serviceId:e})})}}var de=(n=>(n[n.inital=0]="inital",n[n.success=1]="success",n[n.processing=2]="processing",n[n.failed=3]="failed",n))(de||{}),pe=(n=>(n[n.inital=0]="inital",n[n.processing=1]="processing",n[n.paused=2]="paused",n[n.failed=3]="failed",n[n.done=4]="done",n))(pe||{}),f=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Failure="FAILURE",n.Success="SUCCESS",n.Abort="ABORT",n))(f||{}),ue=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Success="SUCCESS",n.Failure="FAILURE ",n))(ue||{}),he=(n=>(n[n.all=0]="all",n[n.general=1]="general",n[n.major=2]="major",n))(he||{});function xe(){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 Ce 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=>I(y({},a),{labels:a.labels?a.labels.map(i=>I(y({},i),{uuid:i.uuid||xe()})):[]}))})}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`)})}}class Be extends m{constructor(e,t){super(e!=null?e:v.create(),t)}listModelServices(e){return s(this,null,function*(){return this.listPaged("/modelService",e)})}postModelService(e){return s(this,null,function*(){return this.post("/modelService",e)})}getModelServiceById(e){return s(this,null,function*(){return this.get(`/modelService/${e}`)})}patchModelServiceById(e,t){return s(this,null,function*(){return this.patch(`/modelService/${e}`,t)})}deleteModelService(e){return s(this,null,function*(){return this.delete(`/modelService/${e}`)})}getEnableModelService(e){return s(this,null,function*(){return this.get(`/modelService/${e}/enable`)})}getDisableModelService(e){return s(this,null,function*(){return this.get(`/modelService/${e}/disable`)})}getModelServiceList(e){return s(this,null,function*(){return this.get(`/modelService/${e}/list`)})}getModelServiceDelist(e){return s(this,null,function*(){return this.get(`/modelService/${e}/delist`)})}importService(e){return s(this,null,function*(){return this.post("/modelService/import",e)})}patchModelService(e,t){return s(this,null,function*(){return this.patch(`/modelService/${e}`,t)})}openModelServices(e){return s(this,null,function*(){return this.get("/openModelService",e)})}importMirronService(e){return s(this,null,function*(){return this.post("/modelService/importMirron",e)})}patchMirronService(e,t){return s(this,null,function*(){return this.patch(`/modelService/importMirron/${e}`,t)})}getServiceSignList(e){return s(this,null,function*(){return this.get("/serviceSign",e)})}}var ge=(n=>(n[n.minio=0]="minio",n[n.pvc=1]="pvc",n))(ge||{}),ye=(n=>(n.common="A100",n.idcard="A104",n.bankcard="A108",n.page="A112",n.rmwatermark="A115",n.seal="A116",n.rmseal="A117",n.table="A118",n))(ye||{}),me=(n=>(n.User="user",n.Assistant="assistant",n.System="system",n))(me||{});class Ne extends m{constructor(e,t){super(e!=null?e:v.create(),t)}ocr(e,t){return s(this,null,function*(){if(t.modelStore===ge.pvc){const r=this.convertToBatchParams(t),a=yield this.ocrPvcBatch(e,r);return this.convertToMinioResult(a)}else return this.ocrMinio(e,t)})}convertToBatchParams(e){return{pages:[{image:e.image}]}}convertToMinioResult(e){var t;return(t=e.pages)==null?void 0:t.flatMap(r=>{var a;return((a=r.textItems)==null?void 0:a.map(i=>({box:i.bbox})))||[]})}ocrMinio(e,t){return s(this,null,function*(){return t.image&&t.image.split("base64,").length>1&&(t.image=t.image.split("base64,")[1]),this.post(`/v2/infer?serviceId=${e}`,t)})}ocrPvcBatch(e,t){return s(this,null,function*(){return this.post(`/v2/infer?serviceId=${e}`,t)})}getSleep(e){return s(this,null,function*(){return new Promise(t=>{setTimeout(()=>{t(!0)},e*1e3)})})}postChatCompletions(e){return s(this,null,function*(){return this.postNonStandard("/v1/chat/completions",e)})}detection(e,t){return s(this,null,function*(){return this.post(`/v2/infer?serviceId=${e}`,t)})}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)})}}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=ae;exports.AuthApi=ke;exports.BaseApi=m;exports.BotClientApi=Ee;exports.CVForceApi=Ue;exports.CVForceDatahubApi=Ce;exports.ChatMessageRole=te;exports.ChatMode=ee;exports.ContralyzeApi=He;exports.DataApi=we;exports.FileProccessStatus=se;exports.GenerateStatus=pe;exports.IChatRole=me;exports.IDatasetLevel=he;exports.IFileOrigin=Z;exports.IHistoryRole=b;exports.ISourceType=j;exports.ISpacetwinStatus=Y;exports.IThinkingStatus=X;exports.IversionInfo=G;exports.KnowledgeFileStatus=ne;exports.KnowledgeType=oe;exports.ModelServiceApi=Be;exports.OCRServiceId=ye;exports.PROMPT_SEARCH_MAX_LENGTH=D;exports.PROMPT_TITLE_MAX_LENGTH=De;exports.PanoramaApi=Ae;exports.PanoramaPluginMgrApi=Te;exports.PreLabelTaskStatus=ue;exports.PromptStatus=ie;exports.PromptVariableType=le;exports.RecordStatus=z;exports.SourceType=re;exports.SubsectionStatus=de;exports.UploadZipsStatus=f;exports.needPrettifyMsg=q;exports.prettifyMsg=J;
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { OCRMinioParams, OCRResult, IChatCompletion, DetectionParam, IDetectionResult, OCRPvcBatchParams, OCRBatchResult, IEmbedding } from './model';
2
+ import { OCRMinioParams, OCRResult, IChatCompletion, DetectionParam, IDetectionResult, OCRPvcBatchParams, OCRBatchResult, IEmbedding, 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 {
@@ -20,6 +20,8 @@ export declare class AIShopApi extends BaseApi {
20
20
  getSleep(second: number): Promise<unknown>;
21
21
  postChatCompletions(param: IChatCompletion): Promise<any>;
22
22
  detection(serviceId: string, params: DetectionParam): Promise<IDetectionResult>;
23
+ detectionLayout(serviceId: string, params: DetectionParam | LayoutV1DetectionParam): Promise<IDetectionResult>;
24
+ convertLayoutToDetection(result: LayoutV1IDetectionResult): IDetectionResult;
23
25
  getBaseModel(serviceId: string): Promise<IBaseModel>;
24
26
  postEmbeddings(params: IEmbedding): Promise<any>;
25
27
  }
@@ -109,3 +109,21 @@ export interface IEmbeddingResult {
109
109
  total_tokens: number;
110
110
  };
111
111
  }
112
+ export interface LayoutV1DetectionParam {
113
+ pages: [{
114
+ image: string;
115
+ }];
116
+ }
117
+ export interface LayoutV1IDetectionResult {
118
+ pages: {
119
+ image: string;
120
+ no: number;
121
+ layout: ILayout[];
122
+ }[];
123
+ }
124
+ export interface ILayout {
125
+ no: number;
126
+ bbox: [x: number, y: number][];
127
+ type: string;
128
+ score: number;
129
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glodon-aiot/apis",
3
- "version": "3.18.0-alpha.10",
3
+ "version": "3.18.0-alpha.12",
4
4
  "author": "glodoncv",
5
5
  "description": "aiot apis",
6
6
  "type": "module",