@glodon-aiot/apis 2.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.git.md +73 -0
  2. package/README.lib.md +135 -0
  3. package/dist/es/aecpilot/cosntant.mjs +5 -0
  4. package/dist/es/aecpilot/index.mjs +510 -0
  5. package/dist/es/aecpilot/model.mjs +9 -0
  6. package/dist/es/aecpilotui/index.mjs +607 -0
  7. package/dist/es/agentcliui/index.mjs +418 -0
  8. package/dist/es/aishop/index.mjs +97 -0
  9. package/dist/es/aishop/model.mjs +5 -0
  10. package/dist/es/auth/index.mjs +52 -0
  11. package/dist/es/base/index.mjs +158 -0
  12. package/dist/es/contralyze/index.mjs +91 -0
  13. package/dist/es/cvforce/index.mjs +431 -0
  14. package/dist/es/cvforce/model.mjs +12 -0
  15. package/dist/es/cvforce-datahub/index.mjs +435 -0
  16. package/dist/es/cvforce-datahub/model.mjs +8 -0
  17. package/dist/es/cvforce-modelservice/index.mjs +114 -0
  18. package/dist/es/cvforce-modelservice/model.mjs +4 -0
  19. package/dist/es/index.mjs +62 -0
  20. package/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +6 -0
  21. package/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +10 -0
  22. package/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +9 -0
  23. package/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +19 -0
  24. package/dist/es/panorama/index.mjs +136 -0
  25. package/dist/es/panorama/model.mjs +5 -0
  26. package/dist/es/pluginmgr/index.mjs +85 -0
  27. package/dist/es/user/index.mjs +193 -0
  28. package/dist/es/utils/fetchEventSource/fetch.mjs +112 -0
  29. package/dist/es/utils/fetchEventSource/parse.mjs +97 -0
  30. package/dist/es/utils/index.mjs +9 -0
  31. package/dist/lib/index.js +3 -0
  32. package/dist/src/aecpilot/cosntant.d.ts +8 -0
  33. package/dist/src/aecpilot/index.d.ts +79 -0
  34. package/dist/src/aecpilot/model.d.ts +350 -0
  35. package/dist/src/aecpilotui/index.d.ts +72 -0
  36. package/dist/src/aecpilotui/model.d.ts +63 -0
  37. package/dist/src/agentcliui/index.d.ts +72 -0
  38. package/dist/src/agentcliui/model.d.ts +39 -0
  39. package/dist/src/aishop/index.d.ts +26 -0
  40. package/dist/src/aishop/model.d.ts +111 -0
  41. package/dist/src/auth/index.d.ts +17 -0
  42. package/dist/src/auth/model.d.ts +24 -0
  43. package/dist/src/base/index.d.ts +41 -0
  44. package/dist/src/base/model.d.ts +20 -0
  45. package/dist/src/contralyze/index.d.ts +24 -0
  46. package/dist/src/contralyze/model.d.ts +75 -0
  47. package/dist/src/cvforce/index.d.ts +130 -0
  48. package/dist/src/cvforce/model.d.ts +519 -0
  49. package/dist/src/cvforce-datahub/index.d.ts +186 -0
  50. package/dist/src/cvforce-datahub/model.d.ts +438 -0
  51. package/dist/src/cvforce-modelservice/index.d.ts +23 -0
  52. package/dist/src/cvforce-modelservice/model.d.ts +156 -0
  53. package/dist/src/index.d.ts +19 -0
  54. package/dist/src/panorama/index.d.ts +42 -0
  55. package/dist/src/panorama/model.d.ts +263 -0
  56. package/dist/src/pluginmgr/index.d.ts +28 -0
  57. package/dist/src/pluginmgr/model.d.ts +48 -0
  58. package/dist/src/user/index.d.ts +42 -0
  59. package/dist/src/user/model.d.ts +247 -0
  60. package/dist/src/utils/fetchEventSource/fetch.d.ts +44 -0
  61. package/dist/src/utils/fetchEventSource/index.d.ts +1 -0
  62. package/dist/src/utils/fetchEventSource/parse.d.ts +36 -0
  63. package/dist/src/utils/index.d.ts +1 -0
  64. package/package.json +88 -0
@@ -0,0 +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?(console.log(e.response.data),console.log(e.response.status),console.log(e.response.headers),(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":n.data=n.data?n.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 console.log("onopen"),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 console.log("onopen"),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 console.log("onopen"),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 console.log("onopen"),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){return s(this,null,function*(){return this.post("/comments",e)})}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;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * prompt 查询接口不支持过长的入参
3
+ **/
4
+ export declare const PROMPT_SEARCH_MAX_LENGTH = 128;
5
+ /**
6
+ * prompt title 长度限制
7
+ */
8
+ export declare const PROMPT_TITLE_MAX_LENGTH = 20;
@@ -0,0 +1,79 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { ApiErrorHandler, BaseApi } from '../base';
3
+ import { IUploadParam, IUploadTicket, IAecSessionParam as ISessionParam, IAecSession as ISession, ICommentParam, IHistory, MinioConfig, KnowledgeFileMetadata, KnowledgeFileMetadataParams, IMessageParams, IKnowledge, IApplication, IQuestion, ResourceTokenParams, ResourceToken, IAecFile as IFile, IAecFileDataParam as IFileDataParam, IKnowledgeFileParams, IFileParams, IAecPrompt as IPrompt, IAecPromptParam as IPromptParam, IPromptType, IBaseModelInfo } from './model';
4
+ export declare class AECPilotApi extends BaseApi {
5
+ private axiosInstance;
6
+ private getToken;
7
+ constructor(axiosInstance: AxiosInstance, getToken: () => string, errorHandler?: ApiErrorHandler);
8
+ getSessions(): Promise<ISession[]>;
9
+ postSession(params: ISessionParam): Promise<string>;
10
+ getSession(id: string): Promise<ISession>;
11
+ updateSession(id: string, params: ISessionParam): Promise<string>;
12
+ deleteSession(id: string): Promise<ISession>;
13
+ getSessionKnowledgeFiles(sessionId: string, params?: {
14
+ enabled: number;
15
+ }): Promise<KnowledgeFileMetadata[]>;
16
+ postSessionKnowledgeFile(sessionId: string, params: KnowledgeFileMetadataParams): Promise<string>;
17
+ deleteSessionKnowledgeFiles(sessionId: string, params: {
18
+ files: IFileParams[];
19
+ }): Promise<any>;
20
+ getSessionKnowledgeFile(sessionId: string, fileId: string): Promise<KnowledgeFileMetadata>;
21
+ deleteSessionKnowledgeFile(sessionId: string, fileId: string): Promise<string>;
22
+ getSessionChatHistory(sessionId: string, params?: {
23
+ contextOnly?: boolean;
24
+ pageSize?: number;
25
+ endTime?: string;
26
+ }): Promise<IHistory[]>;
27
+ postMessage(applicationId: string, sessionId: string, params: IMessageParams): Promise<null>;
28
+ postComments(sessionId: string, params: ICommentParam): Promise<unknown>;
29
+ listApplications(): Promise<IApplication[]>;
30
+ getApplication(): Promise<string>;
31
+ postApplication(applicationId: string): Promise<null>;
32
+ getRecommendQues(): Promise<IQuestion[]>;
33
+ postRecommendQues(params: IQuestion): Promise<unknown>;
34
+ patchRecommendQues(id: string, params: IQuestion): Promise<IQuestion>;
35
+ delRecommendQues(id: string): Promise<unknown>;
36
+ getUploadTicket(params: IUploadParam): Promise<IUploadTicket>;
37
+ uploadMinioFile(minioConfig: MinioConfig, file: File): Promise<string>;
38
+ uploadFile(path: string, file: File): Promise<string>;
39
+ uploadFiles(path: string, files: File[]): Promise<string[]>;
40
+ getKnowledge(docId?: string, name?: string): Promise<IKnowledge[]>;
41
+ getKnowledgeIdFileId(id: string, fid: string): Promise<IFile>;
42
+ updateKnowledgeIdFileId(id: string, fid: string, params: IKnowledgeFileParams): Promise<IFile>;
43
+ getKnowledgeIdFileIdData(id: string, fid: string, did: string): Promise<IFileDataParam[]>;
44
+ checkFileReady(sessionId: string, fileId?: string, shouldContinueFunc?: () => boolean, interval?: number, upateFileFn?: any): Promise<KnowledgeFileMetadata | null>;
45
+ postChat(params: any, query: {
46
+ sessionId: string;
47
+ geneQues: boolean;
48
+ }): Promise<IHistory>;
49
+ postChatV2EventSource(sessionId: string, params: any, signal: AbortSignal, options: {
50
+ onopen?: any;
51
+ onmessage?: any;
52
+ onerror?: any;
53
+ onclose?: any;
54
+ }): Promise<void>;
55
+ postChatV3EventSource(sessionId: string, params: any, signal: AbortSignal, options: {
56
+ onopen?: any;
57
+ onmessage?: any;
58
+ onerror?: any;
59
+ onclose?: any;
60
+ }): Promise<void>;
61
+ getResourceToken(params: ResourceTokenParams): Promise<ResourceToken>;
62
+ postUploadTicket(params: IUploadParam): Promise<IUploadTicket>;
63
+ postPrompts(params: IPromptParam): Promise<{
64
+ id: string;
65
+ }>;
66
+ listPrompt(params?: {
67
+ title?: string;
68
+ type?: IPromptType;
69
+ }): Promise<IPrompt[]>;
70
+ getPrompt(id: string): Promise<IPrompt>;
71
+ updatePrompt(id: string, params: IPromptParam): Promise<string>;
72
+ deletePrompt(id: string): Promise<string>;
73
+ chatSessionIdContext(id: string): Promise<unknown>;
74
+ getBaseModelInfo(serviceId: string): Promise<IBaseModelInfo>;
75
+ getApplicationId(id: string): Promise<IApplication>;
76
+ getAppService(): Promise<any>;
77
+ }
78
+ export * from './model';
79
+ export * from './cosntant';
@@ -0,0 +1,350 @@
1
+ export interface IArrange {
2
+ llmModel: string;
3
+ prePrompt: string;
4
+ knowledges: any;
5
+ temperature: number;
6
+ score: number;
7
+ topK: number;
8
+ textFilter: number;
9
+ roleCognition: string;
10
+ repetitionPenalty: number;
11
+ embeddingService: string;
12
+ enableNetOpen: boolean;
13
+ }
14
+ export interface IApplication {
15
+ id: string;
16
+ name: string;
17
+ description: string;
18
+ logo: string;
19
+ createdAt: string;
20
+ updatedAt: string;
21
+ embeddings: string[];
22
+ arrange: IArrange[];
23
+ type: number;
24
+ }
25
+ export declare enum ISourceType {
26
+ None = 0,
27
+ SourceFile = 1,
28
+ WebLink = 2
29
+ }
30
+ export interface IKnowledge {
31
+ id: string;
32
+ name: string;
33
+ description: string;
34
+ fileSize: number;
35
+ fileUrl: string;
36
+ createdAt: string;
37
+ tenantCode: string;
38
+ isReady: boolean;
39
+ fileName: string;
40
+ fileCount: number;
41
+ knowledgeApplicationCount: number;
42
+ usedType: number;
43
+ knowledgeSourceName: string;
44
+ sourceFileUrl: string;
45
+ sourceType: ISourceType;
46
+ webLink: string;
47
+ sourceFileName: string;
48
+ }
49
+ export interface IAecFile {
50
+ id: string;
51
+ knowledgeId: string;
52
+ size: number;
53
+ name: string;
54
+ originalName: string;
55
+ status: number;
56
+ url: string;
57
+ ext: string;
58
+ creator: string;
59
+ chromaFileIds: string;
60
+ description: string;
61
+ wordCount: number;
62
+ createdAt: string;
63
+ wordNumber: number;
64
+ updatedAt: string;
65
+ source: number;
66
+ originalFile: string;
67
+ downloadOriginalFileUrl: string;
68
+ enabled: number;
69
+ datasetData: {
70
+ datasetId: string;
71
+ versionId: string;
72
+ sampleId: string;
73
+ };
74
+ knowledgeSourceName: string;
75
+ sourceType: number;
76
+ sourceFileName: string;
77
+ sourceFileUrl: string;
78
+ webLink: string;
79
+ nickname: string;
80
+ createName: string;
81
+ createUsername: string;
82
+ updateName: string;
83
+ updateUsername: string;
84
+ versionInfo: IversionInfo;
85
+ }
86
+ export declare enum IversionInfo {
87
+ Unprotected = "\u4E0D\u53D7\u8457\u4F5C\u6743\u4FDD\u62A4",
88
+ ProtectAuthorize = "\u53D7\u8457\u4F5C\u6743\u4FDD\u62A4\uFF0C\u5DF2\u83B7\u5F97\u6388\u6743",
89
+ ProtectUnauthorize = "\u53D7\u8457\u4F5C\u6743\u4FDD\u62A4\uFF0C\u672A\u83B7\u5F97\u6388\u6743"
90
+ }
91
+ export interface IUploadParam {
92
+ files: string[];
93
+ isv: string;
94
+ knowledgeId: string;
95
+ }
96
+ export interface MinioConfig {
97
+ accessKey: string;
98
+ secretKey: string;
99
+ bucket: string;
100
+ expiredAt: number;
101
+ prefix: string;
102
+ endpoints: string[];
103
+ region: string;
104
+ useSSL: boolean;
105
+ fileKeys: string[];
106
+ }
107
+ export interface IUploadTicket {
108
+ accessKey: string;
109
+ secretKey: string;
110
+ bucket: string;
111
+ expiredAt: number;
112
+ prefix: string;
113
+ endpoints: string[];
114
+ region: string;
115
+ useSSL: boolean;
116
+ fileKeys: string[];
117
+ }
118
+ export interface IAecSessionPrompt {
119
+ id: string;
120
+ key: string;
121
+ name: string;
122
+ value: string;
123
+ }
124
+ export interface IAecSession {
125
+ id: string;
126
+ sessionId: string;
127
+ name: string;
128
+ lastRelatedQuestion: string[];
129
+ tenantCode: string;
130
+ creator: string;
131
+ updater: string;
132
+ createdAt: string;
133
+ updatedAt: string;
134
+ deletedAt: string;
135
+ sessionFilesCount?: number;
136
+ netOpen: boolean;
137
+ enableNetOpen: boolean;
138
+ finialMessage: string;
139
+ fileStatus: number;
140
+ fileCount: number;
141
+ lastFileName: string;
142
+ knowledges: IKnowledge[];
143
+ isFirstCreate?: boolean;
144
+ top: boolean;
145
+ }
146
+ export interface IAecSessionParam {
147
+ name?: string;
148
+ groupId?: string[];
149
+ lastRelatedQuestion?: string[];
150
+ netOpen?: number;
151
+ enableNetOpen?: number;
152
+ finialMessage?: string;
153
+ applicationId?: string;
154
+ top?: boolean;
155
+ knowledges?: any;
156
+ knowledgeList?: any;
157
+ }
158
+ export interface ICommentParam {
159
+ messageId?: string;
160
+ isAgree: number;
161
+ againstReason?: string[];
162
+ }
163
+ export declare enum IHistoryRole {
164
+ Robot = 1,
165
+ User = 2,
166
+ System = 3
167
+ }
168
+ export interface IHistory {
169
+ code: number;
170
+ ts?: string;
171
+ messageId: string;
172
+ content: string;
173
+ role: IHistoryRole;
174
+ userId?: string;
175
+ sessionId: string;
176
+ reference: IAecReference[];
177
+ searchReference: ISearchReference[];
178
+ comment?: ICommentParam;
179
+ knowledges?: IKnowledge[];
180
+ isWaiting?: boolean;
181
+ messageTime: string;
182
+ fileId?: string;
183
+ file?: KnowledgeFileMetadata;
184
+ files?: KnowledgeFileMetadata[];
185
+ llmModel?: string;
186
+ isContext?: boolean;
187
+ isReplying?: boolean;
188
+ isRelatedQuestion?: boolean;
189
+ lastRelatedQuestions?: any;
190
+ relatedQuesion?: any;
191
+ isSensitive?: boolean;
192
+ actions: {
193
+ type: string;
194
+ data: {
195
+ funcCode: string;
196
+ funcName: string;
197
+ parameters: {
198
+ query: string;
199
+ };
200
+ pluginCode: string;
201
+ pluginName: string;
202
+ requestBody: {
203
+ flag: boolean;
204
+ };
205
+ step: string;
206
+ thought: string;
207
+ result: string;
208
+ };
209
+ }[][];
210
+ isLoading: boolean;
211
+ message?: string;
212
+ isRelateLoading?: boolean;
213
+ isSuspend?: boolean;
214
+ reasoningContent?: string;
215
+ thinkingSecs?: number;
216
+ thinkingStatus?: string;
217
+ }
218
+ export declare enum IThinkingStatus {
219
+ Start = "start",
220
+ End = "end"
221
+ }
222
+ export interface IAecReference {
223
+ text: string;
224
+ docId: string;
225
+ fileId: string;
226
+ fileName: string;
227
+ fileUrl: string;
228
+ knowledgeId: string;
229
+ knowledgeName: string;
230
+ knowledgeSourceName: string;
231
+ score: number;
232
+ sourceFileName: string;
233
+ sourceFileUrl: string;
234
+ webLink: string;
235
+ nickname: string;
236
+ sourceType: ISourceType;
237
+ textId: string;
238
+ versionInfo: IversionInfo;
239
+ origin: string;
240
+ knowledgeTitleName: string;
241
+ }
242
+ export interface ISearchReference {
243
+ link: string;
244
+ title: string;
245
+ snippet: string;
246
+ }
247
+ export interface KnowledgeFileMetadataParams {
248
+ name: string;
249
+ url: string;
250
+ size: number;
251
+ type: number;
252
+ }
253
+ export declare enum AecKnowledgeFileStatus {
254
+ Processing = 1,
255
+ Success = 2,
256
+ Failed = 3
257
+ }
258
+ export interface KnowledgeFileMetadata {
259
+ id: string;
260
+ baseId: number;
261
+ size: number;
262
+ name: string;
263
+ status: AecKnowledgeFileStatus;
264
+ url: string;
265
+ ext: string;
266
+ description: string;
267
+ enabled: number;
268
+ }
269
+ export interface IMessageParams {
270
+ content: string;
271
+ stream: boolean;
272
+ promptVariables: {
273
+ [key: string]: string;
274
+ };
275
+ }
276
+ export interface IAecFileDataParam {
277
+ key: string;
278
+ value: string;
279
+ }
280
+ export interface HistoryPrams {
281
+ endTime: string;
282
+ pageSize: number;
283
+ messageId: string[];
284
+ }
285
+ export interface IQuestion {
286
+ id: string;
287
+ question: string;
288
+ sort: number;
289
+ icon?: string;
290
+ name: string;
291
+ file: {
292
+ url: string;
293
+ name: string;
294
+ size: number;
295
+ };
296
+ }
297
+ export interface ResourceTokenParams {
298
+ product: string;
299
+ groupId: string;
300
+ }
301
+ export interface ResourceToken {
302
+ token: string;
303
+ expiredAt: number;
304
+ }
305
+ export interface IPermission {
306
+ name: string;
307
+ uiKey: string;
308
+ }
309
+ export interface IKnowledgeFileParams {
310
+ name?: string;
311
+ description?: string;
312
+ enabled?: number;
313
+ nickname?: string;
314
+ webLink?: string;
315
+ knowledgeSourceName?: string;
316
+ sourceFlleName?: string;
317
+ sourceType?: number;
318
+ }
319
+ export interface IFileParams {
320
+ id: string;
321
+ status: number;
322
+ }
323
+ export interface IAecPromptParam {
324
+ title?: string;
325
+ context?: string;
326
+ type?: IPromptType;
327
+ }
328
+ export type IPromptStatus = 'generating' | 'finish';
329
+ export type IPromptType = 'system' | 'me';
330
+ export interface IAecPrompt {
331
+ title: string;
332
+ context: string;
333
+ id: string;
334
+ tenantCode: string;
335
+ applicationid: string;
336
+ creator: string;
337
+ createdAt: string;
338
+ updatedAt: string;
339
+ status: IPromptStatus;
340
+ type: IPromptType;
341
+ }
342
+ export declare enum IFileOrigin {
343
+ AECPILOT = "aecpilot"
344
+ }
345
+ export interface IBaseModelInfo {
346
+ id: string;
347
+ name: string;
348
+ baseModelName: string;
349
+ maxModelLength: number;
350
+ }