@glodon-aiot/apis 3.0.10-beta.1 → 3.0.10-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/aecpilot/index.mjs +1 -1
- package/dist/es/aecpilotui/index.mjs +8 -8
- package/dist/es/agentcliui/index.mjs +6 -6
- package/dist/lib/index.js +3 -3
- package/package.json +5 -3
- package/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +0 -6
- package/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +0 -10
- package/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +0 -9
- package/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +0 -19
|
@@ -31,10 +31,10 @@ import { BaseApi as O } from "../base/index.mjs";
|
|
|
31
31
|
import { initMinio as v, putObjectBuffer as C } from "@glodon-aiot/minio";
|
|
32
32
|
import { IHistoryRole as $, AecKnowledgeFileStatus as k } from "./model.mjs";
|
|
33
33
|
import { IFileOrigin as V, ISourceType as W, IThinkingStatus as X, IversionInfo as q } from "./model.mjs";
|
|
34
|
+
import { v4 as R } from "uuid";
|
|
34
35
|
import H from "dayjs";
|
|
35
36
|
import { PROMPT_SEARCH_MAX_LENGTH as Q } from "./cosntant.mjs";
|
|
36
37
|
import { PROMPT_TITLE_MAX_LENGTH as ee } from "./cosntant.mjs";
|
|
37
|
-
import R from "../node_modules/uuid/dist/esm-browser/v4.mjs";
|
|
38
38
|
import { fetchEventSource as w } from "../utils/fetchEventSource/fetch.mjs";
|
|
39
39
|
class Y extends O {
|
|
40
40
|
constructor(e, t, o) {
|
|
@@ -30,12 +30,12 @@ import K from "axios";
|
|
|
30
30
|
import { BaseApi as T } from "../base/index.mjs";
|
|
31
31
|
import { initMinio as b, putObjectBuffer as P } from "@glodon-aiot/minio";
|
|
32
32
|
import { IHistoryRole as k, AecKnowledgeFileStatus as I } from "../aecpilot/model.mjs";
|
|
33
|
-
import M from "
|
|
34
|
-
import
|
|
35
|
-
import {
|
|
36
|
-
import H from "../
|
|
33
|
+
import { v4 as M } from "uuid";
|
|
34
|
+
import F from "dayjs";
|
|
35
|
+
import { Buffer as B } from "buffer";
|
|
36
|
+
import { PROMPT_SEARCH_MAX_LENGTH as H } from "../aecpilot/cosntant.mjs";
|
|
37
37
|
import { fetchEventSource as E } from "../utils/fetchEventSource/fetch.mjs";
|
|
38
|
-
globalThis.Buffer =
|
|
38
|
+
globalThis.Buffer = B;
|
|
39
39
|
class J extends T {
|
|
40
40
|
constructor(e, t, a) {
|
|
41
41
|
super(e != null ? e : K.create(), a), this.axiosInstance = e, this.getToken = t;
|
|
@@ -349,7 +349,7 @@ class J extends T {
|
|
|
349
349
|
}
|
|
350
350
|
listPrompt(e, t) {
|
|
351
351
|
return s(this, null, function* () {
|
|
352
|
-
return t != null && t.title && t.title.length >
|
|
352
|
+
return t != null && t.title && t.title.length > H ? [] : this.get(`/data/v1/application/${e}/prompts`, t);
|
|
353
353
|
});
|
|
354
354
|
}
|
|
355
355
|
getPrompt(e, t) {
|
|
@@ -502,7 +502,7 @@ class J extends T {
|
|
|
502
502
|
var l;
|
|
503
503
|
const n = {
|
|
504
504
|
code: 0,
|
|
505
|
-
messageId:
|
|
505
|
+
messageId: M(),
|
|
506
506
|
content: "",
|
|
507
507
|
role: k.Robot,
|
|
508
508
|
sessionId: "",
|
|
@@ -547,7 +547,7 @@ class J extends T {
|
|
|
547
547
|
searchReference: n.searchReference,
|
|
548
548
|
messageId: n.messageId,
|
|
549
549
|
sessionId: t,
|
|
550
|
-
messageTime:
|
|
550
|
+
messageTime: F(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
|
551
551
|
comment: {
|
|
552
552
|
isAgree: 0
|
|
553
553
|
},
|
|
@@ -30,12 +30,12 @@ import T from "axios";
|
|
|
30
30
|
import { BaseApi as K } from "../base/index.mjs";
|
|
31
31
|
import { initMinio as k, putObjectBuffer as P } from "@glodon-aiot/minio";
|
|
32
32
|
import { IHistoryRole as F, AecKnowledgeFileStatus as I } from "../aecpilot/model.mjs";
|
|
33
|
-
import M from "
|
|
34
|
-
import
|
|
35
|
-
import B from "
|
|
33
|
+
import { v4 as M } from "uuid";
|
|
34
|
+
import b from "dayjs";
|
|
35
|
+
import { Buffer as B } from "buffer";
|
|
36
36
|
import { PROMPT_SEARCH_MAX_LENGTH as E } from "../aecpilot/cosntant.mjs";
|
|
37
37
|
import { fetchEventSource as H } from "../utils/fetchEventSource/fetch.mjs";
|
|
38
|
-
window.Buffer =
|
|
38
|
+
window.Buffer = B;
|
|
39
39
|
class x extends K {
|
|
40
40
|
constructor(e, t, a) {
|
|
41
41
|
super(e != null ? e : T.create(), a), this.axiosInstance = e, this.getToken = t;
|
|
@@ -89,7 +89,7 @@ class x extends K {
|
|
|
89
89
|
return s(this, null, function* () {
|
|
90
90
|
const r = {
|
|
91
91
|
code: 0,
|
|
92
|
-
messageId:
|
|
92
|
+
messageId: M(),
|
|
93
93
|
content: "",
|
|
94
94
|
role: F.Robot,
|
|
95
95
|
sessionId: "",
|
|
@@ -131,7 +131,7 @@ class x extends K {
|
|
|
131
131
|
searchReference: r.searchReference,
|
|
132
132
|
messageId: r.messageId,
|
|
133
133
|
sessionId: t,
|
|
134
|
-
messageTime:
|
|
134
|
+
messageTime: b(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
|
135
135
|
comment: {
|
|
136
136
|
isAgree: 0
|
|
137
137
|
},
|
package/dist/lib/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var Ie=Object.defineProperty,we=Object.defineProperties;var ke=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var N=(r,e,t)=>e in r?Ie(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$=(r,e)=>{for(var t in e||(e={}))O.call(e,t)&&N(r,t,e[t]);if(M)for(var t of M(e))W.call(e,t)&&N(r,t,e[t]);return r},I=(r,e)=>we(r,ke(e));var _=(r,e)=>{var t={};for(var n in r)O.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&M)for(var n of M(r))e.indexOf(n)<0&&W.call(r,n)&&(t[n]=r[n]);return t};var s=(r,e,t)=>new Promise((n,a)=>{var i=h=>{try{l(t.next(h))}catch(d){a(d)}},o=h=>{try{l(t.throw(h))}catch(d){a(d)}},l=h=>h.done?n(h.value):Promise.resolve(h.value).then(i,o);l((t=t.apply(r,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("axios"),k=require("@glodon-aiot/minio"),L=require("dayjs"),q=require("buffer");class f{constructor(e,t){this.axios=e,this.errorHandler=t}get(e,t,n){return s(this,null,function*(){const a=this.axios.get(e,{params:t});return this.handleResponse(a,n)})}listPaged(e,t){return s(this,null,function*(){const n=this.axios.get(e,{params:t});return this.handleResponse(n)})}list(e,t){return s(this,null,function*(){const n=this.axios.get(e,{params:t});return this.handleResponse(n)})}delete(e,t){return s(this,null,function*(){const n=this.axios.delete(e,{params:t});return this.handleResponse(n)})}post(e,t,n,a){return s(this,null,function*(){const i=this.axios.post(e,t,$({params:n},a));return this.handleResponse(i)})}postForm(e,t,n){return s(this,null,function*(){const a=this.axios.post(e,t,{params:n,headers:{"Content-Type":"multipart/form-data"}});return this.handleResponse(a)})}patch(e,t,n){return s(this,null,function*(){const a=this.axios.patch(e,t,{params:n});return this.handleResponse(a)})}put(e,t){return s(this,null,function*(){const n=this.axios.put(e,t);return this.handleResponse(n)})}upload(e,t,n){return s(this,null,function*(){const a=this.axios.post(e,t,$({},n));return this.handleResponse(a)})}getNonStandard(e,t){return s(this,null,function*(){const n=this.axios.get(e,t);try{const a=yield n;if(a.status===200)return a}catch(a){throw this.handleError(a)}})}postNonStandard(e,t,n,a){return s(this,null,function*(){var l,h;const o=yield this.axios.post(e,t,$({params:n},a));if(o.status===200)if((l=o.data)!=null&&l.code)(h=this.errorHandler)!=null&&h.onAppStatusError&&this.errorHandler.onAppStatusError(o.data.code,o.data.message);else return o.data})}handleResponse(e,t){return s(this,null,function*(){try{const n=yield e;return this.handleAppError(n.data,t).data}catch(n){throw this.handleError(n)}})}handleAppError(e,t){var n;if(e.code<200||e.code>=300)throw(n=this.errorHandler)!=null&&n.onAppStatusError?this.errorHandler.onAppStatusError(e.code,z(e.code,e.message),t):console.error("未处理应用错误:",e),{isAxiosError:!1,message:e.message};return e}handleError(e){var t,n;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),(n=this.errorHandler)!=null&&n.onNetworkError&&this.errorHandler.onNetworkError()):console.error("axios request config error:",e),new Error(e.message)}}const Y=r=>r>=10002&&r<=10012,z=(r,e)=>Y(r)?"数据操作错误":e||"未知接口错误";class Ae extends f{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,n,a="3600",i){return s(this,null,function*(){return this.post("/refresh-token",{oldToken:e,tenant:t,orgId:n,expired:a,product:i})})}}class be extends f{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,n){return s(this,null,function*(){return this.patch(`tenant/${e}/users/${t}`,n)})}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,n){return s(this,null,function*(){return this.patch(`/users/${e}/role/${t}`,n)})}deleteUserRole(e,t){return s(this,null,function*(){return this.delete(`/users/${e}/role/${t}`)})}getUsersIdProductCodeMenu(e,t,n="web",a){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/menu?groupCode=${n}`,{level:a})})}getUserInfo(e){return s(this,null,function*(){return this.get(`/users/${e}`)})}uipermission(e,t,n="web"){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/uipermission?groupCode=${n}`)})}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}`)})}}var G=(r=>(r.Collecting="采集中",r.CollectionTimeout="超时",r.CollectionFinish="完成",r.WaitUpload="等待上传",r.Uploading="上传中",r.UploadFinish="上传完成",r.UploadFailed="上传失败",r.WaitMerge="等待合成",r.CreateMergeTaskFailed="创建合成任务失败",r.Merging="合成中",r.MergeFailed="合成失败",r.MergeFinish="合成成功",r))(G||{}),X=(r=>(r.Collecting="采集中",r.CollectionTimeout="超时",r.CollectionFinish="完成",r.WaitUpload="等待上传",r.Uploading="上传中",r.UploadFinish="上传完成",r.UploadFailed="上传失败",r.WaitMerge="等待合成",r.CreateMergeTaskFailed="创建合成任务失败",r.Merging="合成中",r.MergeFailed="合成失败",r.MergeFinish="合成成功",r))(X||{});class Te extends f{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,n){return s(this,null,function*(){return fetch(`${e}${t}/viewtoken/${n}/create_apitoken`,{method:"POST"}).then(a=>{if(a.status!==200)throw console.error(a),Error(JSON.stringify(a));return a.json()}).then(a=>{if(a.code!==200)throw Error(JSON.stringify(a));return a.data.apiToken})})}listRecord(e){return s(this,null,function*(){return this.listPaged("/spacetwins",e)})}postRecord(e){return s(this,null,function*(){return this.post("/spacetwins",e)})}getRecordOverview(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}`)})}getRecordViewtoken(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}/viewtoken`)})}listScene(e){return s(this,null,function*(){return this.list(`/spacetwins/${e}/scenes`)})}getScenesByTimestamp(e,t){return s(this,null,function*(){return this.list(`/spacetwins/${e}/scenes_timestamp`,{timestamp:t})})}recomputeTrack(e,t){return s(this,null,function*(){return this.patch(`/spacetwins/${e}/track`,{points:t})})}updateRecordUploadStatus(e,t){return s(this,null,function*(){return this.post(`/spacetwins/${e}/update_upload_status`,t)})}getApiToken(e){return s(this,null,function*(){return this.post(`/viewtoken/${e}/create_apitoken`,{})})}getSpacetwins(e){return s(this,null,function*(){return this.listPaged("/spacetwins",e)})}postSpacetwins(e){return s(this,null,function*(){return this.post("/spacetwins",e)})}updateInspection(e,t){return s(this,null,function*(){return this.patch(`/patrolInspection/${e}`,t)})}getSpacetwinsIdViewtoken(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}/viewtoken`)})}postSpacetwinsIdUpdateUploadStatus(e,t){return s(this,null,function*(){return this.post(`/spacetwins/${e}/update_upload_status`,t)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/upload/ticket",e)})}getDownloadUrl(e){return s(this,null,function*(){return this.get(`/download/url?isv=${e.isv}&key=${e.key}`)})}listTrack(e,t){return s(this,null,function*(){return this.list(`/spacetwins/${e}/track`,{type:t})})}}class Pe extends f{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(n=>I($({},n),{arguments:JSON.parse(n.arguments)}))})}updatePluginData(e,t,n){return s(this,null,function*(){return this.patch(`/plugins/${e}/datas/${t}`,n)})}deletePluginData(e,t){return s(this,null,function*(){return this.delete(`/plugins/${e}/datas/${t}`)})}}var Z=(r=>(r[r.None=0]="None",r[r.SourceFile=1]="SourceFile",r[r.WebLink=2]="WebLink",r))(Z||{}),ee=(r=>(r.Unprotected="不受著作权保护",r.ProtectAuthorize="受著作权保护,已获得授权",r.ProtectUnauthorize="受著作权保护,未获得授权",r))(ee||{}),T=(r=>(r[r.Robot=1]="Robot",r[r.User=2]="User",r[r.System=3]="System",r))(T||{}),te=(r=>(r.Start="start",r.End="end",r))(te||{}),A=(r=>(r[r.Processing=1]="Processing",r[r.Success=2]="Success",r[r.Failed=3]="Failed",r))(A||{}),se=(r=>(r.AECPILOT="aecpilot",r))(se||{});function Re(r,e){return s(this,null,function*(){const t=r.getReader();let n;for(;!(n=yield t.read()).done;)e(n.value)})}function Me(r){let e,t,n,a=!1,i;return function(l){e===void 0?(e=l,t=0,n=-1,i=!1):e=Ve(e,l);const h=e.length;let d=0;for(;t<h;){a&&(e[t]===10&&(d=++t),a=!1);let p=-1;for(;t<h&&p===-1;++t)switch(e[t]){case 58:n===-1&&(n=t-d);break;case 13:a=!1,t+4<h&&e[t+1]===10&&e[t+2]!==13&&e[t-1]!==10&&e[t-2]!==13&&(i=!0);case 10:p=t;break}if(p===-1)break;r(e.subarray(d,p),n,i),d=t,n=-1,i=!1}d===h?e=void 0:d!==0&&(e=e.subarray(d),t-=d)}}function Fe(r,e,t){let n=Q();const a=new TextDecoder;return function(o,l,h){if(o.length===0)t==null||t(n),n=Q();else if(l>0){const d=a.decode(o.subarray(0,l)),p=l+(o[l+1]===32?2:1);let c=a.decode(o.subarray(p));switch(h&&(c+=`
|
|
2
|
-
`),d){case"data":
|
|
3
|
-
`+c:c;break;case"event":n.event=c;break;case"id":r(n.id=c);break;case"retry":const u=parseInt(c,10);isNaN(u)||e(n.retry=u);break}}}}function Ve(r,e){const t=new Uint8Array(r.length+e.length);return t.set(r),t.set(e,r.length),t}function Q(){return{data:"",event:"",id:"",retry:void 0}}const C="text/event-stream",De=1e3,J="last-event-id";function V(r,p){var c=p,{signal:e,headers:t,onopen:n,onmessage:a,onclose:i,onerror:o,openWhenHidden:l,fetch:h}=c,d=_(c,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((u,g)=>{const m=$({},t);m.accept||(m.accept=C);let S;function P(){S.abort(),document.hidden||x()}l||document.addEventListener("visibilitychange",P);let B=De,E=0;function U(){document.removeEventListener("visibilitychange",P),window.clearTimeout(E),S.abort()}e==null||e.addEventListener("abort",()=>{U(),u()});const ve=h!=null?h:window.fetch,Se=n!=null?n:Ke;function x(){return s(this,null,function*(){var H;S=new AbortController;try{const R=yield ve(r,I($({},d),{headers:m,signal:S.signal}));yield Se(R),yield Re(R.body,Me(Fe(w=>{w?m[J]=w:delete m[J]},w=>{B=w},a))),i==null||i(),U(),u()}catch(R){if(!S.signal.aborted)try{const w=(H=o==null?void 0:o(R))!=null?H:B;window.clearTimeout(E),E=window.setTimeout(x,w)}catch(w){U(),g(w)}}})}x()})}function Ke(r){const e=r.headers.get("content-type");if(!(e!=null&&e.startsWith(C)))throw new Error(`Expected content-type to be ${C}, Actual: ${e}`)}let F;const Ee=new Uint8Array(16);function Ue(){if(!F&&(F=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!F))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return F(Ee)}const y=[];for(let r=0;r<256;++r)y.push((r+256).toString(16).slice(1));function xe(r,e=0){return y[r[e+0]]+y[r[e+1]]+y[r[e+2]]+y[r[e+3]]+"-"+y[r[e+4]]+y[r[e+5]]+"-"+y[r[e+6]]+y[r[e+7]]+"-"+y[r[e+8]]+y[r[e+9]]+"-"+y[r[e+10]]+y[r[e+11]]+y[r[e+12]]+y[r[e+13]]+y[r[e+14]]+y[r[e+15]]}const Ce=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),j={randomUUID:Ce};function D(r,e,t){if(j.randomUUID&&!e&&!r)return j.randomUUID();r=r||{};const n=r.random||(r.rng||Ue)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let a=0;a<16;++a)e[t+a]=n[a];return e}return xe(n)}const K=128,Le=20;class Be extends f{constructor(e,t,n){super(e!=null?e:v.create(),n),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,n){return s(this,null,function*(){return this.post(`/config/tenantApplication?applicationId=${e}&sessionId=${t}`,n)})}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((n,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{k.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const l=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};k.putObjectBuffer(e.bucket,e.fileKeys[0],l,h,d=>{if(d)throw console.error(d),Error(d);n(e.fileKeys[0])})}})})}uploadFile(e,t){return s(this,null,function*(){const n={files:[t.name],isv:"minio",knowledgeId:e};return this.postUploadTicket(n).then(a=>this.uploadMinioFile(a,t)).catch(a=>{throw Error(a)})})}uploadFiles(e,t){return s(this,null,function*(){const n={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.postUploadTicket(n).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,n){return s(this,null,function*(){return this.patch(`/chatSession/${e}/file/${t}`,n)})}getKnowledgeIdFileIdData(e,t,n){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}/data/${n}`)})}checkFileReady(e,t,n=()=>!0,a=1e4,i){return s(this,null,function*(){return new Promise((o,l)=>{const h=()=>{if(!n()){clearInterval(d);return}t?this.getSessionKnowledgeFile(e,t).then(c=>{if(i==null||i(c),c.status===A.Success&&(clearInterval(d),o(c)),c.status===A.Failed){clearInterval(d);const u="该文件无法读取,请上传可编辑pdf,doc,docx文档";l(Error(u,{cause:{code:-101,message:u,data:c}}))}}).catch(c=>{clearInterval(d),l(c)}):o(null)},d=setInterval(h,a);h()})})}postChat(e,t){return s(this,null,function*(){return this.post("/chat",e,t)})}postChatV2EventSource(e,t,n,a){return s(this,null,function*(){var h;const i={code:0,messageId:D(),content:"",role:T.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},o=yield this.getToken(),l=I($({},t),{stream:!0});V(`${(h=this.axiosInstance)==null?void 0:h.defaults.baseURL}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(l),openWhenHidden:!0,signal:n,onopen(d){return d.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(d){if(!d.data&&!d.event&&!d.id&&!d.retry)return;if(!d.data.includes('{"code": ')){let c={};try{c=JSON.parse(d.data)}catch(g){}(c==null?void 0:c.mtype)==="search"?i.searchReference.push(c):i.content=i.content+d.data;const u={content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:L(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(a==null?void 0:a.onmessage)&&a.onmessage(u)}const p=JSON.parse(d.data);if(i.reference=p.data.reference,i.messageTime=p.data.messageTime,i.messageId=p.data.messageId,i.llmModel=p.data.llmModel,i.code=p.code,p.code===200){const c={code:i.code,content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:i.messageTime,isReplying:!0};a!=null&&a.onmessage&&a.onmessage(c)}},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const d={code:i.code,content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:i.messageTime,comment:{isAgree:0},isReplying:!1};a!=null&&a.onclose&&a.onclose(d)}})})}postChatV3EventSource(e,t,n,a){return s(this,null,function*(){var h,d;const i={code:0,messageId:D(),content:"",role:T.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,reasoningContent:"",thinkingSecs:"",thinkingStatus:""},o=yield this.getToken(),l=I($({},t),{stream:!0});V(`${(d=(h=this.axiosInstance)==null?void 0:h.defaults.baseURL)==null?void 0:d.replace("/v1","/v3")}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(l),openWhenHidden:!0,signal:n,onopen(p){return p.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(p){if(!p.data&&!p.event&&!p.id&&!p.retry)return;let c={};try{c=JSON.parse(p.data)}catch(m){console.log("eventData",p.data)}const u=c.data.type,g=c.data.payload;if(i.isReplying=!0,u==="error"&&(i.code=c.code,i.message=c.message),u==="search"&&(i.code=c.code,i.message=c.message,i.searchReference.push(g)),u==="thinking"){i.code=c.code,i.message=c.message,i.thinkingStatus="start";const S=g.choices[0];i.reasoningContent=i.reasoningContent+S.delta.reasoningContent}if(u==="thinkingOver"){i.code=c.code,i.message=c.message,i.thinkingStatus="end";const m=g.thinkingSecs;i.thinkingSecs=m}if(u==="text"){i.code=c.code,i.message=c.message;const S=g.choices[0];i.content=i.content+S.delta.content}if(u==="reference"&&(i.code=c.code,i.message=c.message,i.reference=g),u==="result"){i.code=c.code,i.message=c.message;const m=g.messageId,S=g.llmModel,P=g.messageTime;i.messageId=m,i.llmModel=S,i.messageTime=P,i.sessionId=e}a!=null&&a.onmessage&&a.onmessage(i)},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const p=I($({},i),{isReplying:!1});a!=null&&a.onclose&&a.onclose(p)}})})}getResourceToken(e){return s(this,null,function*(){return this.get("/resourceToken",e)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/upload/ticket",e)})}postPrompts(e){return s(this,null,function*(){return this.post("/prompts",e)})}listPrompt(e){return s(this,null,function*(){return e!=null&&e.title&&e.title.length>K?[]: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=q.Buffer;class He extends f{constructor(e,t,n){super(e!=null?e:v.create(),n),this.axiosInstance=e,this.getToken=t}getApplicationIdSessions(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session`)})}getApplicationId(e){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`)})}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,n){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,n)})}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,n){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/sessions/${t}/comments`,n)})}getChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/chatHistory/${t}`)})}postChatV2EventSource(e,t,n,a,i,o){return s(this,null,function*(){const l={code:0,messageId:D(),content:"",role:T.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},h=yield this.getToken(),d=I($({},n),{stream:!0});V(`https://aiot-dev.glodon.com/api/cvforcepd/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${h}`,"Content-Type":"application/json"},body:JSON.stringify(d),openWhenHidden:!0,signal:a,onopen(p){return p.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(p){if(!p.data.includes('{"code": ')){let u={};try{u=JSON.parse(p.data)}catch(m){}(u==null?void 0:u.mtype)==="search"?l.searchReference.push(u):l.content=l.content+p.data;const g={content:l.content,role:1,reference:l.reference,searchReference:l.searchReference,messageId:l.messageId,sessionId:t,messageTime: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 c=JSON.parse(p.data);if(l.reference=c.data.reference,l.searchReference=c.data.searchReference,l.messageTime=c.data.messageTime,l.messageId=c.data.messageId,l.llmModel=c.data.llmModel,l.content=c.data.content,l.code=c.code,c.code===200){const u={code:l.code,content:l.content,role:1,reference:l.reference,searchReference:l.searchReference,messageId:l.messageId,sessionId:t,messageTime:l.messageTime,isReplying:!0};i!=null&&i.onmessage&&i.onmessage(u)}else return o&&o({code:c.code,message:c.message})},onerror(){i!=null&&i.onerror&&i.onerror()},onclose(){const p={code:l.code,content:l.content,role:1,reference:l.reference,searchReference:l.searchReference,messageId:l.messageId,sessionId:t,messageTime:l.messageTime,comment:{isAgree:0},isReplying:!1};i!=null&&i.onclose&&i.onclose(p)}})})}getKnowledgeIdFileIdData(e,t,n){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}/data/${n}`)})}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 n={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.postTicket(n).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a.minio,i)))).catch(a=>{throw Error(a)})})}postFile(e,t,n){return s(this,null,function*(){const a={files:[t.name],isv:"minio",knowledgeId:e,type:n};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 n={files:[t.name],isv:"minio",knowledgeId:e};return this.postTicket(n).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((n,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{k.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const l=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};k.putObjectBuffer(e.bucket,e.fileKeys[0],l,h,d=>{if(d)throw console.error(d),Error(d);n(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>K?[]: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,n){return s(this,null,function*(){return this.put(`/data/v1/application/${e}/prompts/${t}`,n)})}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,n){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file`,n)})}checkFileReady(e,t,n,a=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((l,h)=>{const d=()=>{if(!a()){clearInterval(p);return}n?this.getApplicationIdSessionKnowledgeFileId(e,t,n,{},!0).then(u=>{if(o==null||o(u),u.status===A.Success&&(clearInterval(p),l(u)),u.status===A.Failed){clearInterval(p);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:u}}))}}).catch(u=>{clearInterval(p),h(u)}):l(null)},p=setInterval(d,i);d()})})}getApplicationIdSessionKnowledgeFileId(e,t,n,a,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${n}`,a,i)})}delApplicationIdSessionKnowledgeFileId(e,t,n){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file/${n}`)})}postApplicationIdSessionKnowledgeSessionFile(e,t,n,a,i){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`,n,a,i)})}delApplicationIdSessionKnowledgeFile(e,t,n){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file`,n)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`/data/v1/chatSession/${e}/file`,t)})}patchApplicationIdKnowledgeIdFileId(e,t,n,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${n}`,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,n,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${n}`,a)})}updateSession(e,t,n){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,n)})}getSession(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}}globalThis.Buffer=q.Buffer;class Ne extends f{constructor(e,t,n){super(e!=null?e:v.create(),n),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,n){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,n)})}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,n,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${n}`,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>K?[]: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,n){return s(this,null,function*(){return this.put(`/data/v1/application/${e}/prompts/${t}`,n)})}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,n){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file`,n)})}postApplicationIdSessionKnowledgeFile(e,t,n){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/file`,n)})}postApplicationIdSessionKnowledgeSessionFile(e,t,n){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`,n)})}delApplicationIdSessionKnowledgeFile(e,t,n){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file`,n)})}getApplicationIdSessionKnowledgeFileId(e,t,n,a,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${n}`,a,i)})}delApplicationIdSessionKnowledgeFileId(e,t,n){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file/${n}`)})}patchApplicationIdKnowledgeIdFileId(e,t,n,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${n}`,a)})}checkFileReady(e,t,n,a=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((l,h)=>{const d=()=>{if(!a()){clearInterval(p);return}n?this.getApplicationIdSessionKnowledgeFileId(e,t,n,{},!0).then(u=>{if(o==null||o(u),u.status===A.Success&&(clearInterval(p),l(u)),u.status===A.Failed){clearInterval(p);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:u}}))}}).catch(u=>{clearInterval(p),h(u)}):l(null)},p=setInterval(d,i);d()})})}uploadFile(e,t){return s(this,null,function*(){const n={files:[t.name],isv:"minio",knowledgeId:e};return this.postUploadTicket(n).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((n,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{k.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const l=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};k.putObjectBuffer(e.bucket,e.fileKeys[0],l,h,d=>{if(d)throw console.error(d),Error(d);n(e.fileKeys[0])})}})})}postComments(e,t,n){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/sessions/${t}/comments`,n)})}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,n){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}/data/${n}`)})}postChatV2EventSource(e,t,n,a,i){return s(this,null,function*(){var d;const o={code:0,messageId:D(),content:"",role:T.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,message:""},l=yield this.getToken(),h=I($({},n),{stream:!0});V(`${(d=this.axiosInstance)==null?void 0:d.defaults.baseURL}/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify(h),openWhenHidden:!0,signal:a,onopen(p){return p.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(p){if(!p.data&&!p.event&&!p.id&&!p.retry)return;if(!p.data.includes('{"code": ')){let u={};try{u=JSON.parse(p.data)}catch(m){}(u==null?void 0:u.mtype)==="search"?o.searchReference.push(u):o.content=o.content+p.data;const g={content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime: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 c=JSON.parse(p.data);if(o.reference=c.data.reference,o.messageTime=c.data.messageTime,o.messageId=c.data.messageId,o.llmModel=c.data.llmModel,o.code=c.code,o.message=c.message,c.code===200){const u={code:o.code,content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:o.messageTime,isReplying:!0};i!=null&&i.onmessage&&i.onmessage(u)}},onerror(){i!=null&&i.onerror&&i.onerror()},onclose(){const p={code:o.code,content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:o.messageTime,comment:{isAgree:0},isReplying:!1,message:o.message};i!=null&&i.onclose&&i.onclose(p)}})})}postChat(e,t){return s(this,null,function*(){var n;return this.post(`${(n=this.axiosInstance)==null?void 0:n.defaults.baseURL}/chat/v2/chat`,e,t)})}}var ne=(r=>(r[r.Dialog=0]="Dialog",r[r.TextGenerate=1]="TextGenerate",r[r.FileSummery=2]="FileSummery",r))(ne||{}),re=(r=>(r[r.Robot=1]="Robot",r[r.User=2]="User",r[r.System=3]="System",r))(re||{}),ae=(r=>(r[r.Processing=1]="Processing",r[r.Done=2]="Done",r[r.Failed=3]="Failed",r))(ae||{}),ie=(r=>(r[r.File=0]="File",r[r.WebLink=1]="WebLink",r))(ie||{}),oe=(r=>(r[r.Processing=1]="Processing",r[r.Success=2]="Success",r[r.Failed=3]="Failed",r))(oe||{}),ce=(r=>(r.InputFile="ui.input.file",r.LLMModel="ui.llm.model",r))(ce||{}),le=(r=>(r[r.Idle=0]="Idle",r[r.Quoted=1]="Quoted",r))(le||{}),de=(r=>(r[r.Basic=0]="Basic",r[r.Pro=1]="Pro",r))(de||{}),pe=(r=>(r[r.Dialog=0]="Dialog",r[r.Text=1]="Text",r[r.Agent=2]="Agent",r[r.All=3]="All",r))(pe||{});class Oe extends f{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,n){return s(this,null,function*(){return this.patch(`/knowledge/${e}/file/${t}`,n)})}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,n){return s(this,null,function*(){return this.patch(`/application/${e}/sessions/${t}`,n)})}delSessionsId(e,t){return s(this,null,function*(){return this.delete(`/application/${e}/sessions/${t}`)})}getSessionKnowledgeFile(e,t,n){return s(this,null,function*(){return this.get(`/application/${e}session/${t}/file/${n}`)})}postSessionKnowledgeFile(e,t,n){return s(this,null,function*(){return this.post(`/application/${e}session/${t}/file`,n)})}postComments(e,t,n){return s(this,null,function*(){return this.post(`/application/${e}/sessions/${t}/comments`,n)})}getChatHistorySessionId(e,t,n){return s(this,null,function*(){return this.get(`application/${e}/chatHistory/${t}`,n)})}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){return s(this,null,function*(){return this.get(`/applications/${e}`)})}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((n,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{k.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const l=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};k.putObjectBuffer(e.bucket,e.fileKeys[0],l,h,d=>{if(d)throw console.error(d),Error(d);n(e.fileKeys[0])})}})})}uploadFile(e,t){return s(this,null,function*(){const n={files:[t.name],isv:"minio",knowledgeId:e};return this.getUploadTicket(n).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}uploadFiles(e,t){return s(this,null,function*(){const n={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.getUploadTicket(n).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,n){return s(this,null,function*(){return this.patch(`application/${e}/promptVariables/${t}`,n)})}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,n){return s(this,null,function*(){return this.patch(`session/${t}/promptVariables/${e}`,n)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/application/${e}/session/${t}/promptVariables`)})}patchApplicationIdSessionpromptVariablesId(e,t,n,a){return s(this,null,function*(){return this.patch(`/application/${e}/session/${t}/promptVariables/${n}`,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,n){return s(this,null,function*(){return this.listPaged(`/knowledge/${e}/file/${t}/data`,n)})}postKnowledgeIdFileIdData(e,t,n){return s(this,null,function*(){return this.post(`/knowledge/${e}/file/${t}/data`,{data:n})})}patchKnowledgeIdFileIdData(e,t,n,a){return s(this,null,function*(){return this.patch(`/knowledge/${e}/file/${t}/data/${n}`,{data:a})})}delKnowledgeIdFileIdDataDid(e,t,n){return s(this,null,function*(){return this.delete(`/knowledge/${e}/file/${t}/data/${n}`)})}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,n){return s(this,null,function*(){return this.post(`/application/${e}/sessions/${t}/comments`,n)})}getApplicationIdPrompts(e,t){return s(this,null,function*(){return this.get(`/application/${e}/promptVariables`,t)})}postKnowledgeSourceFile(e,t,n){return s(this,null,function*(){return this.post(`/knowledge/${e}/sourceFile/${t}`,n)})}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 ue=(r=>(r[r.inital=0]="inital",r[r.success=1]="success",r[r.processing=2]="processing",r[r.failed=3]="failed",r))(ue||{}),he=(r=>(r[r.inital=0]="inital",r[r.processing=1]="processing",r[r.paused=2]="paused",r[r.failed=3]="failed",r[r.done=4]="done",r))(he||{}),b=(r=>(r.Pending="PENDING",r.Started="STARTED",r.Failure="FAILURE",r.Success="SUCCESS",r.Abort="ABORT",r))(b||{}),ge=(r=>(r.Pending="PENDING",r.Started="STARTED",r.Success="SUCCESS",r.Failure="FAILURE ",r))(ge||{}),ye=(r=>(r[r.all=0]="all",r[r.general=1]="general",r[r.major=2]="major",r))(ye||{});function We(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){const e=Math.random()*16|0;return(r=="x"?e:e&3|8).toString(16)})}class _e extends f{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,n){return s(this,null,function*(){return this.get(`/datasets/${e}/versions?pageNo=${t}&pageSize=${n}`)})}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,n){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}`,n)})}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,n){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/labelcount`,n)})}getDatasetsIdVersionsVidSamples(e,t,n){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/samples`,n)})}updateSamples(e,t,n,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/samples`,{samples:n,confirmStatus:a})})}delDatasetsIdVersionsVidSamplesId(e,t,n){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/samples/${n}`)})}delDatasetsIdVersionsVidLlmSamplesId(e,t,n){return s(this,null,function*(){return this.delete(`datasets/${e}/versions/${t}/llmSamples/${n}`)})}getDatasetsIdVersionsVidSsamplesSid(e,t,n){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/samples/${n}`).then(a=>I($({},a),{labels:a.labels?a.labels.map(i=>I($({},i),{uuid:i.uuid||We()})):[]}))})}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,n){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/samples`,n)})}patchDatasetsIdVersionsVidSamples(e,t,n){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/samples`,n)})}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,n){return s(this,null,function*(){return this.patch(`/datasets/${e}/catagory/${t}`,{name:n})})}deleteCategory(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/catagory/${t}`)})}postDatasetIdVersionIdFilesDeduplication(e,t,n){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/files/deduplication`,n)})}postDatasetIdVersionIdLlmSamples(e,t,n){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples`,n)})}patchDatasetIdVersionIdLlmSampleId(e,t,n,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamples/${n}`,a)})}postLlmSamplesSubsection(e,t,n){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/subsection`,n)})}generatellmSamplesSubsection(e,t,n){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/subsection`,n)})}listSubsection(e,t,n,a){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/versions/${t}/llmSamples/${n}/subsection`,a)})}postSubsection(e,t,n,a){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/${n}/subsection`,a)})}updateSubsection(e,t,n,a,i){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamples/${n}/subsection/${a}`,i)})}deleteSubsection(e,t,n,a){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/llmSamples/${n}/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,n){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/versions/${t}/llmSamplesV2`,n)})}postDatasetsIdVersionsIdLlmSamplesV2(e,t,n){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamplesV2`,n)})}getDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,n){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/llmSamplesV2/${n}`)})}patchDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,n,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamplesV2/${n}`,a)})}delDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,n){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/llmSamplesV2/${n}`)})}getDatasetsIdVersionsIdExportLLMSamples(e,t){return s(this,null,function*(){return this.getNonStandard(`/datasets/${e}/versions/${t}/exportLLMSamples`,{responseType:"blob"})})}llmSamplesSubsectionView(e,t,n,a){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/${n}/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,n){return s(this,null,function*(){return this.patch(`/datasets/${e}/labels/${t}`,n)})}deleteLabel(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/labels/${t}`)})}postUploadPicsZip(e,t,n){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/uploadzip`,n)})}checkFileResult(e,t,n,a=1e3,i){return s(this,null,function*(){return new Promise((o,l)=>{const h=()=>{e?this.getUploadPicsZipResult(e,t,n).then(p=>{const c=p[0];if(c.state===b.Started||c.state===b.Pending){const u=c.process||0;i&&i(u)}if(c.state===b.Success&&(clearInterval(d),o(c.lastTaskResult)),c.state===b.Failure){clearInterval(d);const u="该文件处理失败";l(Error(u,{cause:{code:-101,message:u,data:c.lastTaskResult}}))}c.state===b.Abort&&(clearInterval(d),o(c.lastTaskResult))}).catch(p=>{clearInterval(d),l(p)}):o(null)},d=setInterval(h,a);h()})})}getUploadPicsZipResult(e,t,n){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/uploadzip`,n)})}getUploadabort(e,t,n){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/uploadabort`,n)})}postPreLabelTask(e,t,n){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/prelabeltask`,n)})}getPreLabelTask(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/prelabeltask`)})}delPreLabelTask(e,t,n){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/prelabeltask/${n}`)})}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,n){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/copyDataset`,n)})}deleteDatasetCopyTask(e,t,n){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/copyDataset`,n)})}}class Qe extends f{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 me=(r=>(r[r.minio=0]="minio",r[r.pvc=1]="pvc",r))(me||{}),$e=(r=>(r.common="A100",r.idcard="A104",r.bankcard="A108",r.page="A112",r.rmwatermark="A115",r.seal="A116",r.rmseal="A117",r.table="A118",r))($e||{}),fe=(r=>(r.User="user",r.Assistant="assistant",r.System="system",r))(fe||{});class Je extends f{constructor(e,t){super(e!=null?e:v.create(),t)}ocr(e,t){return s(this,null,function*(){if(t.modelStore===me.pvc){const n=this.convertToBatchParams(t),a=yield this.ocrPvcBatch(e,n);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(n=>{var a;return((a=n.textItems)==null?void 0:a.map(i=>({box:i.bbox})))||[]})}ocrMinio(e,t){return s(this,null,function*(){return t.image&&t.image.split("base64,").length>1&&(t.image=t.image.split("base64,")[1]),this.post(`/v2/infer?serviceId=${e}`,t)})}ocrPvcBatch(e,t){return s(this,null,function*(){return this.post(`/v2/infer?serviceId=${e}`,t)})}getSleep(e){return s(this,null,function*(){return new Promise(t=>{setTimeout(()=>{t(!0)},e*1e3)})})}postChatCompletions(e){return s(this,null,function*(){return this.postNonStandard("/v1/chat/completions",e)})}detection(e,t){return s(this,null,function*(){return this.post(`/v2/infer?serviceId=${e}`,t)})}getBaseModel(e){return s(this,null,function*(){return this.get("/v1/baseModel",{serviceId:e})})}postEmbeddings(e){return s(this,null,function*(){return this.postNonStandard("/v1/embeddings",e)})}}class je extends f{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=Be;exports.AIShopApi=Je;exports.AecKnowledgeFileStatus=A;exports.AecpilotUIApi=Ne;exports.AgentClientUIApi=He;exports.ApplicationTypes=pe;exports.ArchiGptUIKeys=ce;exports.AuthApi=Ae;exports.BaseApi=f;exports.CVForceApi=Oe;exports.CVForceDatahubApi=_e;exports.ChatMessageRole=re;exports.ChatMode=ne;exports.ContralyzeApi=je;exports.DataApi=be;exports.FileProccessStatus=ae;exports.GenerateStatus=he;exports.IChatRole=fe;exports.IDatasetLevel=ye;exports.IFileOrigin=se;exports.IHistoryRole=T;exports.ISourceType=Z;exports.ISpacetwinStatus=X;exports.IThinkingStatus=te;exports.IversionInfo=ee;exports.KnowledgeFileStatus=oe;exports.KnowledgeType=de;exports.ModelServiceApi=Qe;exports.OCRServiceId=$e;exports.PROMPT_SEARCH_MAX_LENGTH=K;exports.PROMPT_TITLE_MAX_LENGTH=Le;exports.PanoramaApi=Te;exports.PanoramaPluginMgrApi=Pe;exports.PreLabelTaskStatus=ge;exports.PromptStatus=le;exports.RecordStatus=G;exports.SourceType=ie;exports.SubsectionStatus=ue;exports.UploadZipsStatus=b;exports.needPrettifyMsg=Y;exports.prettifyMsg=z;
|
|
1
|
+
"use strict";var fe=Object.defineProperty,ve=Object.defineProperties;var Se=Object.getOwnPropertyDescriptors;var R=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var B=(n,e,t)=>e in n?fe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,m=(n,e)=>{for(var t in e||(e={}))N.call(e,t)&&B(n,t,e[t]);if(R)for(var t of R(e))H.call(e,t)&&B(n,t,e[t]);return n},S=(n,e)=>ve(n,Se(e));var O=(n,e)=>{var t={};for(var r in n)N.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&R)for(var r of R(n))e.indexOf(r)<0&&H.call(n,r)&&(t[r]=n[r]);return t};var s=(n,e,t)=>new Promise((r,a)=>{var i=h=>{try{l(t.next(h))}catch(d){a(d)}},o=h=>{try{l(t.throw(h))}catch(d){a(d)}},l=h=>h.done?r(h.value):Promise.resolve(h.value).then(i,o);l((t=t.apply(n,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("axios"),w=require("@glodon-aiot/minio"),M=require("uuid"),C=require("dayjs"),Q=require("buffer");class ${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,m({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,m({},r));return this.handleResponse(a)})}getNonStandard(e,t){return s(this,null,function*(){const r=this.axios.get(e,t);try{const a=yield r;if(a.status===200)return a}catch(a){throw this.handleError(a)}})}postNonStandard(e,t,r,a){return s(this,null,function*(){var l,h;const o=yield this.axios.post(e,t,m({params:r},a));if(o.status===200)if((l=o.data)!=null&&l.code)(h=this.errorHandler)!=null&&h.onAppStatusError&&this.errorHandler.onAppStatusError(o.data.code,o.data.message);else return o.data})}handleResponse(e,t){return s(this,null,function*(){try{const r=yield e;return this.handleAppError(r.data,t).data}catch(r){throw this.handleError(r)}})}handleAppError(e,t){var r;if(e.code<200||e.code>=300)throw(r=this.errorHandler)!=null&&r.onAppStatusError?this.errorHandler.onAppStatusError(e.code,J(e.code,e.message),t):console.error("未处理应用错误:",e),{isAxiosError:!1,message:e.message};return e}handleError(e){var t,r;return e.response?(t=this.errorHandler)!=null&&t.onHttpStatusError&&(console.log("HTTP 错误",this.errorHandler),this.errorHandler.onHttpStatusError(e.response.status,"",e.response)):e.request?(console.log(e.request),(r=this.errorHandler)!=null&&r.onNetworkError&&this.errorHandler.onNetworkError()):console.error("axios request config error:",e),new Error(e.message)}}const q=n=>n>=10002&&n<=10012,J=(n,e)=>q(n)?"数据操作错误":e||"未知接口错误";class Ie extends ${constructor(e,t){super(e!=null?e:f.create(),t)}getLoginUrl(){return s(this,null,function*(){return this.get("/openAddress")})}getToken(e,t){return s(this,null,function*(){return this.get(e,t)})}getAIoTTokenByGTeamToken(e){return s(this,null,function*(){return this.post("/validate/glodonCloud",e).then(t=>t.accessToken)})}postRefreshToken(e,t,r,a="3600",i){return s(this,null,function*(){return this.post("/refresh-token",{oldToken:e,tenant:t,orgId:r,expired:a,product:i})})}}class we extends ${constructor(e,t){super(e!=null?e:f.create(),t)}getTenant(e){return s(this,null,function*(){return this.get(`/tenant/${e}`)})}listProduct(){return s(this,null,function*(){return this.list("/products")})}listProvinces(){return s(this,null,function*(){return this.list("/regions/provinces")})}listCities(e){return s(this,null,function*(){return this.list(`/regions/provinces/${e}/city`)})}listCounties(e,t){return s(this,null,function*(){return this.list(`/regions/provinces/${e}/city/${t}/county`)})}getOrgList(e){return s(this,null,function*(){return this.list("/org",e)})}getUserIdOrgList(e,t){return s(this,null,function*(){return this.list(`/users/${e}/org`,t)})}delOrg(e){return s(this,null,function*(){return this.delete(`/org/${e}`)})}postOrg(e){return s(this,null,function*(){return this.post("/org",e)})}patchOrg(e,t){return s(this,null,function*(){return this.patch(`/org/${e}`,t)})}getUsers(e,t){return s(this,null,function*(){return this.list(`/tenant/${e}/users`,t)})}delUser(e,t){return s(this,null,function*(){return this.delete(`/tenant/${e}/users/${t}`)})}postUser(e,t){return s(this,null,function*(){return this.post(`/tenant/${e}/users`,t)})}patchUser(e,t,r){return s(this,null,function*(){return this.patch(`tenant/${e}/users/${t}`,r)})}getTenantList(){return s(this,null,function*(){return this.get("/tenant")})}getUserIdRoles(e){return s(this,null,function*(){return this.get(`/users/${e}/role`)})}getProductCodeRole(e){return s(this,null,function*(){return this.get(`/products/${e}/role`)})}postUserRole(e,t){return s(this,null,function*(){return this.post(`/users/${e}/role`,t)})}patchUserRole(e,t,r){return s(this,null,function*(){return this.patch(`/users/${e}/role/${t}`,r)})}deleteUserRole(e,t){return s(this,null,function*(){return this.delete(`/users/${e}/role/${t}`)})}getUsersIdProductCodeMenu(e,t,r="web",a){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/menu?groupCode=${r}`,{level:a})})}getUserInfo(e){return s(this,null,function*(){return this.get(`/users/${e}`)})}uipermission(e,t,r="web"){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/uipermission?groupCode=${r}`)})}getAppInfo(e){return s(this,null,function*(){return this.get(`/products/${e}/apps`)})}getTenantUserInfo(e,t){return s(this,null,function*(){return this.get(`/tenant/${e}/users/${t}`)})}uploadFile(e){return s(this,null,function*(){return this.upload("/upload",e)})}getUserIdProductCodeOrg(e,t){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/org`)})}getOrg(e){return s(this,null,function*(){return this.get(`/org/${e}`)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}putAppInfo(e,t){return s(this,null,function*(){return this.put(`/products/${e}/apps`,t)})}getTenantKeySecret(e){return s(this,null,function*(){return this.get(`/tenant/${e}/key`)})}resetTenantKeySecret(e){return s(this,null,function*(){return this.post(`/tenant/${e}/resetSecret`,void 0)})}getProductsCode(e){return s(this,null,function*(){return this.get(`/products/${e}`)})}}var j=(n=>(n.Collecting="采集中",n.CollectionTimeout="超时",n.CollectionFinish="完成",n.WaitUpload="等待上传",n.Uploading="上传中",n.UploadFinish="上传完成",n.UploadFailed="上传失败",n.WaitMerge="等待合成",n.CreateMergeTaskFailed="创建合成任务失败",n.Merging="合成中",n.MergeFailed="合成失败",n.MergeFinish="合成成功",n))(j||{}),Y=(n=>(n.Collecting="采集中",n.CollectionTimeout="超时",n.CollectionFinish="完成",n.WaitUpload="等待上传",n.Uploading="上传中",n.UploadFinish="上传完成",n.UploadFailed="上传失败",n.WaitMerge="等待合成",n.CreateMergeTaskFailed="创建合成任务失败",n.Merging="合成中",n.MergeFailed="合成失败",n.MergeFinish="合成成功",n))(Y||{});class ke extends ${constructor(e,t){super(e!=null?e:f.create(),t)}static parseApiToken(e){const t=window.atob(e.split(".")[1]);return JSON.parse(t)}static loadApiToken(e,t,r){return s(this,null,function*(){return fetch(`${e}${t}/viewtoken/${r}/create_apitoken`,{method:"POST"}).then(a=>{if(a.status!==200)throw console.error(a),Error(JSON.stringify(a));return a.json()}).then(a=>{if(a.code!==200)throw Error(JSON.stringify(a));return a.data.apiToken})})}listRecord(e){return s(this,null,function*(){return this.listPaged("/spacetwins",e)})}postRecord(e){return s(this,null,function*(){return this.post("/spacetwins",e)})}getRecordOverview(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}`)})}getRecordViewtoken(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}/viewtoken`)})}listScene(e){return s(this,null,function*(){return this.list(`/spacetwins/${e}/scenes`)})}getScenesByTimestamp(e,t){return s(this,null,function*(){return this.list(`/spacetwins/${e}/scenes_timestamp`,{timestamp:t})})}recomputeTrack(e,t){return s(this,null,function*(){return this.patch(`/spacetwins/${e}/track`,{points:t})})}updateRecordUploadStatus(e,t){return s(this,null,function*(){return this.post(`/spacetwins/${e}/update_upload_status`,t)})}getApiToken(e){return s(this,null,function*(){return this.post(`/viewtoken/${e}/create_apitoken`,{})})}getSpacetwins(e){return s(this,null,function*(){return this.listPaged("/spacetwins",e)})}postSpacetwins(e){return s(this,null,function*(){return this.post("/spacetwins",e)})}updateInspection(e,t){return s(this,null,function*(){return this.patch(`/patrolInspection/${e}`,t)})}getSpacetwinsIdViewtoken(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}/viewtoken`)})}postSpacetwinsIdUpdateUploadStatus(e,t){return s(this,null,function*(){return this.post(`/spacetwins/${e}/update_upload_status`,t)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/upload/ticket",e)})}getDownloadUrl(e){return s(this,null,function*(){return this.get(`/download/url?isv=${e.isv}&key=${e.key}`)})}listTrack(e,t){return s(this,null,function*(){return this.list(`/spacetwins/${e}/track`,{type:t})})}}class Ae extends ${constructor(e,t){super(e!=null?e:f.create(),t)}listPlugin(e){return s(this,null,function*(){return this.list("/plugins",e)})}postPlugin(e){return s(this,null,function*(){return this.post("/plugins",e)})}getPlugin(e){return s(this,null,function*(){return this.get(`/plugins/${e}`)})}updatePlugin(e,t){return s(this,null,function*(){return this.patch(`/plugins/${e}`,t)})}listPluginData(e,t){return s(this,null,function*(){return this.list(`/plugins/${e}/datas`,t)})}postPluginData(e,t){return s(this,null,function*(){return this.post(`/plugins/${e}/datas`,t)})}getPluginData(e,t){return s(this,null,function*(){return this.get(`/plugins/${e}/datas/${t}`).then(r=>S(m({},r),{arguments:JSON.parse(r.arguments)}))})}updatePluginData(e,t,r){return s(this,null,function*(){return this.patch(`/plugins/${e}/datas/${t}`,r)})}deletePluginData(e,t){return s(this,null,function*(){return this.delete(`/plugins/${e}/datas/${t}`)})}}var z=(n=>(n[n.None=0]="None",n[n.SourceFile=1]="SourceFile",n[n.WebLink=2]="WebLink",n))(z||{}),G=(n=>(n.Unprotected="不受著作权保护",n.ProtectAuthorize="受著作权保护,已获得授权",n.ProtectUnauthorize="受著作权保护,未获得授权",n))(G||{}),b=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(b||{}),X=(n=>(n.Start="start",n.End="end",n))(X||{}),k=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(k||{}),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 Te(n){let e,t,r,a=!1,i;return function(l){e===void 0?(e=l,t=0,r=-1,i=!1):e=Re(e,l);const h=e.length;let d=0;for(;t<h;){a&&(e[t]===10&&(d=++t),a=!1);let p=-1;for(;t<h&&p===-1;++t)switch(e[t]){case 58:r===-1&&(r=t-d);break;case 13:a=!1,t+4<h&&e[t+1]===10&&e[t+2]!==13&&e[t-1]!==10&&e[t-2]!==13&&(i=!0);case 10:p=t;break}if(p===-1)break;n(e.subarray(d,p),r,i),d=t,r=-1,i=!1}d===h?e=void 0:d!==0&&(e=e.subarray(d),t-=d)}}function Pe(n,e,t){let r=W();const a=new TextDecoder;return function(o,l,h){if(o.length===0)t==null||t(r),r=W();else if(l>0){const d=a.decode(o.subarray(0,l)),p=l+(o[l+1]===32?2:1);let c=a.decode(o.subarray(p));switch(h&&(c+=`
|
|
2
|
+
`),d){case"data":r.data=r.data?r.data+`
|
|
3
|
+
`+c:c;break;case"event":r.event=c;break;case"id":n(r.id=c);break;case"retry":const u=parseInt(c,10);isNaN(u)||e(r.retry=u);break}}}}function Re(n,e){const t=new Uint8Array(n.length+e.length);return t.set(n),t.set(e,n.length),t}function W(){return{data:"",event:"",id:"",retry:void 0}}const x="text/event-stream",Me=1e3,_="last-event-id";function F(n,p){var c=p,{signal:e,headers:t,onopen:r,onmessage:a,onclose:i,onerror:o,openWhenHidden:l,fetch:h}=c,d=O(c,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((u,g)=>{const y=m({},t);y.accept||(y.accept=x);let v;function T(){v.abort(),document.hidden||E()}l||document.addEventListener("visibilitychange",T);let U=Me,D=0;function K(){document.removeEventListener("visibilitychange",T),window.clearTimeout(D),v.abort()}e==null||e.addEventListener("abort",()=>{K(),u()});const me=h!=null?h:window.fetch,$e=r!=null?r:Fe;function E(){return s(this,null,function*(){var L;v=new AbortController;try{const P=yield me(n,S(m({},d),{headers:y,signal:v.signal}));yield $e(P),yield be(P.body,Te(Pe(I=>{I?y[_]=I:delete y[_]},I=>{U=I},a))),i==null||i(),K(),u()}catch(P){if(!v.signal.aborted)try{const I=(L=o==null?void 0:o(P))!=null?L:U;window.clearTimeout(D),D=window.setTimeout(E,I)}catch(I){K(),g(I)}}})}E()})}function Fe(n){const e=n.headers.get("content-type");if(!(e!=null&&e.startsWith(x)))throw new Error(`Expected content-type to be ${x}, Actual: ${e}`)}const V=128,Ve=20;class De extends ${constructor(e,t,r){super(e!=null?e:f.create(),r),this.axiosInstance=e,this.getToken=t}getSessions(){return s(this,null,function*(){return this.get("/chatSession")})}postSession(e){return s(this,null,function*(){return this.post("/chatSession",e)})}getSession(e){return s(this,null,function*(){return this.get(`/chatSession/${e}`)})}updateSession(e,t){return s(this,null,function*(){return this.patch(`/chatSession/${e}`,t)})}deleteSession(e){return s(this,null,function*(){return this.delete(`/chatSession/${e}`)})}getSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.get(`chatSession/${e}/file`,t)})}postSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.post(`chatSession/${e}/file`,t)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`chatSession/${e}/file`,t)})}getSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.get(`chatSession/${e}/file/${t}`)})}deleteSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.delete(`chatSession/${e}/file/${t}`)})}getSessionChatHistory(e,t){return s(this,null,function*(){return this.get(`/chatSession/${e}/history`,t)})}postMessage(e,t,r){return s(this,null,function*(){return this.post(`/config/tenantApplication?applicationId=${e}&sessionId=${t}`,r)})}postComments(e,t){return s(this,null,function*(){return this.post(`/chatSession/${e}/comments`,t)})}listApplications(){return s(this,null,function*(){return this.list("/applications")})}getApplication(){return s(this,null,function*(){return this.get("/config/tenantApplication")})}postApplication(e){return s(this,null,function*(){return this.post("/config/tenantApplication",{applicationId:e})})}getRecommendQues(){return s(this,null,function*(){return this.get("/recommendQues")})}postRecommendQues(e){return s(this,null,function*(){return this.post("/recommendQues",e)})}patchRecommendQues(e,t){return s(this,null,function*(){return this.patch(`/recommendQues/${e}`,t)})}delRecommendQues(e){return s(this,null,function*(){return this.delete(`/recommendQues/${e}`)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{w.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const l=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};w.putObjectBuffer(e.bucket,e.fileKeys[0],l,h,d=>{if(d)throw console.error(d),Error(d);r(e.fileKeys[0])})}})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>this.uploadMinioFile(a,t)).catch(a=>{throw Error(a)})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a,i)))).catch(a=>{throw Error(a)})})}getKnowledge(e,t){return s(this,null,function*(){return this.get("/knowledge",{docId:e,name:t})})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}`)})}updateKnowledgeIdFileId(e,t,r){return s(this,null,function*(){return this.patch(`/chatSession/${e}/file/${t}`,r)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}/data/${r}`)})}checkFileReady(e,t,r=()=>!0,a=1e4,i){return s(this,null,function*(){return new Promise((o,l)=>{const h=()=>{if(!r()){clearInterval(d);return}t?this.getSessionKnowledgeFile(e,t).then(c=>{if(i==null||i(c),c.status===k.Success&&(clearInterval(d),o(c)),c.status===k.Failed){clearInterval(d);const u="该文件无法读取,请上传可编辑pdf,doc,docx文档";l(Error(u,{cause:{code:-101,message:u,data:c}}))}}).catch(c=>{clearInterval(d),l(c)}):o(null)},d=setInterval(h,a);h()})})}postChat(e,t){return s(this,null,function*(){return this.post("/chat",e,t)})}postChatV2EventSource(e,t,r,a){return s(this,null,function*(){var h;const i={code:0,messageId:M.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},o=yield this.getToken(),l=S(m({},t),{stream:!0});F(`${(h=this.axiosInstance)==null?void 0:h.defaults.baseURL}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(l),openWhenHidden:!0,signal:r,onopen(d){return d.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(d){if(!d.data&&!d.event&&!d.id&&!d.retry)return;if(!d.data.includes('{"code": ')){let c={};try{c=JSON.parse(d.data)}catch(g){}(c==null?void 0:c.mtype)==="search"?i.searchReference.push(c):i.content=i.content+d.data;const u={content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:C(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(a==null?void 0:a.onmessage)&&a.onmessage(u)}const p=JSON.parse(d.data);if(i.reference=p.data.reference,i.messageTime=p.data.messageTime,i.messageId=p.data.messageId,i.llmModel=p.data.llmModel,i.code=p.code,p.code===200){const c={code:i.code,content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:i.messageTime,isReplying:!0};a!=null&&a.onmessage&&a.onmessage(c)}},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const d={code:i.code,content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:i.messageTime,comment:{isAgree:0},isReplying:!1};a!=null&&a.onclose&&a.onclose(d)}})})}postChatV3EventSource(e,t,r,a){return s(this,null,function*(){var h,d;const i={code:0,messageId:M.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,reasoningContent:"",thinkingSecs:"",thinkingStatus:""},o=yield this.getToken(),l=S(m({},t),{stream:!0});F(`${(d=(h=this.axiosInstance)==null?void 0:h.defaults.baseURL)==null?void 0:d.replace("/v1","/v3")}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(l),openWhenHidden:!0,signal:r,onopen(p){return p.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(p){if(!p.data&&!p.event&&!p.id&&!p.retry)return;let c={};try{c=JSON.parse(p.data)}catch(y){console.log("eventData",p.data)}const u=c.data.type,g=c.data.payload;if(i.isReplying=!0,u==="error"&&(i.code=c.code,i.message=c.message),u==="search"&&(i.code=c.code,i.message=c.message,i.searchReference.push(g)),u==="thinking"){i.code=c.code,i.message=c.message,i.thinkingStatus="start";const v=g.choices[0];i.reasoningContent=i.reasoningContent+v.delta.reasoningContent}if(u==="thinkingOver"){i.code=c.code,i.message=c.message,i.thinkingStatus="end";const y=g.thinkingSecs;i.thinkingSecs=y}if(u==="text"){i.code=c.code,i.message=c.message;const v=g.choices[0];i.content=i.content+v.delta.content}if(u==="reference"&&(i.code=c.code,i.message=c.message,i.reference=g),u==="result"){i.code=c.code,i.message=c.message;const y=g.messageId,v=g.llmModel,T=g.messageTime;i.messageId=y,i.llmModel=v,i.messageTime=T,i.sessionId=e}a!=null&&a.onmessage&&a.onmessage(i)},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const p=S(m({},i),{isReplying:!1});a!=null&&a.onclose&&a.onclose(p)}})})}getResourceToken(e){return s(this,null,function*(){return this.get("/resourceToken",e)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/upload/ticket",e)})}postPrompts(e){return s(this,null,function*(){return this.post("/prompts",e)})}listPrompt(e){return s(this,null,function*(){return e!=null&&e.title&&e.title.length>V?[]: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=Q.Buffer;class Ke extends ${constructor(e,t,r){super(e!=null?e:f.create(),r),this.axiosInstance=e,this.getToken=t}getApplicationIdSessions(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session`)})}getApplicationId(e){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`)})}postApplicationIdSession(e){return s(this,null,function*(){return this.post(`/data/v1/application/${e.applicationId}/sessions`,e)})}getApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}patchApplicationIdSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}/context`,{})})}delApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/sessions/${t}`)})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/sessions/${t}/comments`,r)})}getChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/chatHistory/${t}`)})}postChatV2EventSource(e,t,r,a,i,o){return s(this,null,function*(){const l={code:0,messageId:M.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},h=yield this.getToken(),d=S(m({},r),{stream:!0});F(`https://aiot-dev.glodon.com/api/cvforcepd/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${h}`,"Content-Type":"application/json"},body:JSON.stringify(d),openWhenHidden:!0,signal:a,onopen(p){return p.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(p){if(!p.data.includes('{"code": ')){let u={};try{u=JSON.parse(p.data)}catch(y){}(u==null?void 0:u.mtype)==="search"?l.searchReference.push(u):l.content=l.content+p.data;const g={content:l.content,role:1,reference:l.reference,searchReference:l.searchReference,messageId:l.messageId,sessionId:t,messageTime:C(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(i==null?void 0:i.onmessage)&&i.onmessage(g)}const c=JSON.parse(p.data);if(l.reference=c.data.reference,l.searchReference=c.data.searchReference,l.messageTime=c.data.messageTime,l.messageId=c.data.messageId,l.llmModel=c.data.llmModel,l.content=c.data.content,l.code=c.code,c.code===200){const u={code:l.code,content:l.content,role:1,reference:l.reference,searchReference:l.searchReference,messageId:l.messageId,sessionId:t,messageTime:l.messageTime,isReplying:!0};i!=null&&i.onmessage&&i.onmessage(u)}else return o&&o({code:c.code,message:c.message})},onerror(){i!=null&&i.onerror&&i.onerror()},onclose(){const p={code:l.code,content:l.content,role:1,reference:l.reference,searchReference:l.searchReference,messageId:l.messageId,sessionId:t,messageTime:l.messageTime,comment:{isAgree:0},isReplying:!1};i!=null&&i.onclose&&i.onclose(p)}})})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}/data/${r}`)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}`)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}`)})}getSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.get(`/data/v1/chatSession/${e}/file/${t}`)})}sleep(e){return s(this,null,function*(){return new Promise(t=>{setTimeout(()=>{t("")},e)})})}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.postTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a.minio,i)))).catch(a=>{throw Error(a)})})}postFile(e,t,r){return s(this,null,function*(){const a={files:[t.name],isv:"minio",knowledgeId:e,type:r};return this.postTicket(a).then(i=>this.uploadMinioFile(i.minio,t)).catch(i=>{throw Error(i)})})}postTicket(e){return s(this,null,function*(){return this.post("/data/v1/ticket",e)})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{w.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const l=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};w.putObjectBuffer(e.bucket,e.fileKeys[0],l,h,d=>{if(d)throw console.error(d),Error(d);r(e.fileKeys[0])})}})})}getRecommendQues(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/recommendQues`)})}postPrompts(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/prompts`,t)})}listPrompt(e,t){return s(this,null,function*(){return t!=null&&t.title&&t.title.length>V?[]:this.get(`/data/v1/application/${e}/prompts`,t)})}getPrompt(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/prompts/${t}`)})}updatePrompt(e,t,r){return s(this,null,function*(){return this.put(`/data/v1/application/${e}/prompts/${t}`,r)})}deletePrompt(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/prompts/${t}`)})}postGeneques(e,t){return s(this,null,function*(){return this.post("/data/v1/geneques",e,{},t)})}getApplicationIdSessionKnowledgeFiles(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file`,r)})}checkFileReady(e,t,r,a=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((l,h)=>{const d=()=>{if(!a()){clearInterval(p);return}r?this.getApplicationIdSessionKnowledgeFileId(e,t,r,{},!0).then(u=>{if(o==null||o(u),u.status===k.Success&&(clearInterval(p),l(u)),u.status===k.Failed){clearInterval(p);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:u}}))}}).catch(u=>{clearInterval(p),h(u)}):l(null)},p=setInterval(d,i);d()})})}getApplicationIdSessionKnowledgeFileId(e,t,r,a,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${r}`,a,i)})}delApplicationIdSessionKnowledgeFileId(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file/${r}`)})}postApplicationIdSessionKnowledgeSessionFile(e,t,r,a,i){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`,r,a,i)})}delApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file`,r)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`/data/v1/chatSession/${e}/file`,t)})}patchApplicationIdKnowledgeIdFileId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${r}`,a)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`)})}getApplicationIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/promptVariables`,t)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${r}`,a)})}updateSession(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}getSession(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}}globalThis.Buffer=Q.Buffer;class Ee extends ${constructor(e,t,r){super(e!=null?e:f.create(),r),this.axiosInstance=e,this.getToken=t}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}postGeneques(e){return s(this,null,function*(){return this.post("/data/v1/geneques",e)})}getApplicationId(e){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`)})}getApplicationIdSessions(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessionsa`,t)})}postApplicationIdSession(e){return s(this,null,function*(){return this.post(`/data/v1/application/${e.applicationId}/sessions`,e)})}getApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}patchApplicationIdSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}delApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/sessions/${t}`)})}getApplicationIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/promptVariables`,t)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${r}`,a)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`/data/v1/chatSession/${e}/file`,t)})}getRecommendQues(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/recommendQues`)})}postRecommendQues(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/recommendQues`,t)})}delRecommendQues(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/recommendQues/${t}`)})}getChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/chatHistory/${t}`)})}postPrompts(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/prompts`,t)})}listPrompt(e,t){return s(this,null,function*(){return t!=null&&t.title&&t.title.length>V?[]:this.get(`/data/v1/application/${e}/prompts`,t)})}getPrompt(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/prompts/${t}`)})}updatePrompt(e,t,r){return s(this,null,function*(){return this.put(`/data/v1/application/${e}/prompts/${t}`,r)})}deletePrompt(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/prompts/${t}`)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}/context`,{})})}getApplicationIdSessionKnowledgeFiles(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file`,r)})}postApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/file`,r)})}postApplicationIdSessionKnowledgeSessionFile(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`,r)})}delApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file`,r)})}getApplicationIdSessionKnowledgeFileId(e,t,r,a,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${r}`,a,i)})}delApplicationIdSessionKnowledgeFileId(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file/${r}`)})}patchApplicationIdKnowledgeIdFileId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${r}`,a)})}checkFileReady(e,t,r,a=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((l,h)=>{const d=()=>{if(!a()){clearInterval(p);return}r?this.getApplicationIdSessionKnowledgeFileId(e,t,r,{},!0).then(u=>{if(o==null||o(u),u.status===k.Success&&(clearInterval(p),l(u)),u.status===k.Failed){clearInterval(p);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:u}}))}}).catch(u=>{clearInterval(p),h(u)}):l(null)},p=setInterval(d,i);d()})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}postUploadTicket(e){return s(this,null,function*(){return this.post("/data/v1/ticket",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{w.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const l=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};w.putObjectBuffer(e.bucket,e.fileKeys[0],l,h,d=>{if(d)throw console.error(d),Error(d);r(e.fileKeys[0])})}})})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/sessions/${t}/comments`,r)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}`)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}`)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}/data/${r}`)})}postChatV2EventSource(e,t,r,a,i){return s(this,null,function*(){var d;const o={code:0,messageId:M.v4(),content:"",role:b.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,message:""},l=yield this.getToken(),h=S(m({},r),{stream:!0});F(`${(d=this.axiosInstance)==null?void 0:d.defaults.baseURL}/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify(h),openWhenHidden:!0,signal:a,onopen(p){return p.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(p){if(!p.data&&!p.event&&!p.id&&!p.retry)return;if(!p.data.includes('{"code": ')){let u={};try{u=JSON.parse(p.data)}catch(y){}(u==null?void 0:u.mtype)==="search"?o.searchReference.push(u):o.content=o.content+p.data;const g={content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:C(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(i==null?void 0:i.onmessage)&&i.onmessage(g)}const c=JSON.parse(p.data);if(o.reference=c.data.reference,o.messageTime=c.data.messageTime,o.messageId=c.data.messageId,o.llmModel=c.data.llmModel,o.code=c.code,o.message=c.message,c.code===200){const u={code:o.code,content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:o.messageTime,isReplying:!0};i!=null&&i.onmessage&&i.onmessage(u)}},onerror(){i!=null&&i.onerror&&i.onerror()},onclose(){const p={code:o.code,content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:o.messageTime,comment:{isAgree:0},isReplying:!1,message:o.message};i!=null&&i.onclose&&i.onclose(p)}})})}postChat(e,t){return s(this,null,function*(){var r;return this.post(`${(r=this.axiosInstance)==null?void 0:r.defaults.baseURL}/chat/v2/chat`,e,t)})}}var ee=(n=>(n[n.Dialog=0]="Dialog",n[n.TextGenerate=1]="TextGenerate",n[n.FileSummery=2]="FileSummery",n))(ee||{}),te=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(te||{}),se=(n=>(n[n.Processing=1]="Processing",n[n.Done=2]="Done",n[n.Failed=3]="Failed",n))(se||{}),re=(n=>(n[n.File=0]="File",n[n.WebLink=1]="WebLink",n))(re||{}),ne=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(ne||{}),ae=(n=>(n.InputFile="ui.input.file",n.LLMModel="ui.llm.model",n))(ae||{}),ie=(n=>(n[n.Idle=0]="Idle",n[n.Quoted=1]="Quoted",n))(ie||{}),oe=(n=>(n[n.Basic=0]="Basic",n[n.Pro=1]="Pro",n))(oe||{}),ce=(n=>(n[n.Dialog=0]="Dialog",n[n.Text=1]="Text",n[n.Agent=2]="Agent",n[n.All=3]="All",n))(ce||{});class xe extends ${constructor(e,t){super(e!=null?e:f.create(),t)}getKnowledge(e,t){return s(this,null,function*(){return this.get("/knowledge",{docId:e,name:t})})}postKnowledge(e){return s(this,null,function*(){return this.post("/knowledge",e)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/knowledge/${e}`)})}patchKnowledgeId(e,t){return s(this,null,function*(){return this.patch(`/knowledge/${e}`,t)})}delKnowledgeId(e){return s(this,null,function*(){return this.delete(`/knowledge/${e}`)})}getKnowledgeIdFile(e){return s(this,null,function*(){return this.get(`/knowledge/${e}/file`)})}getKnowledgeIdFileList(e,t){return s(this,null,function*(){return this.listPaged(`/knowledge/${e}/file`,t)})}postKnowledgeIdFile(e,t){return s(this,null,function*(){return this.post(`/knowledge/${e}/file`,t)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}delKnowledgeIdFileFid(e,t){return s(this,null,function*(){return this.delete(`/knowledge/${e}/file/${t}`)})}patchKnowledgeIdFileFid(e,t,r){return s(this,null,function*(){return this.patch(`/knowledge/${e}/file/${t}`,r)})}listSessions(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessionsa`,t)})}postSession(e,t){return s(this,null,function*(){return this.post(`/application/${e}/sessions`,t)})}getSession(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessions/${t}`)})}patchSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/application/${e}/sessions/${t}`,r)})}delSessionsId(e,t){return s(this,null,function*(){return this.delete(`/application/${e}/sessions/${t}`)})}getSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.get(`/application/${e}session/${t}/file/${r}`)})}postSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}session/${t}/file`,r)})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}/sessions/${t}/comments`,r)})}getChatHistorySessionId(e,t,r){return s(this,null,function*(){return this.get(`application/${e}/chatHistory/${t}`,r)})}postChatHistorySessionId(e,t){return s(this,null,function*(){return this.post(`/chatHistory/${e}`,t)})}getApplications(e){return s(this,null,function*(){return this.get("/applications",e)})}postApplication(e){return s(this,null,function*(){return this.post("/applications",e)})}getApplicationId(e){return s(this,null,function*(){return this.get(`/applications/${e}`)})}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=>{w.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const l=Buffer.from(o.target.result),h={"Content-Type":"application/octet-stream"};w.putObjectBuffer(e.bucket,e.fileKeys[0],l,h,d=>{if(d)throw console.error(d),Error(d);r(e.fileKeys[0])})}})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.getUploadTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.getUploadTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a.minio,i)))).catch(a=>{throw Error(a)})})}getAecModels(){return s(this,null,function*(){return this.get("/aecModels")})}postTextFilter(e){return s(this,null,function*(){return this.post("/textFilter",e)})}getTenantModel(){return s(this,null,function*(){return this.get("/tenantModel")})}getPrompts(e,t){return s(this,null,function*(){return this.get(`application/${e}/promptVariables`,t)})}postPrompt(e,t){return s(this,null,function*(){return this.post(`application/${e}/promptVariables`,t)})}patchPromptId(e,t,r){return s(this,null,function*(){return this.patch(`application/${e}/promptVariables/${t}`,r)})}delPromptId(e,t){return s(this,null,function*(){return this.delete(`application/${e}/promptVariables/${t}`)})}getSessionPrompts(e){return s(this,null,function*(){return this.get(`session/${e}/promptVariables`)})}patchSessionPromptId(e,t,r){return s(this,null,function*(){return this.patch(`session/${t}/promptVariables/${e}`,r)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/application/${e}/session/${t}/promptVariables`)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/application/${e}/session/${t}/promptVariables/${r}`,a)})}getPresetApplication(e){return s(this,null,function*(){return this.get("presetApplication",e)})}postKnowledgeConfig(e){return s(this,null,function*(){return this.post("/knowledgeConfig",e)})}getKnowledgeConfig(e){return s(this,null,function*(){return this.get(`/knowledgeConfig/${e}`)})}patchKnowledgeConfig(e,t){return s(this,null,function*(){return this.patch(`/knowledgeConfig/${e}`,t)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}`)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.listPaged(`/knowledge/${e}/file/${t}/data`,r)})}postKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.post(`/knowledge/${e}/file/${t}/data`,{data:r})})}patchKnowledgeIdFileIdData(e,t,r,a){return s(this,null,function*(){return this.patch(`/knowledge/${e}/file/${t}/data/${r}`,{data:a})})}delKnowledgeIdFileIdDataDid(e,t,r){return s(this,null,function*(){return this.delete(`/knowledge/${e}/file/${t}/data/${r}`)})}getPresetKnowledge(e){return s(this,null,function*(){return this.get("/presetKnowledge",e)})}patchSessionsIdContext(e){return s(this,null,function*(){return this.patch(`/sessions/${e}/context`,{})})}postResourceToken(e){return s(this,null,function*(){return this.post("/resourceToken",e)})}getApplicationIdSession(e){return s(this,null,function*(){return this.get(`/application/${e}/session`)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/application/${e}/sessions/${t}/context`,{})})}postApplicationIdSessions(e,t){return s(this,null,function*(){return this.post(`/application/${e}/sessions`,t)})}getApplicationIdChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/application/${e}/chatHistory/${t}`)})}postApplicationIdChatHistorySessionIdComments(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}/sessions/${t}/comments`,r)})}getApplicationIdPrompts(e,t){return s(this,null,function*(){return this.get(`/application/${e}/promptVariables`,t)})}postKnowledgeSourceFile(e,t,r){return s(this,null,function*(){return this.post(`/knowledge/${e}/sourceFile/${t}`,r)})}getMetadata(e){return s(this,null,function*(){return this.get("/metadata",e)})}postGeneques(e){return s(this,null,function*(){return this.post("/geneques",e)})}getBaseModel(e){return s(this,null,function*(){return this.get("/baseModelInfo",{serviceId:e})})}}var le=(n=>(n[n.inital=0]="inital",n[n.success=1]="success",n[n.processing=2]="processing",n[n.failed=3]="failed",n))(le||{}),de=(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))(de||{}),A=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Failure="FAILURE",n.Success="SUCCESS",n.Abort="ABORT",n))(A||{}),pe=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Success="SUCCESS",n.Failure="FAILURE ",n))(pe||{}),ue=(n=>(n[n.all=0]="all",n[n.general=1]="general",n[n.major=2]="major",n))(ue||{});function Ce(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){const e=Math.random()*16|0;return(n=="x"?e:e&3|8).toString(16)})}class Ue extends ${constructor(e,t){super(e!=null?e:f.create(),t)}getDatasets(e){return s(this,null,function*(){return this.get("/datasets",e)})}postDatasets(e){return s(this,null,function*(){return this.post("/datasets",e)})}getDatasetsId(e){return s(this,null,function*(){return this.get(`/datasets/${e}`)})}delDatasetsId(e){return s(this,null,function*(){return this.delete(`/datasets/${e}`)})}patchDatasetsId(e,t){return s(this,null,function*(){return this.patch(`/datasets/${e}`,t)})}getDatasetsIdVersions(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions?pageNo=${t}&pageSize=${r}`)})}getDatasetsIdVersionsVidNextno(e){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/nextno`)})}getS3Iam(e,t){return s(this,null,function*(){return this.post("/s3/iam",{datasetId:e,publicBucket:t})})}postDatasetsIdVersions(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/versions`,t)})}patchDatasetsIdVersionsVid(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}`,r)})}getDatasetsIdVersionsVid(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}`)})}delDatasetsIdVersionsVid(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}`)})}getDatasetsIdVersionsNo(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/no`,t)})}listDatasetsIdLabels(e,t){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/labels`,t)})}getDatasetsIdVersionsVidLabelcount(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/labelcount`,r)})}getDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/samples`,r)})}updateSamples(e,t,r,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/samples`,{samples:r,confirmStatus:a})})}delDatasetsIdVersionsVidSamplesId(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/samples/${r}`)})}delDatasetsIdVersionsVidLlmSamplesId(e,t,r){return s(this,null,function*(){return this.delete(`datasets/${e}/versions/${t}/llmSamples/${r}`)})}getDatasetsIdVersionsVidSsamplesSid(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/samples/${r}`).then(a=>S(m({},a),{labels:a.labels?a.labels.map(i=>S(m({},i),{uuid:i.uuid||Ce()})):[]}))})}getImportInfo(){return s(this,null,function*(){return this.get("/importInfo")})}getOptionsMarkType(){return s(this,null,function*(){return this.get("/options/markType")})}getOptionsOcrMarkTmpl(){return s(this,null,function*(){return this.get("/options/ocrMarkTmpl")})}getOptionsLlmMarkTmpl(){return s(this,null,function*(){return this.get("/options/llmMarkTmpl")})}getOptionsLlmResponseSort(){return s(this,null,function*(){return this.get("/options/llmResponseSort")})}getOptionsImgproxy(){return s(this,null,function*(){return this.get("/options/imgproxy")})}getDeduplication(e,t){return s(this,null,function*(){return this.post("/files/deduplication",{md5s:e,datasetId:t})})}postDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/samples`,r)})}patchDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/samples`,r)})}listCategory(e){return s(this,null,function*(){return this.list(`/datasets/${e}/catagory`)})}postCategory(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/catagory`,{name:t})})}updateCategory(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/catagory/${t}`,{name:r})})}deleteCategory(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/catagory/${t}`)})}postDatasetIdVersionIdFilesDeduplication(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/files/deduplication`,r)})}postDatasetIdVersionIdLlmSamples(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples`,r)})}patchDatasetIdVersionIdLlmSampleId(e,t,r,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamples/${r}`,a)})}postLlmSamplesSubsection(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/subsection`,r)})}generatellmSamplesSubsection(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/subsection`,r)})}listSubsection(e,t,r,a){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection`,a)})}postSubsection(e,t,r,a){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection`,a)})}updateSubsection(e,t,r,a,i){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection/${a}`,i)})}deleteSubsection(e,t,r,a){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection/${a}`)})}llmSupervisedRecordGenerate(e){return s(this,null,function*(){return this.post("/llm/supervisedRecord/generatedata",e)})}llmSupervisedRecordAbordTask(e){return s(this,null,function*(){return this.post("/llm/supervisedRecord/abortTask",e)})}llmSupervisedRecordPauseTask(e){return s(this,null,function*(){return this.post("/llm/supervisedRecord/pauseTask",e)})}getLlmSupervisedRecord(e){return s(this,null,function*(){return this.get(`/llm/supervisedRecord/${e}`)})}getDatasetsIdVersionsIdLlmSamplesV2(e,t,r){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/versions/${t}/llmSamplesV2`,r)})}postDatasetsIdVersionsIdLlmSamplesV2(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamplesV2`,r)})}getDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/llmSamplesV2/${r}`)})}patchDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,r,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamplesV2/${r}`,a)})}delDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/llmSamplesV2/${r}`)})}getDatasetsIdVersionsIdExportLLMSamples(e,t){return s(this,null,function*(){return this.getNonStandard(`/datasets/${e}/versions/${t}/exportLLMSamples`,{responseType:"blob"})})}llmSamplesSubsectionView(e,t,r,a){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/${r}/previewSubsection`,a)})}listLabels(e,t){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/labels`,t)})}postLabels(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/labels`,t)})}patchLabel(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/labels/${t}`,r)})}deleteLabel(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/labels/${t}`)})}postUploadPicsZip(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/uploadzip`,r)})}checkFileResult(e,t,r,a=1e3,i){return s(this,null,function*(){return new Promise((o,l)=>{const h=()=>{e?this.getUploadPicsZipResult(e,t,r).then(p=>{const c=p[0];if(c.state===A.Started||c.state===A.Pending){const u=c.process||0;i&&i(u)}if(c.state===A.Success&&(clearInterval(d),o(c.lastTaskResult)),c.state===A.Failure){clearInterval(d);const u="该文件处理失败";l(Error(u,{cause:{code:-101,message:u,data:c.lastTaskResult}}))}c.state===A.Abort&&(clearInterval(d),o(c.lastTaskResult))}).catch(p=>{clearInterval(d),l(p)}):o(null)},d=setInterval(h,a);h()})})}getUploadPicsZipResult(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/uploadzip`,r)})}getUploadabort(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/uploadabort`,r)})}postPreLabelTask(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/prelabeltask`,r)})}getPreLabelTask(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/prelabeltask`)})}delPreLabelTask(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/prelabeltask/${r}`)})}getAllConfirmSamples(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/confirm`)})}getDataSetCopyTask(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/copyDataset`)})}postDataSetCopyTask(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/copyDataset`,r)})}deleteDatasetCopyTask(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/copyDataset`,r)})}}class Le extends ${constructor(e,t){super(e!=null?e:f.create(),t)}listModelServices(e){return s(this,null,function*(){return this.listPaged("/modelService",e)})}postModelService(e){return s(this,null,function*(){return this.post("/modelService",e)})}getModelServiceById(e){return s(this,null,function*(){return this.get(`/modelService/${e}`)})}patchModelServiceById(e,t){return s(this,null,function*(){return this.patch(`/modelService/${e}`,t)})}deleteModelService(e){return s(this,null,function*(){return this.delete(`/modelService/${e}`)})}getEnableModelService(e){return s(this,null,function*(){return this.get(`/modelService/${e}/enable`)})}getDisableModelService(e){return s(this,null,function*(){return this.get(`/modelService/${e}/disable`)})}getModelServiceList(e){return s(this,null,function*(){return this.get(`/modelService/${e}/list`)})}getModelServiceDelist(e){return s(this,null,function*(){return this.get(`/modelService/${e}/delist`)})}importService(e){return s(this,null,function*(){return this.post("/modelService/import",e)})}patchModelService(e,t){return s(this,null,function*(){return this.patch(`/modelService/${e}`,t)})}openModelServices(e){return s(this,null,function*(){return this.get("/openModelService",e)})}importMirronService(e){return s(this,null,function*(){return this.post("/modelService/importMirron",e)})}patchMirronService(e,t){return s(this,null,function*(){return this.patch(`/modelService/importMirron/${e}`,t)})}getServiceSignList(e){return s(this,null,function*(){return this.get("/serviceSign",e)})}}var he=(n=>(n[n.minio=0]="minio",n[n.pvc=1]="pvc",n))(he||{}),ge=(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))(ge||{}),ye=(n=>(n.User="user",n.Assistant="assistant",n.System="system",n))(ye||{});class Be extends ${constructor(e,t){super(e!=null?e:f.create(),t)}ocr(e,t){return s(this,null,function*(){if(t.modelStore===he.pvc){const r=this.convertToBatchParams(t),a=yield this.ocrPvcBatch(e,r);return this.convertToMinioResult(a)}else return this.ocrMinio(e,t)})}convertToBatchParams(e){return{pages:[{image:e.image}]}}convertToMinioResult(e){var t;return(t=e.pages)==null?void 0:t.flatMap(r=>{var a;return((a=r.textItems)==null?void 0:a.map(i=>({box:i.bbox})))||[]})}ocrMinio(e,t){return s(this,null,function*(){return t.image&&t.image.split("base64,").length>1&&(t.image=t.image.split("base64,")[1]),this.post(`/v2/infer?serviceId=${e}`,t)})}ocrPvcBatch(e,t){return s(this,null,function*(){return this.post(`/v2/infer?serviceId=${e}`,t)})}getSleep(e){return s(this,null,function*(){return new Promise(t=>{setTimeout(()=>{t(!0)},e*1e3)})})}postChatCompletions(e){return s(this,null,function*(){return this.postNonStandard("/v1/chat/completions",e)})}detection(e,t){return s(this,null,function*(){return this.post(`/v2/infer?serviceId=${e}`,t)})}getBaseModel(e){return s(this,null,function*(){return this.get("/v1/baseModel",{serviceId:e})})}postEmbeddings(e){return s(this,null,function*(){return this.postNonStandard("/v1/embeddings",e)})}}class Ne extends ${constructor(e,t){super(e!=null?e:f.create(),t)}listTasks(e){return s(this,null,function*(){return this.get("/tasks",e)})}createTask(e){return s(this,null,function*(){return this.post("/tasks",e)})}getTask(e){return s(this,null,function*(){return this.get(`/tasks/${e}`)})}updateTask(e,t){return s(this,null,function*(){return this.patch(`/tasks/${e}`,t)})}deleteTask(e){return s(this,null,function*(){return this.delete(`/tasks/${e}`)})}listTaskFiles(e){return s(this,null,function*(){return this.get(`/tasks/${e}/files`)})}uploadTaskFile(e,t){return s(this,null,function*(){return this.post(`/tasks/${e}/files`,t)})}listWorkflowExecutions(e){return s(this,null,function*(){return this.get("/workflows/executions",e)})}getWorkflowExecution(e){return s(this,null,function*(){return this.get(`/workflows/executions/${e}`)})}startWorkflowExecution(e){return s(this,null,function*(){return this.post("/workflows/executions",e)})}updateWorkflowExecution(e,t){return s(this,null,function*(){return this.patch(`/workflows/executions/${e}`,t)})}cancelWorkflowExecution(e){return s(this,null,function*(){return this.post(`/workflows/executions/${e}/cancel`,{})})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}}exports.AECPilotApi=De;exports.AIShopApi=Be;exports.AecKnowledgeFileStatus=k;exports.AecpilotUIApi=Ee;exports.AgentClientUIApi=Ke;exports.ApplicationTypes=ce;exports.ArchiGptUIKeys=ae;exports.AuthApi=Ie;exports.BaseApi=$;exports.CVForceApi=xe;exports.CVForceDatahubApi=Ue;exports.ChatMessageRole=te;exports.ChatMode=ee;exports.ContralyzeApi=Ne;exports.DataApi=we;exports.FileProccessStatus=se;exports.GenerateStatus=de;exports.IChatRole=ye;exports.IDatasetLevel=ue;exports.IFileOrigin=Z;exports.IHistoryRole=b;exports.ISourceType=z;exports.ISpacetwinStatus=Y;exports.IThinkingStatus=X;exports.IversionInfo=G;exports.KnowledgeFileStatus=ne;exports.KnowledgeType=oe;exports.ModelServiceApi=Le;exports.OCRServiceId=ge;exports.PROMPT_SEARCH_MAX_LENGTH=V;exports.PROMPT_TITLE_MAX_LENGTH=Ve;exports.PanoramaApi=ke;exports.PanoramaPluginMgrApi=Ae;exports.PreLabelTaskStatus=pe;exports.PromptStatus=ie;exports.RecordStatus=j;exports.SourceType=re;exports.SubsectionStatus=le;exports.UploadZipsStatus=A;exports.needPrettifyMsg=q;exports.prettifyMsg=J;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glodon-aiot/apis",
|
|
3
|
-
"version": "3.0.10-beta.
|
|
3
|
+
"version": "3.0.10-beta.3",
|
|
4
4
|
"author": "glodoncv",
|
|
5
5
|
"description": "aiot apis",
|
|
6
6
|
"type": "module",
|
|
@@ -68,7 +68,8 @@
|
|
|
68
68
|
"require-from-string": "^2.0.2",
|
|
69
69
|
"typescript": "*",
|
|
70
70
|
"vite": "^4.1.1",
|
|
71
|
-
"vite-plugin-dts": "4.1.1"
|
|
71
|
+
"vite-plugin-dts": "4.1.1",
|
|
72
|
+
"vite-plugin-externalize-deps": "^0.9.0"
|
|
72
73
|
},
|
|
73
74
|
"lint-staged": {
|
|
74
75
|
"*.{js,css,md,jsx,less,ts,tsx,json}": "prettier --write"
|
|
@@ -80,6 +81,7 @@
|
|
|
80
81
|
"dependencies": {
|
|
81
82
|
"@glodon-aiot/minio": "^0.1.6",
|
|
82
83
|
"axios": "0.24.0",
|
|
83
|
-
"dayjs": "^1.11.13"
|
|
84
|
+
"dayjs": "^1.11.13",
|
|
85
|
+
"uuid": "^11.1.0"
|
|
84
86
|
}
|
|
85
87
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
let t;
|
|
2
|
-
const e = new Uint8Array(16);
|
|
3
|
-
function o() {
|
|
4
|
-
if (!t && (t = typeof crypto != "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !t))
|
|
5
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
6
|
-
return t(e);
|
|
7
|
-
}
|
|
8
|
-
export {
|
|
9
|
-
o as default
|
|
10
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const i = [];
|
|
2
|
-
for (let n = 0; n < 256; ++n)
|
|
3
|
-
i.push((n + 256).toString(16).slice(1));
|
|
4
|
-
function c(n, u = 0) {
|
|
5
|
-
return i[n[u + 0]] + i[n[u + 1]] + i[n[u + 2]] + i[n[u + 3]] + "-" + i[n[u + 4]] + i[n[u + 5]] + "-" + i[n[u + 6]] + i[n[u + 7]] + "-" + i[n[u + 8]] + i[n[u + 9]] + "-" + i[n[u + 10]] + i[n[u + 11]] + i[n[u + 12]] + i[n[u + 13]] + i[n[u + 14]] + i[n[u + 15]];
|
|
6
|
-
}
|
|
7
|
-
export {
|
|
8
|
-
c as unsafeStringify
|
|
9
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import e from "./native.mjs";
|
|
2
|
-
import i from "./rng.mjs";
|
|
3
|
-
import { unsafeStringify as d } from "./stringify.mjs";
|
|
4
|
-
function g(n, m, t) {
|
|
5
|
-
if (e.randomUUID && !m && !n)
|
|
6
|
-
return e.randomUUID();
|
|
7
|
-
n = n || {};
|
|
8
|
-
const r = n.random || (n.rng || i)();
|
|
9
|
-
if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, m) {
|
|
10
|
-
t = t || 0;
|
|
11
|
-
for (let a = 0; a < 16; ++a)
|
|
12
|
-
m[t + a] = r[a];
|
|
13
|
-
return m;
|
|
14
|
-
}
|
|
15
|
-
return d(r);
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
g as default
|
|
19
|
-
};
|