@glodon-aiot/apis 3.3.2 → 3.3.4-beta.1

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.
@@ -40,224 +40,6 @@ 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;
42
42
  }
43
- // async postChatV2EventSource1(
44
- // applicationId: string,
45
- // sessionId: string,
46
- // params: any,
47
- // signal: AbortSignal,
48
- // options: { onopen?: any; onmessage?: any; onerror?: any; onclose?: any }
49
- // ) {
50
- // const tempMessage: any = {
51
- // code: 0,
52
- // messageId: uuidv4(),
53
- // content: '',
54
- // role: IHistoryRole.Robot,
55
- // sessionId: '',
56
- // reference: [],
57
- // searchReference: [],
58
- // messageTime: '',
59
- // llmModel: '',
60
- // comment: {
61
- // isAgree: 0,
62
- // },
63
- // isReplying: false,
64
- // };
65
- // const token = await this.getToken();
66
- // const body = { ...params, stream: true };
67
- // fetchEventSource(
68
- // `https://aiot-dev.glodon.com/api/cvforcepd/chat/v2/chat?applicationId=${applicationId}&sessionId=${sessionId}`,
69
- // {
70
- // method: 'POST',
71
- // headers: {
72
- // Authorization: `Bearer ${token}`,
73
- // 'Content-Type': 'application/json',
74
- // },
75
- // body: JSON.stringify(body),
76
- // openWhenHidden: true,
77
- // signal: signal,
78
- // onopen(response) {
79
- // console.log('onopen');
80
- // if (response.ok) {
81
- // options?.onopen && options.onopen();
82
- // }
83
- // return Promise.resolve();
84
- // },
85
- // onmessage(event) {
86
- // if (!event.data.includes('{"code": ')) {
87
- // let eventData: any = {};
88
- // try {
89
- // eventData = JSON.parse(event.data);
90
- // } catch (error) {}
91
- // if (eventData?.mtype === 'search') {
92
- // tempMessage.searchReference.push(eventData);
93
- // } else {
94
- // tempMessage.content = tempMessage.content + event.data;
95
- // }
96
- // const responseMsg: any = {
97
- // content: tempMessage.content,
98
- // role: 1,
99
- // reference: tempMessage.reference,
100
- // searchReference: tempMessage.searchReference,
101
- // messageId: tempMessage.messageId,
102
- // sessionId: sessionId,
103
- // messageTime: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'),
104
- // comment: {
105
- // isAgree: 0,
106
- // },
107
- // isReplying: true,
108
- // };
109
- // return options?.onmessage && options.onmessage(responseMsg);
110
- // }
111
- // const structure = JSON.parse(event.data);
112
- // tempMessage.reference = structure.data.reference;
113
- // tempMessage.searchReference = structure.data.searchReference;
114
- // tempMessage.messageTime = structure.data.messageTime;
115
- // tempMessage.messageId = structure.data.messageId;
116
- // tempMessage.llmModel = structure.data.llmModel;
117
- // tempMessage.content = structure.data.content;
118
- // tempMessage.code = structure.code;
119
- // if (structure.code === 200) {
120
- // const responseMsg: any = {
121
- // code: tempMessage.code,
122
- // content: tempMessage.content,
123
- // role: 1,
124
- // reference: tempMessage.reference,
125
- // searchReference: tempMessage.searchReference,
126
- // messageId: tempMessage.messageId,
127
- // sessionId: sessionId,
128
- // messageTime: tempMessage.messageTime,
129
- // isReplying: true,
130
- // };
131
- // options?.onmessage && options.onmessage(responseMsg);
132
- // } else {
133
- // return notification.error({
134
- // message: structure.message,
135
- // });
136
- // }
137
- // },
138
- // onerror() {
139
- // options?.onerror && options.onerror();
140
- // },
141
- // onclose() {
142
- // const responseMsg: any = {
143
- // code: tempMessage.code,
144
- // content: tempMessage.content,
145
- // role: 1,
146
- // reference: tempMessage.reference,
147
- // searchReference: tempMessage.searchReference,
148
- // messageId: tempMessage.messageId,
149
- // sessionId: sessionId,
150
- // messageTime: tempMessage.messageTime,
151
- // comment: {
152
- // isAgree: 0,
153
- // },
154
- // isReplying: false,
155
- // };
156
- // options?.onclose && options.onclose(responseMsg);
157
- // },
158
- // }
159
- // );
160
- // }
161
- // async getKnowledgeIdFileIdData(id: string, fid: string, did: string) {
162
- // return this.get<IFileDataParam[]>(
163
- // `/knowledge/${id}/file/${fid}/data/${did}`
164
- // );
165
- // }
166
- // async getKnowledgeIdFileId(id: string, fid: string) {
167
- // return this.get<IFile>(`/knowledge/${id}/file/${fid}`);
168
- // }
169
- // async getKnowledgeId(id: string) {
170
- // return this.get<IKnowledge>(`/knowledge/${id}`);
171
- // }
172
- // async getSessionKnowledgeFile(sessionId: string, fileId: string) {
173
- // return this.get<KnowledgeFileMetadata>(
174
- // `chatSession/${sessionId}/file/${fileId}`
175
- // );
176
- // }
177
- // async sleep(ms: number) {
178
- // return new Promise((reslove) => {
179
- // setTimeout(() => {
180
- // reslove('');
181
- // }, ms);
182
- // });
183
- // }
184
- // async uploadFiles(path: string, files: File[]) {
185
- // const parmas = {
186
- // files: files.map((i) => i.name),
187
- // isv: 'minio',
188
- // knowledgeId: path,
189
- // };
190
- // return this.postUploadTicket(parmas)
191
- // .then((data) =>
192
- // Promise.all(files.map((file) => this.uploadMinioFile(data.minio, file)))
193
- // )
194
- // .catch((e) => {
195
- // throw Error(e);
196
- // });
197
- // }
198
- // async postFile(path: string, file: File, type?: number) {
199
- // const parmas = {
200
- // files: [file.name],
201
- // isv: 'minio',
202
- // knowledgeId: path,
203
- // type: type,
204
- // };
205
- // return this.postTicket(parmas)
206
- // .then((data) => this.uploadMinioFile(data.minio, file))
207
- // .catch((e) => {
208
- // throw Error(e);
209
- // });
210
- // }
211
- // async postTicket(params: IUploadParam) {
212
- // return this.post<IUploadTicket>(`/ticket`, params);
213
- // }
214
- // async uploadFile(path: string, file: File) {
215
- // const parmas = {
216
- // files: [file.name],
217
- // isv: 'minio',
218
- // knowledgeId: path,
219
- // };
220
- // return this.postUploadTicket(parmas)
221
- // .then((data) => this.uploadMinioFile(data.minio, file))
222
- // .catch((e) => {
223
- // throw Error(e);
224
- // });
225
- // }
226
- // async postUploadTicket(params: IUploadParam) {
227
- // return this.post<IUploadTicket>(`/upload/ticket`, params);
228
- // }
229
- // async uploadMinioFile(minioConfig: MinioConfig, file: File) {
230
- // return new Promise<string>((resolve, reject) => {
231
- // const fr = new FileReader();
232
- // fr.readAsArrayBuffer(file);
233
- // fr.onload = (e: any) => {
234
- // initMinio({
235
- // endPoint: minioConfig.endpoints[0],
236
- // useSSL: minioConfig.useSSL,
237
- // accessKey: minioConfig.accessKey,
238
- // secretKey: minioConfig.secretKey,
239
- // });
240
- // const buffer = Buffer.from(e.target.result);
241
- // const metaData = {
242
- // 'Content-Type': 'application/octet-stream',
243
- // };
244
- // putObjectBuffer(
245
- // minioConfig.bucket,
246
- // minioConfig.fileKeys[0],
247
- // buffer,
248
- // metaData,
249
- // (err) => {
250
- // if (err) {
251
- // console.error(err);
252
- // throw Error(err);
253
- // } else {
254
- // resolve(minioConfig.fileKeys[0]);
255
- // }
256
- // }
257
- // );
258
- // };
259
- // });
260
- // }
261
43
  // 接口
262
44
  getBaseModelInfo(e) {
263
45
  return s(this, null, function* () {
@@ -15,9 +15,10 @@ var s = (l, e, t) => new Promise((n, i) => {
15
15
  p((t = t.apply(l, e)).next());
16
16
  });
17
17
  import d from "axios";
18
- import { BaseApi as g } from "../base/index.mjs";
19
- import { initMinio as h, putObjectBuffer as u } from "@glodon-aiot/minio";
20
- class m extends g {
18
+ import { Buffer as g } from "buffer";
19
+ import { BaseApi as h } from "../base/index.mjs";
20
+ import { initMinio as u, putObjectBuffer as y } from "@glodon-aiot/minio";
21
+ class k extends h {
21
22
  constructor(e, t) {
22
23
  super(e != null ? e : d.create(), t);
23
24
  }
@@ -206,16 +207,16 @@ class m extends g {
206
207
  return new Promise((n, i) => {
207
208
  const r = new FileReader();
208
209
  r.readAsArrayBuffer(t), r.onload = (c) => {
209
- h({
210
+ u({
210
211
  endPoint: e.endpoints[0],
211
212
  useSSL: e.useSSL,
212
213
  accessKey: e.accessKey,
213
214
  secretKey: e.secretKey
214
215
  });
215
- const p = Buffer.from(c.target.result), o = {
216
+ const p = g.from(c.target.result), o = {
216
217
  "Content-Type": "application/octet-stream"
217
218
  };
218
- u(e.bucket, e.fileKeys[0], p, o, (a) => {
219
+ y(e.bucket, e.fileKeys[0], p, o, (a) => {
219
220
  if (a)
220
221
  throw console.error(a), Error(a);
221
222
  n(e.fileKeys[0]);
@@ -435,5 +436,5 @@ class m extends g {
435
436
  }
436
437
  }
437
438
  export {
438
- m as CVForceApi
439
+ k as CVForceApi
439
440
  };
@@ -1,12 +1,13 @@
1
- var v = /* @__PURE__ */ ((r) => (r[r.Dialog = 0] = "Dialog", r[r.TextGenerate = 1] = "TextGenerate", r[r.FileSummery = 2] = "FileSummery", r))(v || {}), n = /* @__PURE__ */ ((r) => (r[r.Robot = 1] = "Robot", r[r.User = 2] = "User", r[r.System = 3] = "System", r))(n || {}), D = /* @__PURE__ */ ((r) => (r[r.Processing = 1] = "Processing", r[r.Done = 2] = "Done", r[r.Failed = 3] = "Failed", r))(D || {}), m = /* @__PURE__ */ ((r) => (r[r.File = 0] = "File", r[r.WebLink = 1] = "WebLink", r))(m || {}), x = /* @__PURE__ */ ((r) => (r[r.Processing = 1] = "Processing", r[r.Success = 2] = "Success", r[r.Failed = 3] = "Failed", r))(x || {}), b = /* @__PURE__ */ ((r) => (r.InputFile = "ui.input.file", r.LLMModel = "ui.llm.model", r))(b || {}), L = /* @__PURE__ */ ((r) => (r[r.Idle = 0] = "Idle", r[r.Quoted = 1] = "Quoted", r))(L || {}), u = /* @__PURE__ */ ((r) => (r[r.Basic = 0] = "Basic", r[r.Pro = 1] = "Pro", r))(u || {}), k = /* @__PURE__ */ ((r) => (r[r.Dialog = 0] = "Dialog", r[r.Text = 1] = "Text", r[r.Agent = 2] = "Agent", r[r.All = 3] = "All", r))(k || {});
1
+ var n = /* @__PURE__ */ ((r) => (r[r.Dialog = 0] = "Dialog", r[r.TextGenerate = 1] = "TextGenerate", r[r.FileSummery = 2] = "FileSummery", r))(n || {}), v = /* @__PURE__ */ ((r) => (r[r.Robot = 1] = "Robot", r[r.User = 2] = "User", r[r.System = 3] = "System", r))(v || {}), D = /* @__PURE__ */ ((r) => (r[r.Processing = 1] = "Processing", r[r.Done = 2] = "Done", r[r.Failed = 3] = "Failed", r))(D || {}), m = /* @__PURE__ */ ((r) => (r[r.File = 0] = "File", r[r.WebLink = 1] = "WebLink", r))(m || {}), u = /* @__PURE__ */ ((r) => (r[r.Processing = 1] = "Processing", r[r.Success = 2] = "Success", r[r.Failed = 3] = "Failed", r))(u || {}), x = /* @__PURE__ */ ((r) => (r.InputFile = "ui.input.file", r.LLMModel = "ui.llm.model", r))(x || {}), L = /* @__PURE__ */ ((r) => (r[r.Idle = 0] = "Idle", r[r.Quoted = 1] = "Quoted", r))(L || {}), b = /* @__PURE__ */ ((r) => (r[r.Basic = 0] = "Basic", r[r.Pro = 1] = "Pro", r))(b || {}), i = /* @__PURE__ */ ((r) => (r[r.Dialog = 0] = "Dialog", r[r.Text = 1] = "Text", r[r.Agent = 2] = "Agent", r[r.All = 3] = "All", r))(i || {}), k = /* @__PURE__ */ ((r) => (r.User = "instruction", r.System = "settings", r))(k || {});
2
2
  export {
3
- k as ApplicationTypes,
4
- b as ArchiGptUIKeys,
5
- n as ChatMessageRole,
6
- v as ChatMode,
3
+ i as ApplicationTypes,
4
+ x as ArchiGptUIKeys,
5
+ v as ChatMessageRole,
6
+ n as ChatMode,
7
7
  D as FileProccessStatus,
8
- x as KnowledgeFileStatus,
9
- u as KnowledgeType,
8
+ u as KnowledgeFileStatus,
9
+ b as KnowledgeType,
10
10
  L as PromptStatus,
11
+ k as PromptVariableType,
11
12
  m as SourceType
12
13
  };
package/dist/es/index.mjs CHANGED
@@ -1,62 +1,63 @@
1
1
  import { AuthApi as t } from "./auth/index.mjs";
2
2
  import { BaseApi as p, needPrettifyMsg as i, prettifyMsg as a } from "./base/index.mjs";
3
- import { DataApi as A } from "./user/index.mjs";
4
- import { PanoramaApi as m } from "./panorama/index.mjs";
3
+ import { DataApi as m } from "./user/index.mjs";
4
+ import { PanoramaApi as f } from "./panorama/index.mjs";
5
5
  import { PanoramaPluginMgrApi as x } from "./pluginmgr/index.mjs";
6
6
  import { AECPilotApi as n } from "./aecpilot/index.mjs";
7
7
  import { BotClientApi as c } from "./bot-client/index.mjs";
8
8
  import { AecpilotUIApi as P } from "./aecpilotui/index.mjs";
9
9
  import { CVForceApi as g } from "./cvforce/index.mjs";
10
- import { CVForceDatahubApi as M } from "./cvforce-datahub/index.mjs";
11
- import { ModelServiceApi as y } from "./cvforce-modelservice/index.mjs";
10
+ import { CVForceDatahubApi as C } from "./cvforce-datahub/index.mjs";
11
+ import { ModelServiceApi as d } from "./cvforce-modelservice/index.mjs";
12
12
  import { AIShopApi as R } from "./aishop/index.mjs";
13
13
  import { ContralyzeApi as _ } from "./contralyze/index.mjs";
14
- import { ISpacetwinStatus as L, RecordStatus as v } from "./panorama/model.mjs";
15
- import { AecKnowledgeFileStatus as G, IFileOrigin as H, IHistoryRole as K, ISourceType as O, IThinkingStatus as b, IversionInfo as D } from "./aecpilot/model.mjs";
16
- import { PROMPT_SEARCH_MAX_LENGTH as k, PROMPT_TITLE_MAX_LENGTH as B } from "./aecpilot/cosntant.mjs";
17
- import { ApplicationTypes as V, ArchiGptUIKeys as X, ChatMessageRole as z, ChatMode as Z, FileProccessStatus as j, KnowledgeFileStatus as q, KnowledgeType as J, PromptStatus as Q, SourceType as W } from "./cvforce/model.mjs";
18
- import { GenerateStatus as $, IDatasetLevel as ee, PreLabelTaskStatus as oe, SubsectionStatus as te, UploadZipsStatus as re } from "./cvforce-datahub/model.mjs";
19
- import { IChatRole as ie, OCRServiceId as ae } from "./aishop/model.mjs";
14
+ import { ISpacetwinStatus as L, RecordStatus as b } from "./panorama/model.mjs";
15
+ import { AecKnowledgeFileStatus as w, IFileOrigin as G, IHistoryRole as H, ISourceType as K, IThinkingStatus as O, IversionInfo as D } from "./aecpilot/model.mjs";
16
+ import { PROMPT_SEARCH_MAX_LENGTH as V, PROMPT_TITLE_MAX_LENGTH as k } from "./aecpilot/cosntant.mjs";
17
+ import { ApplicationTypes as N, ArchiGptUIKeys as X, ChatMessageRole as z, ChatMode as Z, FileProccessStatus as j, KnowledgeFileStatus as q, KnowledgeType as J, PromptStatus as Q, PromptVariableType as W, SourceType as Y } from "./cvforce/model.mjs";
18
+ import { GenerateStatus as ee, IDatasetLevel as oe, PreLabelTaskStatus as te, SubsectionStatus as re, UploadZipsStatus as pe } from "./cvforce-datahub/model.mjs";
19
+ import { IChatRole as ae, OCRServiceId as se } from "./aishop/model.mjs";
20
20
  export {
21
21
  n as AECPilotApi,
22
22
  R as AIShopApi,
23
- G as AecKnowledgeFileStatus,
23
+ w as AecKnowledgeFileStatus,
24
24
  P as AecpilotUIApi,
25
- V as ApplicationTypes,
25
+ N as ApplicationTypes,
26
26
  X as ArchiGptUIKeys,
27
27
  t as AuthApi,
28
28
  p as BaseApi,
29
29
  c as BotClientApi,
30
30
  g as CVForceApi,
31
- M as CVForceDatahubApi,
31
+ C as CVForceDatahubApi,
32
32
  z as ChatMessageRole,
33
33
  Z as ChatMode,
34
34
  _ as ContralyzeApi,
35
- A as DataApi,
35
+ m as DataApi,
36
36
  j as FileProccessStatus,
37
- $ as GenerateStatus,
38
- ie as IChatRole,
39
- ee as IDatasetLevel,
40
- H as IFileOrigin,
41
- K as IHistoryRole,
42
- O as ISourceType,
37
+ ee as GenerateStatus,
38
+ ae as IChatRole,
39
+ oe as IDatasetLevel,
40
+ G as IFileOrigin,
41
+ H as IHistoryRole,
42
+ K as ISourceType,
43
43
  L as ISpacetwinStatus,
44
- b as IThinkingStatus,
44
+ O as IThinkingStatus,
45
45
  D as IversionInfo,
46
46
  q as KnowledgeFileStatus,
47
47
  J as KnowledgeType,
48
- y as ModelServiceApi,
49
- ae as OCRServiceId,
50
- k as PROMPT_SEARCH_MAX_LENGTH,
51
- B as PROMPT_TITLE_MAX_LENGTH,
52
- m as PanoramaApi,
48
+ d as ModelServiceApi,
49
+ se as OCRServiceId,
50
+ V as PROMPT_SEARCH_MAX_LENGTH,
51
+ k as PROMPT_TITLE_MAX_LENGTH,
52
+ f as PanoramaApi,
53
53
  x as PanoramaPluginMgrApi,
54
- oe as PreLabelTaskStatus,
54
+ te as PreLabelTaskStatus,
55
55
  Q as PromptStatus,
56
- v as RecordStatus,
57
- W as SourceType,
58
- te as SubsectionStatus,
59
- re as UploadZipsStatus,
56
+ W as PromptVariableType,
57
+ b as RecordStatus,
58
+ Y as SourceType,
59
+ re as SubsectionStatus,
60
+ pe as UploadZipsStatus,
60
61
  i as needPrettifyMsg,
61
62
  a as prettifyMsg
62
63
  };
package/dist/lib/index.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var fe=Object.defineProperty,ve=Object.defineProperties;var Se=Object.getOwnPropertyDescriptors;var M=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,y=(n,e)=>{for(var t in e||(e={}))N.call(e,t)&&B(n,t,e[t]);if(M)for(var t of M(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&&M)for(var r of M(n))e.indexOf(r)<0&&H.call(n,r)&&(t[r]=n[r]);return t};var s=(n,e,t)=>new Promise((r,a)=>{var i=h=>{try{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"),k=require("@glodon-aiot/minio"),F=require("uuid"),U=require("dayjs"),Q=require("buffer");class m{constructor(e,t){this.axios=e,this.errorHandler=t}get(e,t,r){return s(this,null,function*(){const a=this.axios.get(e,{params:t});return this.handleResponse(a,r)})}listPaged(e,t){return s(this,null,function*(){const r=this.axios.get(e,{params:t});return this.handleResponse(r)})}list(e,t){return s(this,null,function*(){const r=this.axios.get(e,{params:t});return this.handleResponse(r)})}delete(e,t){return s(this,null,function*(){const r=this.axios.delete(e,{params:t});return this.handleResponse(r)})}post(e,t,r,a){return s(this,null,function*(){const i=this.axios.post(e,t,y({params:r},a));return this.handleResponse(i)})}postForm(e,t,r){return s(this,null,function*(){const a=this.axios.post(e,t,{params:r,headers:{"Content-Type":"multipart/form-data"}});return this.handleResponse(a)})}patch(e,t,r){return s(this,null,function*(){const a=this.axios.patch(e,t,{params:r});return this.handleResponse(a)})}put(e,t){return s(this,null,function*(){const r=this.axios.put(e,t);return this.handleResponse(r)})}upload(e,t,r){return s(this,null,function*(){const a=this.axios.post(e,t,y({},r));return this.handleResponse(a)})}getNonStandard(e,t){return s(this,null,function*(){const r=this.axios.get(e,t);try{const a=yield r;if(a.status===200)return a}catch(a){throw this.handleError(a)}})}postNonStandard(e,t,r,a){return s(this,null,function*(){var l,h;const o=yield this.axios.post(e,t,y({params:r},a));if(o.status===200)if((l=o.data)!=null&&l.code)(h=this.errorHandler)!=null&&h.onAppStatusError&&this.errorHandler.onAppStatusError(o.data.code,o.data.message);else return o.data})}handleResponse(e,t){return s(this,null,function*(){try{const r=yield e;return this.handleAppError(r.data,t).data}catch(r){throw this.handleError(r)}})}handleAppError(e,t){var r;if(e.code<200||e.code>=300)throw(r=this.errorHandler)!=null&&r.onAppStatusError?this.errorHandler.onAppStatusError(e.code,J(e.code,e.message),t):console.error("未处理应用错误:",e),{isAxiosError:!1,message:e.message};return e}handleError(e){var t,r;return e.response?(t=this.errorHandler)!=null&&t.onHttpStatusError&&(console.log("HTTP 错误",this.errorHandler),this.errorHandler.onHttpStatusError(e.response.status,"",e.response)):e.request?(console.log(e.request),(r=this.errorHandler)!=null&&r.onNetworkError&&this.errorHandler.onNetworkError()):console.error("axios request config error:",e),new Error(e.message)}}const q=n=>n>=10002&&n<=10012,J=(n,e)=>q(n)?"数据操作错误":e||"未知接口错误";class we extends m{constructor(e,t){super(e!=null?e:f.create(),t)}getLoginUrl(){return s(this,null,function*(){return this.get("/openAddress")})}getToken(e,t){return s(this,null,function*(){return this.get(e,t)})}getAIoTTokenByGTeamToken(e){return s(this,null,function*(){return this.post("/validate/glodonCloud",e).then(t=>t.accessToken)})}postRefreshToken(e,t,r,a="3600",i){return s(this,null,function*(){return this.post("/refresh-token",{oldToken:e,tenant:t,orgId:r,expired:a,product:i})})}logout(){return s(this,null,function*(){return this.post("/logout",{})})}}class Ie extends m{constructor(e,t){super(e!=null?e:f.create(),t)}getTenant(e){return s(this,null,function*(){return this.get(`/tenant/${e}`)})}listProduct(){return s(this,null,function*(){return this.list("/products")})}listProvinces(){return s(this,null,function*(){return this.list("/regions/provinces")})}listCities(e){return s(this,null,function*(){return this.list(`/regions/provinces/${e}/city`)})}listCounties(e,t){return s(this,null,function*(){return this.list(`/regions/provinces/${e}/city/${t}/county`)})}getOrgList(e){return s(this,null,function*(){return this.list("/org",e)})}getUserIdOrgList(e,t){return s(this,null,function*(){return this.list(`/users/${e}/org`,t)})}delOrg(e){return s(this,null,function*(){return this.delete(`/org/${e}`)})}postOrg(e){return s(this,null,function*(){return this.post("/org",e)})}patchOrg(e,t){return s(this,null,function*(){return this.patch(`/org/${e}`,t)})}getUsers(e,t){return s(this,null,function*(){return this.list(`/tenant/${e}/users`,t)})}delUser(e,t){return s(this,null,function*(){return this.delete(`/tenant/${e}/users/${t}`)})}postUser(e,t){return s(this,null,function*(){return this.post(`/tenant/${e}/users`,t)})}patchUser(e,t,r){return s(this,null,function*(){return this.patch(`tenant/${e}/users/${t}`,r)})}getTenantList(){return s(this,null,function*(){return this.get("/tenant")})}getUserIdRoles(e){return s(this,null,function*(){return this.get(`/users/${e}/role`)})}getProductCodeRole(e){return s(this,null,function*(){return this.get(`/products/${e}/role`)})}postUserRole(e,t){return s(this,null,function*(){return this.post(`/users/${e}/role`,t)})}patchUserRole(e,t,r){return s(this,null,function*(){return this.patch(`/users/${e}/role/${t}`,r)})}deleteUserRole(e,t){return s(this,null,function*(){return this.delete(`/users/${e}/role/${t}`)})}getUsersIdProductCodeMenu(e,t,r="web",a){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/menu?groupCode=${r}`,{level:a})})}getUserInfo(e){return s(this,null,function*(){return this.get(`/users/${e}`)})}uipermission(e,t,r="web"){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/uipermission?groupCode=${r}`)})}getAppInfo(e){return s(this,null,function*(){return this.get(`/products/${e}/apps`)})}getTenantUserInfo(e,t){return s(this,null,function*(){return this.get(`/tenant/${e}/users/${t}`)})}uploadFile(e){return s(this,null,function*(){return this.upload("/upload",e)})}getUserIdProductCodeOrg(e,t){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/org`)})}getOrg(e){return s(this,null,function*(){return this.get(`/org/${e}`)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}putAppInfo(e,t){return s(this,null,function*(){return this.put(`/products/${e}/apps`,t)})}getTenantKeySecret(e){return s(this,null,function*(){return this.get(`/tenant/${e}/key`)})}resetTenantKeySecret(e){return s(this,null,function*(){return this.post(`/tenant/${e}/resetSecret`,void 0)})}getProductsCode(e){return s(this,null,function*(){return this.get(`/products/${e}`)})}}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 m{constructor(e,t){super(e!=null?e:f.create(),t)}static parseApiToken(e){const t=window.atob(e.split(".")[1]);return JSON.parse(t)}static loadApiToken(e,t,r){return s(this,null,function*(){return fetch(`${e}${t}/viewtoken/${r}/create_apitoken`,{method:"POST"}).then(a=>{if(a.status!==200)throw console.error(a),Error(JSON.stringify(a));return a.json()}).then(a=>{if(a.code!==200)throw Error(JSON.stringify(a));return a.data.apiToken})})}listRecord(e){return s(this,null,function*(){return this.listPaged("/spacetwins",e)})}postRecord(e){return s(this,null,function*(){return this.post("/spacetwins",e)})}getRecordOverview(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}`)})}getRecordViewtoken(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}/viewtoken`)})}listScene(e){return s(this,null,function*(){return this.list(`/spacetwins/${e}/scenes`)})}getScenesByTimestamp(e,t){return s(this,null,function*(){return this.list(`/spacetwins/${e}/scenes_timestamp`,{timestamp:t})})}recomputeTrack(e,t){return s(this,null,function*(){return this.patch(`/spacetwins/${e}/track`,{points:t})})}updateRecordUploadStatus(e,t){return s(this,null,function*(){return this.post(`/spacetwins/${e}/update_upload_status`,t)})}getApiToken(e){return s(this,null,function*(){return this.post(`/viewtoken/${e}/create_apitoken`,{})})}getSpacetwins(e){return s(this,null,function*(){return this.listPaged("/spacetwins",e)})}postSpacetwins(e){return s(this,null,function*(){return this.post("/spacetwins",e)})}updateInspection(e,t){return s(this,null,function*(){return this.patch(`/patrolInspection/${e}`,t)})}getSpacetwinsIdViewtoken(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}/viewtoken`)})}postSpacetwinsIdUpdateUploadStatus(e,t){return s(this,null,function*(){return this.post(`/spacetwins/${e}/update_upload_status`,t)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/upload/ticket",e)})}getDownloadUrl(e){return s(this,null,function*(){return this.get(`/download/url?isv=${e.isv}&key=${e.key}`)})}listTrack(e,t){return s(this,null,function*(){return this.list(`/spacetwins/${e}/track`,{type:t})})}}class Ae extends m{constructor(e,t){super(e!=null?e:f.create(),t)}listPlugin(e){return s(this,null,function*(){return this.list("/plugins",e)})}postPlugin(e){return s(this,null,function*(){return this.post("/plugins",e)})}getPlugin(e){return s(this,null,function*(){return this.get(`/plugins/${e}`)})}updatePlugin(e,t){return s(this,null,function*(){return this.patch(`/plugins/${e}`,t)})}listPluginData(e,t){return s(this,null,function*(){return this.list(`/plugins/${e}/datas`,t)})}postPluginData(e,t){return s(this,null,function*(){return this.post(`/plugins/${e}/datas`,t)})}getPluginData(e,t){return s(this,null,function*(){return this.get(`/plugins/${e}/datas/${t}`).then(r=>S(y({},r),{arguments:JSON.parse(r.arguments)}))})}updatePluginData(e,t,r){return s(this,null,function*(){return this.patch(`/plugins/${e}/datas/${t}`,r)})}deletePluginData(e,t){return s(this,null,function*(){return this.delete(`/plugins/${e}/datas/${t}`)})}}var z=(n=>(n[n.None=0]="None",n[n.SourceFile=1]="SourceFile",n[n.WebLink=2]="WebLink",n))(z||{}),G=(n=>(n.Unprotected="不受著作权保护",n.ProtectAuthorize="受著作权保护,已获得授权",n.ProtectUnauthorize="受著作权保护,未获得授权",n))(G||{}),T=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(T||{}),X=(n=>(n.Start="start",n.End="end",n))(X||{}),A=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(A||{}),Z=(n=>(n.AECPILOT="aecpilot",n))(Z||{});function be(n,e){return s(this,null,function*(){const t=n.getReader();let r;for(;!(r=yield t.read()).done;)e(r.value)})}function 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+=`
1
+ "use strict";var ve=Object.defineProperty,Se=Object.defineProperties;var we=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var N=(n,e,t)=>e in n?ve(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,y=(n,e)=>{for(var t in e||(e={}))H.call(e,t)&&N(n,t,e[t]);if(M)for(var t of M(e))O.call(e,t)&&N(n,t,e[t]);return n},S=(n,e)=>Se(n,we(e));var W=(n,e)=>{var t={};for(var r in n)H.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&M)for(var r of M(n))e.indexOf(r)<0&&O.call(n,r)&&(t[r]=n[r]);return t};var s=(n,e,t)=>new Promise((r,a)=>{var i=h=>{try{l(t.next(h))}catch(d){a(d)}},o=h=>{try{l(t.throw(h))}catch(d){a(d)}},l=h=>h.done?r(h.value):Promise.resolve(h.value).then(i,o);l((t=t.apply(n,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("axios"),k=require("@glodon-aiot/minio"),F=require("uuid"),U=require("dayjs"),L=require("buffer");class m{constructor(e,t){this.axios=e,this.errorHandler=t}get(e,t,r){return s(this,null,function*(){const a=this.axios.get(e,{params:t});return this.handleResponse(a,r)})}listPaged(e,t){return s(this,null,function*(){const r=this.axios.get(e,{params:t});return this.handleResponse(r)})}list(e,t){return s(this,null,function*(){const r=this.axios.get(e,{params:t});return this.handleResponse(r)})}delete(e,t){return s(this,null,function*(){const r=this.axios.delete(e,{params:t});return this.handleResponse(r)})}post(e,t,r,a){return s(this,null,function*(){const i=this.axios.post(e,t,y({params:r},a));return this.handleResponse(i)})}postForm(e,t,r){return s(this,null,function*(){const a=this.axios.post(e,t,{params:r,headers:{"Content-Type":"multipart/form-data"}});return this.handleResponse(a)})}patch(e,t,r){return s(this,null,function*(){const a=this.axios.patch(e,t,{params:r});return this.handleResponse(a)})}put(e,t){return s(this,null,function*(){const r=this.axios.put(e,t);return this.handleResponse(r)})}upload(e,t,r){return s(this,null,function*(){const a=this.axios.post(e,t,y({},r));return this.handleResponse(a)})}getNonStandard(e,t){return s(this,null,function*(){const r=this.axios.get(e,t);try{const a=yield r;if(a.status===200)return a}catch(a){throw this.handleError(a)}})}postNonStandard(e,t,r,a){return s(this,null,function*(){var l,h;const o=yield this.axios.post(e,t,y({params:r},a));if(o.status===200)if((l=o.data)!=null&&l.code)(h=this.errorHandler)!=null&&h.onAppStatusError&&this.errorHandler.onAppStatusError(o.data.code,o.data.message);else return o.data})}handleResponse(e,t){return s(this,null,function*(){try{const r=yield e;return this.handleAppError(r.data,t).data}catch(r){throw this.handleError(r)}})}handleAppError(e,t){var r;if(e.code<200||e.code>=300)throw(r=this.errorHandler)!=null&&r.onAppStatusError?this.errorHandler.onAppStatusError(e.code,J(e.code,e.message),t):console.error("未处理应用错误:",e),{isAxiosError:!1,message:e.message};return e}handleError(e){var t,r;return e.response?(t=this.errorHandler)!=null&&t.onHttpStatusError&&(console.log("HTTP 错误",this.errorHandler),this.errorHandler.onHttpStatusError(e.response.status,"",e.response)):e.request?(console.log(e.request),(r=this.errorHandler)!=null&&r.onNetworkError&&this.errorHandler.onNetworkError()):console.error("axios request config error:",e),new Error(e.message)}}const q=n=>n>=10002&&n<=10012,J=(n,e)=>q(n)?"数据操作错误":e||"未知接口错误";class Ie extends m{constructor(e,t){super(e!=null?e:f.create(),t)}getLoginUrl(){return s(this,null,function*(){return this.get("/openAddress")})}getToken(e,t){return s(this,null,function*(){return this.get(e,t)})}getAIoTTokenByGTeamToken(e){return s(this,null,function*(){return this.post("/validate/glodonCloud",e).then(t=>t.accessToken)})}postRefreshToken(e,t,r,a="3600",i){return s(this,null,function*(){return this.post("/refresh-token",{oldToken:e,tenant:t,orgId:r,expired:a,product:i})})}logout(){return s(this,null,function*(){return this.post("/logout",{})})}}class ke extends m{constructor(e,t){super(e!=null?e:f.create(),t)}getTenant(e){return s(this,null,function*(){return this.get(`/tenant/${e}`)})}listProduct(){return s(this,null,function*(){return this.list("/products")})}listProvinces(){return s(this,null,function*(){return this.list("/regions/provinces")})}listCities(e){return s(this,null,function*(){return this.list(`/regions/provinces/${e}/city`)})}listCounties(e,t){return s(this,null,function*(){return this.list(`/regions/provinces/${e}/city/${t}/county`)})}getOrgList(e){return s(this,null,function*(){return this.list("/org",e)})}getUserIdOrgList(e,t){return s(this,null,function*(){return this.list(`/users/${e}/org`,t)})}delOrg(e){return s(this,null,function*(){return this.delete(`/org/${e}`)})}postOrg(e){return s(this,null,function*(){return this.post("/org",e)})}patchOrg(e,t){return s(this,null,function*(){return this.patch(`/org/${e}`,t)})}getUsers(e,t){return s(this,null,function*(){return this.list(`/tenant/${e}/users`,t)})}delUser(e,t){return s(this,null,function*(){return this.delete(`/tenant/${e}/users/${t}`)})}postUser(e,t){return s(this,null,function*(){return this.post(`/tenant/${e}/users`,t)})}patchUser(e,t,r){return s(this,null,function*(){return this.patch(`tenant/${e}/users/${t}`,r)})}getTenantList(){return s(this,null,function*(){return this.get("/tenant")})}getUserIdRoles(e){return s(this,null,function*(){return this.get(`/users/${e}/role`)})}getProductCodeRole(e){return s(this,null,function*(){return this.get(`/products/${e}/role`)})}postUserRole(e,t){return s(this,null,function*(){return this.post(`/users/${e}/role`,t)})}patchUserRole(e,t,r){return s(this,null,function*(){return this.patch(`/users/${e}/role/${t}`,r)})}deleteUserRole(e,t){return s(this,null,function*(){return this.delete(`/users/${e}/role/${t}`)})}getUsersIdProductCodeMenu(e,t,r="web",a){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/menu?groupCode=${r}`,{level:a})})}getUserInfo(e){return s(this,null,function*(){return this.get(`/users/${e}`)})}uipermission(e,t,r="web"){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/uipermission?groupCode=${r}`)})}getAppInfo(e){return s(this,null,function*(){return this.get(`/products/${e}/apps`)})}getTenantUserInfo(e,t){return s(this,null,function*(){return this.get(`/tenant/${e}/users/${t}`)})}uploadFile(e){return s(this,null,function*(){return this.upload("/upload",e)})}getUserIdProductCodeOrg(e,t){return s(this,null,function*(){return this.get(`/users/${e}/product/${t}/org`)})}getOrg(e){return s(this,null,function*(){return this.get(`/org/${e}`)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}putAppInfo(e,t){return s(this,null,function*(){return this.put(`/products/${e}/apps`,t)})}getTenantKeySecret(e){return s(this,null,function*(){return this.get(`/tenant/${e}/key`)})}resetTenantKeySecret(e){return s(this,null,function*(){return this.post(`/tenant/${e}/resetSecret`,void 0)})}getProductsCode(e){return s(this,null,function*(){return this.get(`/products/${e}`)})}}var j=(n=>(n.Collecting="采集中",n.CollectionTimeout="超时",n.CollectionFinish="完成",n.WaitUpload="等待上传",n.Uploading="上传中",n.UploadFinish="上传完成",n.UploadFailed="上传失败",n.WaitMerge="等待合成",n.CreateMergeTaskFailed="创建合成任务失败",n.Merging="合成中",n.MergeFailed="合成失败",n.MergeFinish="合成成功",n))(j||{}),Y=(n=>(n.Collecting="采集中",n.CollectionTimeout="超时",n.CollectionFinish="完成",n.WaitUpload="等待上传",n.Uploading="上传中",n.UploadFinish="上传完成",n.UploadFailed="上传失败",n.WaitMerge="等待合成",n.CreateMergeTaskFailed="创建合成任务失败",n.Merging="合成中",n.MergeFailed="合成失败",n.MergeFinish="合成成功",n))(Y||{});class Ae extends m{constructor(e,t){super(e!=null?e:f.create(),t)}static parseApiToken(e){const t=window.atob(e.split(".")[1]);return JSON.parse(t)}static loadApiToken(e,t,r){return s(this,null,function*(){return fetch(`${e}${t}/viewtoken/${r}/create_apitoken`,{method:"POST"}).then(a=>{if(a.status!==200)throw console.error(a),Error(JSON.stringify(a));return a.json()}).then(a=>{if(a.code!==200)throw Error(JSON.stringify(a));return a.data.apiToken})})}listRecord(e){return s(this,null,function*(){return this.listPaged("/spacetwins",e)})}postRecord(e){return s(this,null,function*(){return this.post("/spacetwins",e)})}getRecordOverview(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}`)})}getRecordViewtoken(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}/viewtoken`)})}listScene(e){return s(this,null,function*(){return this.list(`/spacetwins/${e}/scenes`)})}getScenesByTimestamp(e,t){return s(this,null,function*(){return this.list(`/spacetwins/${e}/scenes_timestamp`,{timestamp:t})})}recomputeTrack(e,t){return s(this,null,function*(){return this.patch(`/spacetwins/${e}/track`,{points:t})})}updateRecordUploadStatus(e,t){return s(this,null,function*(){return this.post(`/spacetwins/${e}/update_upload_status`,t)})}getApiToken(e){return s(this,null,function*(){return this.post(`/viewtoken/${e}/create_apitoken`,{})})}getSpacetwins(e){return s(this,null,function*(){return this.listPaged("/spacetwins",e)})}postSpacetwins(e){return s(this,null,function*(){return this.post("/spacetwins",e)})}updateInspection(e,t){return s(this,null,function*(){return this.patch(`/patrolInspection/${e}`,t)})}getSpacetwinsIdViewtoken(e){return s(this,null,function*(){return this.get(`/spacetwins/${e}/viewtoken`)})}postSpacetwinsIdUpdateUploadStatus(e,t){return s(this,null,function*(){return this.post(`/spacetwins/${e}/update_upload_status`,t)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/upload/ticket",e)})}getDownloadUrl(e){return s(this,null,function*(){return this.get(`/download/url?isv=${e.isv}&key=${e.key}`)})}listTrack(e,t){return s(this,null,function*(){return this.list(`/spacetwins/${e}/track`,{type:t})})}}class be extends m{constructor(e,t){super(e!=null?e:f.create(),t)}listPlugin(e){return s(this,null,function*(){return this.list("/plugins",e)})}postPlugin(e){return s(this,null,function*(){return this.post("/plugins",e)})}getPlugin(e){return s(this,null,function*(){return this.get(`/plugins/${e}`)})}updatePlugin(e,t){return s(this,null,function*(){return this.patch(`/plugins/${e}`,t)})}listPluginData(e,t){return s(this,null,function*(){return this.list(`/plugins/${e}/datas`,t)})}postPluginData(e,t){return s(this,null,function*(){return this.post(`/plugins/${e}/datas`,t)})}getPluginData(e,t){return s(this,null,function*(){return this.get(`/plugins/${e}/datas/${t}`).then(r=>S(y({},r),{arguments:JSON.parse(r.arguments)}))})}updatePluginData(e,t,r){return s(this,null,function*(){return this.patch(`/plugins/${e}/datas/${t}`,r)})}deletePluginData(e,t){return s(this,null,function*(){return this.delete(`/plugins/${e}/datas/${t}`)})}}var z=(n=>(n[n.None=0]="None",n[n.SourceFile=1]="SourceFile",n[n.WebLink=2]="WebLink",n))(z||{}),G=(n=>(n.Unprotected="不受著作权保护",n.ProtectAuthorize="受著作权保护,已获得授权",n.ProtectUnauthorize="受著作权保护,未获得授权",n))(G||{}),T=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(T||{}),X=(n=>(n.Start="start",n.End="end",n))(X||{}),A=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(A||{}),Z=(n=>(n.AECPILOT="aecpilot",n))(Z||{});function Te(n,e){return s(this,null,function*(){const t=n.getReader();let r;for(;!(r=yield t.read()).done;)e(r.value)})}function Pe(n){let e,t,r,a=!1,i;return function(l){e===void 0?(e=l,t=0,r=-1,i=!1):e=Me(e,l);const h=e.length;let d=0;for(;t<h;){a&&(e[t]===10&&(d=++t),a=!1);let p=-1;for(;t<h&&p===-1;++t)switch(e[t]){case 58:r===-1&&(r=t-d);break;case 13:a=!1,t+4<h&&e[t+1]===10&&e[t+2]!==13&&e[t-1]!==10&&e[t-2]!==13&&(i=!0);case 10:p=t;break}if(p===-1)break;n(e.subarray(d,p),r,i),d=t,r=-1,i=!1}d===h?e=void 0:d!==0&&(e=e.subarray(d),t-=d)}}function Re(n,e,t){let r=_();const a=new TextDecoder;return function(o,l,h){if(o.length===0)t==null||t(r),r=_();else if(l>0){const d=a.decode(o.subarray(0,l)),p=l+(o[l+1]===32?2:1);let c=a.decode(o.subarray(p));switch(h&&(c+=`
2
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 C="text/event-stream",Me=1e3,_="last-event-id";function V(n,p){var c=p,{signal:e,headers:t,onopen:r,onmessage:a,onclose:i,onerror:o,openWhenHidden:l,fetch:h}=c,d=O(c,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((u,g)=>{const v=y({},t);v.accept||(v.accept=C);let $;function w(){$.abort(),document.hidden||x()}l||document.addEventListener("visibilitychange",w);let P=Me,K=0;function E(){document.removeEventListener("visibilitychange",w),window.clearTimeout(K),$.abort()}e==null||e.addEventListener("abort",()=>{E(),u()});const me=h!=null?h:window.fetch,$e=r!=null?r:Fe;function x(){return s(this,null,function*(){var L;$=new AbortController;try{const R=yield me(n,S(y({},d),{headers:v,signal:$.signal}));yield $e(R),yield be(R.body,Te(Pe(I=>{I?v[_]=I:delete v[_]},I=>{P=I},a))),i==null||i(),E(),u()}catch(R){if(!$.signal.aborted)try{const I=(L=o==null?void 0:o(R))!=null?L:P;window.clearTimeout(K),K=window.setTimeout(x,I)}catch(I){E(),g(I)}}})}x()})}function Fe(n){const e=n.headers.get("content-type");if(!(e!=null&&e.startsWith(C)))throw new Error(`Expected content-type to be ${C}, Actual: ${e}`)}const D=128,Ve=20;class De extends m{constructor(e,t,r){super(e!=null?e:f.create(),r),this.axiosInstance=e,this.getToken=t}getSessions(){return s(this,null,function*(){return this.get("/chatSession")})}postSession(e){return s(this,null,function*(){return this.post("/chatSession",e)})}getSession(e){return s(this,null,function*(){return this.get(`/chatSession/${e}`)})}updateSession(e,t){return s(this,null,function*(){return this.patch(`/chatSession/${e}`,t)})}deleteSession(e){return s(this,null,function*(){return this.delete(`/chatSession/${e}`)})}getSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.get(`chatSession/${e}/file`,t)})}postSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.post(`chatSession/${e}/file`,t)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`chatSession/${e}/file`,t)})}getSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.get(`chatSession/${e}/file/${t}`)})}deleteSessionKnowledgeFile(e,t){return s(this,null,function*(){return this.delete(`chatSession/${e}/file/${t}`)})}getSessionChatHistory(e,t){return s(this,null,function*(){return this.get(`/chatSession/${e}/history`,t)})}postMessage(e,t,r){return s(this,null,function*(){return this.post(`/config/tenantApplication?applicationId=${e}&sessionId=${t}`,r)})}postComments(e,t){return s(this,null,function*(){return this.post(`/chatSession/${e}/comments`,t)})}listApplications(){return s(this,null,function*(){return this.list("/applications")})}getApplication(){return s(this,null,function*(){return this.get("/config/tenantApplication")})}postApplication(e){return s(this,null,function*(){return this.post("/config/tenantApplication",{applicationId:e})})}getRecommendQues(){return s(this,null,function*(){return this.get("/recommendQues")})}postRecommendQues(e){return s(this,null,function*(){return this.post("/recommendQues",e)})}patchRecommendQues(e,t){return s(this,null,function*(){return this.patch(`/recommendQues/${e}`,t)})}delRecommendQues(e){return s(this,null,function*(){return this.delete(`/recommendQues/${e}`)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{k.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const l=new Uint8Array(o.target.result),h={"Content-Type":"application/octet-stream"};k.putObjectBuffer(e.bucket,e.fileKeys[0],l,h,d=>{if(d)throw console.error(d),Error(d);r(e.fileKeys[0])})}})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>this.uploadMinioFile(a,t)).catch(a=>{throw Error(a)})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a,i)))).catch(a=>{throw Error(a)})})}getKnowledge(e,t){return s(this,null,function*(){return this.get("/knowledge",{docId:e,name:t})})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}`)})}updateKnowledgeIdFileId(e,t,r){return s(this,null,function*(){return this.patch(`/chatSession/${e}/file/${t}`,r)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}/data/${r}`)})}checkFileReady(e,t,r=()=>!0,a=1e4,i){return s(this,null,function*(){return new Promise((o,l)=>{const h=()=>{if(!r()){clearInterval(d);return}t?this.getSessionKnowledgeFile(e,t).then(c=>{if(i==null||i(c),c.status===A.Success&&(clearInterval(d),o(c)),c.status===A.Failed){clearInterval(d);const u="该文件无法读取,请上传可编辑pdf,doc,docx文档";l(Error(u,{cause:{code:-101,message:u,data:c}}))}}).catch(c=>{clearInterval(d),l(c)}):o(null)},d=setInterval(h,a);h()})})}postChat(e,t){return s(this,null,function*(){return this.post("/chat",e,t)})}postChatV2EventSource(e,t,r,a){return s(this,null,function*(){var h;const i={code:0,messageId:F.v4(),content:"",role:T.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},o=yield this.getToken(),l=S(y({},t),{stream:!0});V(`${(h=this.axiosInstance)==null?void 0:h.defaults.baseURL}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(l),openWhenHidden:!0,signal:r,onopen(d){return d.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(d){if(!d.data&&!d.event&&!d.id&&!d.retry)return;if(!d.data.includes('{"code": ')){let c={};try{c=JSON.parse(d.data)}catch(g){}(c==null?void 0:c.mtype)==="search"?i.searchReference.push(c):i.content=i.content+d.data;const u={content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:U(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(a==null?void 0:a.onmessage)&&a.onmessage(u)}const p=JSON.parse(d.data);if(i.reference=p.data.reference,i.messageTime=p.data.messageTime,i.messageId=p.data.messageId,i.llmModel=p.data.llmModel,i.code=p.code,p.code===200){const c={code:i.code,content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:i.messageTime,isReplying:!0};a!=null&&a.onmessage&&a.onmessage(c)}},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const d={code:i.code,content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:i.messageTime,comment:{isAgree:0},isReplying:!1};a!=null&&a.onclose&&a.onclose(d)}})})}postChatV3EventSource(e,t,r,a){return s(this,null,function*(){var h,d;const i={code:0,messageId:F.v4(),content:"",role:T.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,reasoningContent:"",thinkingSecs:"",thinkingStatus:"",searchingStatus:""},o=yield this.getToken(),l=S(y({},t),{stream:!0});V(`${(d=(h=this.axiosInstance)==null?void 0:h.defaults.baseURL)==null?void 0:d.replace("/v1","/v3")}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(l),openWhenHidden:!0,signal:r,onopen(p){return p.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(p){if(!p.data&&!p.event&&!p.id&&!p.retry)return;let c={};try{c=JSON.parse(p.data)}catch($){console.log("eventData",p.data)}const u=c.data.type,g=c.data.payload;i.isReplying=!0,u==="error"&&(i.code=c.code,i.message=c.message);const v=()=>{if(!i.searchingStatus){i.searchingStatus="start";return}if(i.searchingStatus==="start"){i.searchingStatus="end";return}};if(u==="beforeSearch"&&v(),u==="search"&&(i.code=c.code,i.message=c.message,i.searchReference.push(g)),u==="thinking"){v(),i.code=c.code,i.message=c.message,i.thinkingStatus="start";const w=g.choices[0];i.reasoningContent=i.reasoningContent+w.delta.reasoningContent}if(u==="thinkingOver"){i.code=c.code,i.message=c.message,i.thinkingStatus="end";const $=g.thinkingSecs;i.thinkingSecs=$}if(u==="text"){v(),i.code=c.code,i.message=c.message;const w=g.choices[0];i.content=i.content+w.delta.content}if(u==="reference"&&(i.code=c.code,i.message=c.message,i.reference=g),u==="result"){i.code=c.code,i.message=c.message;const $=g.messageId,w=g.llmModel,P=g.messageTime;i.messageId=$,i.llmModel=w,i.messageTime=P,i.sessionId=e}a!=null&&a.onmessage&&a.onmessage(i)},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const p=S(y({},i),{isReplying:!1});a!=null&&a.onclose&&a.onclose(p)}})})}getResourceToken(e){return s(this,null,function*(){return this.get("/resourceToken",e)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/upload/ticket",e)})}postPrompts(e){return s(this,null,function*(){return this.post("/prompts",e)})}listPrompt(e){return s(this,null,function*(){return e!=null&&e.title&&e.title.length>D?[]:this.get("/prompts",e)})}getPrompt(e){return s(this,null,function*(){return this.get(`/prompts/${e}`)})}updatePrompt(e,t){return s(this,null,function*(){return this.put(`/prompts/${e}`,t)})}deletePrompt(e){return s(this,null,function*(){return this.delete(`/prompts/${e}`)})}chatSessionIdContext(e){return s(this,null,function*(){return this.patch(`/chatSession/${e}/context`,{})})}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}getApplicationId(e){return s(this,null,function*(){return this.get(`/applications/${e}`)})}getAppService(){return s(this,null,function*(){return this.get("/appservice")})}}window.Buffer=Q.Buffer;class Ke extends m{constructor(e,t,r){super(e!=null?e:f.create(),r),this.axiosInstance=e,this.getToken=t}getApplicationIdSessions(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session`)})}getApplicationId(e,t){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`,t)})}postApplicationIdSession(e){return s(this,null,function*(){return this.post(`/data/v1/application/${e.applicationId}/sessions`,e)})}getApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}patchApplicationIdSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}/context`,{})})}delApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/sessions/${t}`)})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/sessions/${t}/comments`,r)})}getChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/chatHistory/${t}`)})}postChatV2EventSource(e,t,r,a,i,o){return s(this,null,function*(){const l={code:0,messageId:F.v4(),content:"",role:T.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},h=yield this.getToken(),d=S(y({},r),{stream:!0});V(`https://aiot-dev.glodon.com/api/cvforcepd/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${h}`,"Content-Type":"application/json"},body:JSON.stringify(d),openWhenHidden:!0,signal:a,onopen(p){return p.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(p){if(!p.data.includes('{"code": ')){let u={};try{u=JSON.parse(p.data)}catch(v){}(u==null?void 0:u.mtype)==="search"?l.searchReference.push(u):l.content=l.content+p.data;const g={content:l.content,role:1,reference:l.reference,searchReference:l.searchReference,messageId:l.messageId,sessionId:t,messageTime:U(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(i==null?void 0:i.onmessage)&&i.onmessage(g)}const 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=>{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);r(e.fileKeys[0])})}})})}getRecommendQues(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/recommendQues`)})}postPrompts(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/prompts`,t)})}listPrompt(e,t){return s(this,null,function*(){return t!=null&&t.title&&t.title.length>D?[]:this.get(`/data/v1/application/${e}/prompts`,t)})}getPrompt(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/prompts/${t}`)})}updatePrompt(e,t,r){return s(this,null,function*(){return this.put(`/data/v1/application/${e}/prompts/${t}`,r)})}deletePrompt(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/prompts/${t}`)})}postGeneques(e,t){return s(this,null,function*(){return this.post("/data/v1/geneques",e,{},t)})}getApplicationIdSessionKnowledgeFiles(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file`,r)})}checkFileReady(e,t,r,a=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((l,h)=>{const d=()=>{if(!a()){clearInterval(p);return}r?this.getApplicationIdSessionKnowledgeFileId(e,t,r,{},!0).then(u=>{if(o==null||o(u),u.status===A.Success&&(clearInterval(p),l(u)),u.status===A.Failed){clearInterval(p);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:u}}))}}).catch(u=>{clearInterval(p),h(u)}):l(null)},p=setInterval(d,i);d()})})}getApplicationIdSessionKnowledgeFileId(e,t,r,a,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${r}`,a,i)})}delApplicationIdSessionKnowledgeFileId(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file/${r}`)})}postApplicationIdSessionKnowledgeSessionFile(e,t,r,a,i){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`,r,a,i)})}delApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file`,r)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`/data/v1/chatSession/${e}/file`,t)})}patchApplicationIdKnowledgeIdFileId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${r}`,a)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`)})}getApplicationIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/promptVariables`,t)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${r}`,a)})}updateSession(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}getSession(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}}globalThis.Buffer=Q.Buffer;class Ee extends m{constructor(e,t,r){super(e!=null?e:f.create(),r),this.axiosInstance=e,this.getToken=t}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}postGeneques(e){return s(this,null,function*(){return this.post("/data/v1/geneques",e)})}getApplicationId(e){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`)})}getApplicationIdSessions(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessionsa`,t)})}postApplicationIdSession(e){return s(this,null,function*(){return this.post(`/data/v1/application/${e.applicationId}/sessions`,e)})}getApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}patchApplicationIdSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}delApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/sessions/${t}`)})}getApplicationIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/promptVariables`,t)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${r}`,a)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`/data/v1/chatSession/${e}/file`,t)})}getRecommendQues(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/recommendQues`)})}postRecommendQues(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/recommendQues`,t)})}delRecommendQues(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/recommendQues/${t}`)})}getChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/chatHistory/${t}`)})}postPrompts(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/prompts`,t)})}listPrompt(e,t){return s(this,null,function*(){return t!=null&&t.title&&t.title.length>D?[]:this.get(`/data/v1/application/${e}/prompts`,t)})}getPrompt(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/prompts/${t}`)})}updatePrompt(e,t,r){return s(this,null,function*(){return this.put(`/data/v1/application/${e}/prompts/${t}`,r)})}deletePrompt(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/prompts/${t}`)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}/context`,{})})}getApplicationIdSessionKnowledgeFiles(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file`,r)})}postApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/file`,r)})}postApplicationIdSessionKnowledgeSessionFile(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`,r)})}delApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file`,r)})}getApplicationIdSessionKnowledgeFileId(e,t,r,a,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${r}`,a,i)})}delApplicationIdSessionKnowledgeFileId(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file/${r}`)})}patchApplicationIdKnowledgeIdFileId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${r}`,a)})}checkFileReady(e,t,r,a=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((l,h)=>{const d=()=>{if(!a()){clearInterval(p);return}r?this.getApplicationIdSessionKnowledgeFileId(e,t,r,{},!0).then(u=>{if(o==null||o(u),u.status===A.Success&&(clearInterval(p),l(u)),u.status===A.Failed){clearInterval(p);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:u}}))}}).catch(u=>{clearInterval(p),h(u)}):l(null)},p=setInterval(d,i);d()})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}postUploadTicket(e){return s(this,null,function*(){return this.post("/data/v1/ticket",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{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);r(e.fileKeys[0])})}})})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/sessions/${t}/comments`,r)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}`)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}`)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}/data/${r}`)})}postChatV2EventSource(e,t,r,a,i){return s(this,null,function*(){var d;const o={code:0,messageId:F.v4(),content:"",role:T.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,message:""},l=yield this.getToken(),h=S(y({},r),{stream:!0});V(`${(d=this.axiosInstance)==null?void 0:d.defaults.baseURL}/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify(h),openWhenHidden:!0,signal:a,onopen(p){return p.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(p){if(!p.data&&!p.event&&!p.id&&!p.retry)return;if(!p.data.includes('{"code": ')){let u={};try{u=JSON.parse(p.data)}catch(v){}(u==null?void 0:u.mtype)==="search"?o.searchReference.push(u):o.content=o.content+p.data;const g={content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:U(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(i==null?void 0:i.onmessage)&&i.onmessage(g)}const 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 m{constructor(e,t){super(e!=null?e:f.create(),t)}getKnowledge(e,t){return s(this,null,function*(){return this.get("/knowledge",{docId:e,name:t})})}postKnowledge(e){return s(this,null,function*(){return this.post("/knowledge",e)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/knowledge/${e}`)})}patchKnowledgeId(e,t){return s(this,null,function*(){return this.patch(`/knowledge/${e}`,t)})}delKnowledgeId(e){return s(this,null,function*(){return this.delete(`/knowledge/${e}`)})}getKnowledgeIdFile(e){return s(this,null,function*(){return this.get(`/knowledge/${e}/file`)})}getKnowledgeIdFileList(e,t){return s(this,null,function*(){return this.listPaged(`/knowledge/${e}/file`,t)})}postKnowledgeIdFile(e,t){return s(this,null,function*(){return this.post(`/knowledge/${e}/file`,t)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}delKnowledgeIdFileFid(e,t){return s(this,null,function*(){return this.delete(`/knowledge/${e}/file/${t}`)})}patchKnowledgeIdFileFid(e,t,r){return s(this,null,function*(){return this.patch(`/knowledge/${e}/file/${t}`,r)})}listSessions(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessionsa`,t)})}postSession(e,t){return s(this,null,function*(){return this.post(`/application/${e}/sessions`,t)})}getSession(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessions/${t}`)})}patchSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/application/${e}/sessions/${t}`,r)})}delSessionsId(e,t){return s(this,null,function*(){return this.delete(`/application/${e}/sessions/${t}`)})}getSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.get(`/application/${e}session/${t}/file/${r}`)})}postSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}session/${t}/file`,r)})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}/sessions/${t}/comments`,r)})}getChatHistorySessionId(e,t,r){return s(this,null,function*(){return this.get(`application/${e}/chatHistory/${t}`,r)})}postChatHistorySessionId(e,t){return s(this,null,function*(){return this.post(`/chatHistory/${e}`,t)})}getApplications(e){return s(this,null,function*(){return this.get("/applications",e)})}postApplication(e){return s(this,null,function*(){return this.post("/applications",e)})}getApplicationId(e,t){return s(this,null,function*(){return this.get(`/applications/${e}`,t)})}patchApplicationId(e,t){return s(this,null,function*(){return this.patch(`/applications/${e}`,t)})}delApplicationId(e){return s(this,null,function*(){return this.delete(`/applications/${e}`)})}getApplicationIdSessions(e){return s(this,null,function*(){return this.get(`/applications/${e}/session`)})}patchFileId(e,t){return s(this,null,function*(){return this.patch(`/file/${e}`,t)})}getCvforceResource(e){return s(this,null,function*(){return this.get("/cvforce/resource",e)})}postKnowledgeIdComposedFiles(e,t){return s(this,null,function*(){return this.post(`/knowledge/${e}/composedFiles`,t)})}getTokensApplicationId(e,t){return s(this,null,function*(){return this.get(`/tokens/${e}`,t)})}getTokens(e){return s(this,null,function*(){return this.get("/tokens",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{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);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||{}),b=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Failure="FAILURE",n.Success="SUCCESS",n.Abort="ABORT",n))(b||{}),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 m{constructor(e,t){super(e!=null?e:f.create(),t)}getDatasets(e){return s(this,null,function*(){return this.get("/datasets",e)})}postDatasets(e){return s(this,null,function*(){return this.post("/datasets",e)})}getDatasetsId(e){return s(this,null,function*(){return this.get(`/datasets/${e}`)})}delDatasetsId(e){return s(this,null,function*(){return this.delete(`/datasets/${e}`)})}patchDatasetsId(e,t){return s(this,null,function*(){return this.patch(`/datasets/${e}`,t)})}getDatasetsIdVersions(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions?pageNo=${t}&pageSize=${r}`)})}getDatasetsIdVersionsVidNextno(e){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/nextno`)})}getS3Iam(e,t){return s(this,null,function*(){return this.post("/s3/iam",{datasetId:e,publicBucket:t})})}postDatasetsIdVersions(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/versions`,t)})}patchDatasetsIdVersionsVid(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}`,r)})}getDatasetsIdVersionsVid(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}`)})}delDatasetsIdVersionsVid(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}`)})}getDatasetsIdVersionsNo(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/no`,t)})}listDatasetsIdLabels(e,t){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/labels`,t)})}getDatasetsIdVersionsVidLabelcount(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/labelcount`,r)})}getDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/samples`,r)})}updateSamples(e,t,r,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/samples`,{samples:r,confirmStatus:a})})}delDatasetsIdVersionsVidSamplesId(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/samples/${r}`)})}delDatasetsIdVersionsVidLlmSamplesId(e,t,r){return s(this,null,function*(){return this.delete(`datasets/${e}/versions/${t}/llmSamples/${r}`)})}getDatasetsIdVersionsVidSsamplesSid(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/samples/${r}`).then(a=>S(y({},a),{labels:a.labels?a.labels.map(i=>S(y({},i),{uuid:i.uuid||Ce()})):[]}))})}getImportInfo(){return s(this,null,function*(){return this.get("/importInfo")})}getOptionsMarkType(){return s(this,null,function*(){return this.get("/options/markType")})}getOptionsOcrMarkTmpl(){return s(this,null,function*(){return this.get("/options/ocrMarkTmpl")})}getOptionsLlmMarkTmpl(){return s(this,null,function*(){return this.get("/options/llmMarkTmpl")})}getOptionsLlmResponseSort(){return s(this,null,function*(){return this.get("/options/llmResponseSort")})}getOptionsImgproxy(){return s(this,null,function*(){return this.get("/options/imgproxy")})}getDeduplication(e,t){return s(this,null,function*(){return this.post("/files/deduplication",{md5s:e,datasetId:t})})}postDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/samples`,r)})}patchDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/samples`,r)})}listCategory(e){return s(this,null,function*(){return this.list(`/datasets/${e}/catagory`)})}postCategory(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/catagory`,{name:t})})}updateCategory(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/catagory/${t}`,{name:r})})}deleteCategory(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/catagory/${t}`)})}postDatasetIdVersionIdFilesDeduplication(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/files/deduplication`,r)})}postDatasetIdVersionIdLlmSamples(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples`,r)})}patchDatasetIdVersionIdLlmSampleId(e,t,r,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamples/${r}`,a)})}postLlmSamplesSubsection(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/subsection`,r)})}generatellmSamplesSubsection(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/subsection`,r)})}listSubsection(e,t,r,a){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection`,a)})}postSubsection(e,t,r,a){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection`,a)})}updateSubsection(e,t,r,a,i){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection/${a}`,i)})}deleteSubsection(e,t,r,a){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/llmSamples/${r}/subsection/${a}`)})}llmSupervisedRecordGenerate(e){return s(this,null,function*(){return this.post("/llm/supervisedRecord/generatedata",e)})}llmSupervisedRecordAbordTask(e){return s(this,null,function*(){return this.post("/llm/supervisedRecord/abortTask",e)})}llmSupervisedRecordPauseTask(e){return s(this,null,function*(){return this.post("/llm/supervisedRecord/pauseTask",e)})}getLlmSupervisedRecord(e){return s(this,null,function*(){return this.get(`/llm/supervisedRecord/${e}`)})}getDatasetsIdVersionsIdLlmSamplesV2(e,t,r){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/versions/${t}/llmSamplesV2`,r)})}postDatasetsIdVersionsIdLlmSamplesV2(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamplesV2`,r)})}getDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/llmSamplesV2/${r}`)})}patchDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,r,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/llmSamplesV2/${r}`,a)})}delDatasetsIdVersionsIdLlmSamplesV2Sid(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/llmSamplesV2/${r}`)})}getDatasetsIdVersionsIdExportLLMSamples(e,t){return s(this,null,function*(){return this.getNonStandard(`/datasets/${e}/versions/${t}/exportLLMSamples`,{responseType:"blob"})})}llmSamplesSubsectionView(e,t,r,a){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples/${r}/previewSubsection`,a)})}listLabels(e,t){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/labels`,t)})}postLabels(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/labels`,t)})}patchLabel(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/labels/${t}`,r)})}deleteLabel(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/labels/${t}`)})}postUploadPicsZip(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/uploadzip`,r)})}checkFileResult(e,t,r,a=1e3,i){return s(this,null,function*(){return new Promise((o,l)=>{const h=()=>{e?this.getUploadPicsZipResult(e,t,r).then(p=>{const c=p[0];if(c.state===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,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 m{constructor(e,t){super(e!=null?e:f.create(),t)}listModelServices(e){return s(this,null,function*(){return this.listPaged("/modelService",e)})}postModelService(e){return s(this,null,function*(){return this.post("/modelService",e)})}getModelServiceById(e){return s(this,null,function*(){return this.get(`/modelService/${e}`)})}patchModelServiceById(e,t){return s(this,null,function*(){return this.patch(`/modelService/${e}`,t)})}deleteModelService(e){return s(this,null,function*(){return this.delete(`/modelService/${e}`)})}getEnableModelService(e){return s(this,null,function*(){return this.get(`/modelService/${e}/enable`)})}getDisableModelService(e){return s(this,null,function*(){return this.get(`/modelService/${e}/disable`)})}getModelServiceList(e){return s(this,null,function*(){return this.get(`/modelService/${e}/list`)})}getModelServiceDelist(e){return s(this,null,function*(){return this.get(`/modelService/${e}/delist`)})}importService(e){return s(this,null,function*(){return this.post("/modelService/import",e)})}patchModelService(e,t){return s(this,null,function*(){return this.patch(`/modelService/${e}`,t)})}openModelServices(e){return s(this,null,function*(){return this.get("/openModelService",e)})}importMirronService(e){return s(this,null,function*(){return this.post("/modelService/importMirron",e)})}patchMirronService(e,t){return s(this,null,function*(){return this.patch(`/modelService/importMirron/${e}`,t)})}getServiceSignList(e){return s(this,null,function*(){return this.get("/serviceSign",e)})}}var 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 m{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 m{constructor(e,t){super(e!=null?e:f.create(),t)}listTasks(e){return s(this,null,function*(){return this.get("/tasks",e)})}createTask(e){return s(this,null,function*(){return this.post("/tasks",e)})}getTask(e){return s(this,null,function*(){return this.get(`/tasks/${e}`)})}updateTask(e,t){return s(this,null,function*(){return this.patch(`/tasks/${e}`,t)})}deleteTask(e){return s(this,null,function*(){return this.delete(`/tasks/${e}`)})}listTaskFiles(e){return s(this,null,function*(){return this.get(`/tasks/${e}/files`)})}uploadTaskFile(e,t){return s(this,null,function*(){return this.post(`/tasks/${e}/files`,t)})}listWorkflowExecutions(e){return s(this,null,function*(){return this.get("/workflows/executions",e)})}getWorkflowExecution(e){return s(this,null,function*(){return this.get(`/workflows/executions/${e}`)})}startWorkflowExecution(e){return s(this,null,function*(){return this.post("/workflows/executions",e)})}updateWorkflowExecution(e,t){return s(this,null,function*(){return this.patch(`/workflows/executions/${e}`,t)})}cancelWorkflowExecution(e){return s(this,null,function*(){return this.post(`/workflows/executions/${e}/cancel`,{})})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}}exports.AECPilotApi=De;exports.AIShopApi=Be;exports.AecKnowledgeFileStatus=A;exports.AecpilotUIApi=Ee;exports.ApplicationTypes=ce;exports.ArchiGptUIKeys=ae;exports.AuthApi=we;exports.BaseApi=m;exports.BotClientApi=Ke;exports.CVForceApi=xe;exports.CVForceDatahubApi=Ue;exports.ChatMessageRole=te;exports.ChatMode=ee;exports.ContralyzeApi=Ne;exports.DataApi=Ie;exports.FileProccessStatus=se;exports.GenerateStatus=de;exports.IChatRole=ye;exports.IDatasetLevel=ue;exports.IFileOrigin=Z;exports.IHistoryRole=T;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=D;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=b;exports.needPrettifyMsg=q;exports.prettifyMsg=J;
3
+ `+c:c;break;case"event":r.event=c;break;case"id":n(r.id=c);break;case"retry":const u=parseInt(c,10);isNaN(u)||e(r.retry=u);break}}}}function Me(n,e){const t=new Uint8Array(n.length+e.length);return t.set(n),t.set(e,n.length),t}function _(){return{data:"",event:"",id:"",retry:void 0}}const C="text/event-stream",Fe=1e3,Q="last-event-id";function V(n,p){var c=p,{signal:e,headers:t,onopen:r,onmessage:a,onclose:i,onerror:o,openWhenHidden:l,fetch:h}=c,d=W(c,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((u,g)=>{const v=y({},t);v.accept||(v.accept=C);let $;function w(){$.abort(),document.hidden||x()}l||document.addEventListener("visibilitychange",w);let P=Fe,K=0;function E(){document.removeEventListener("visibilitychange",w),window.clearTimeout(K),$.abort()}e==null||e.addEventListener("abort",()=>{E(),u()});const $e=h!=null?h:window.fetch,fe=r!=null?r:Ve;function x(){return s(this,null,function*(){var B;$=new AbortController;try{const R=yield $e(n,S(y({},d),{headers:v,signal:$.signal}));yield fe(R),yield Te(R.body,Pe(Re(I=>{I?v[Q]=I:delete v[Q]},I=>{P=I},a))),i==null||i(),E(),u()}catch(R){if(!$.signal.aborted)try{const I=(B=o==null?void 0:o(R))!=null?B:P;window.clearTimeout(K),K=window.setTimeout(x,I)}catch(I){E(),g(I)}}})}x()})}function Ve(n){const e=n.headers.get("content-type");if(!(e!=null&&e.startsWith(C)))throw new Error(`Expected content-type to be ${C}, Actual: ${e}`)}const D=128,De=20;class Ke extends m{constructor(e,t,r){super(e!=null?e: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=>{k.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const l=new Uint8Array(o.target.result),h={"Content-Type":"application/octet-stream"};k.putObjectBuffer(e.bucket,e.fileKeys[0],l,h,d=>{if(d)throw console.error(d),Error(d);r(e.fileKeys[0])})}})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>this.uploadMinioFile(a,t)).catch(a=>{throw Error(a)})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a,i)))).catch(a=>{throw Error(a)})})}getKnowledge(e,t){return s(this,null,function*(){return this.get("/knowledge",{docId:e,name:t})})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}`)})}updateKnowledgeIdFileId(e,t,r){return s(this,null,function*(){return this.patch(`/chatSession/${e}/file/${t}`,r)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}/data/${r}`)})}checkFileReady(e,t,r=()=>!0,a=1e4,i){return s(this,null,function*(){return new Promise((o,l)=>{const h=()=>{if(!r()){clearInterval(d);return}t?this.getSessionKnowledgeFile(e,t).then(c=>{if(i==null||i(c),c.status===A.Success&&(clearInterval(d),o(c)),c.status===A.Failed){clearInterval(d);const u="该文件无法读取,请上传可编辑pdf,doc,docx文档";l(Error(u,{cause:{code:-101,message:u,data:c}}))}}).catch(c=>{clearInterval(d),l(c)}):o(null)},d=setInterval(h,a);h()})})}postChat(e,t){return s(this,null,function*(){return this.post("/chat",e,t)})}postChatV2EventSource(e,t,r,a){return s(this,null,function*(){var h;const i={code:0,messageId:F.v4(),content:"",role:T.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},o=yield this.getToken(),l=S(y({},t),{stream:!0});V(`${(h=this.axiosInstance)==null?void 0:h.defaults.baseURL}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(l),openWhenHidden:!0,signal:r,onopen(d){return d.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(d){if(!d.data&&!d.event&&!d.id&&!d.retry)return;if(!d.data.includes('{"code": ')){let c={};try{c=JSON.parse(d.data)}catch(g){}(c==null?void 0:c.mtype)==="search"?i.searchReference.push(c):i.content=i.content+d.data;const u={content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:U(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(a==null?void 0:a.onmessage)&&a.onmessage(u)}const p=JSON.parse(d.data);if(i.reference=p.data.reference,i.messageTime=p.data.messageTime,i.messageId=p.data.messageId,i.llmModel=p.data.llmModel,i.code=p.code,p.code===200){const c={code:i.code,content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:i.messageTime,isReplying:!0};a!=null&&a.onmessage&&a.onmessage(c)}},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const d={code:i.code,content:i.content,role:1,reference:i.reference,searchReference:i.searchReference,messageId:i.messageId,sessionId:e,messageTime:i.messageTime,comment:{isAgree:0},isReplying:!1};a!=null&&a.onclose&&a.onclose(d)}})})}postChatV3EventSource(e,t,r,a){return s(this,null,function*(){var h,d;const i={code:0,messageId:F.v4(),content:"",role:T.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,reasoningContent:"",thinkingSecs:"",thinkingStatus:"",searchingStatus:""},o=yield this.getToken(),l=S(y({},t),{stream:!0});V(`${(d=(h=this.axiosInstance)==null?void 0:h.defaults.baseURL)==null?void 0:d.replace("/v1","/v3")}/chat?sessionId=${e}`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(l),openWhenHidden:!0,signal:r,onopen(p){return p.ok&&a!=null&&a.onopen&&a.onopen(),Promise.resolve()},onmessage(p){if(!p.data&&!p.event&&!p.id&&!p.retry)return;let c={};try{c=JSON.parse(p.data)}catch($){console.log("eventData",p.data)}const u=c.data.type,g=c.data.payload;i.isReplying=!0,u==="error"&&(i.code=c.code,i.message=c.message);const v=()=>{if(!i.searchingStatus){i.searchingStatus="start";return}if(i.searchingStatus==="start"){i.searchingStatus="end";return}};if(u==="beforeSearch"&&v(),u==="search"&&(i.code=c.code,i.message=c.message,i.searchReference.push(g)),u==="thinking"){v(),i.code=c.code,i.message=c.message,i.thinkingStatus="start";const w=g.choices[0];i.reasoningContent=i.reasoningContent+w.delta.reasoningContent}if(u==="thinkingOver"){i.code=c.code,i.message=c.message,i.thinkingStatus="end";const $=g.thinkingSecs;i.thinkingSecs=$}if(u==="text"){v(),i.code=c.code,i.message=c.message;const w=g.choices[0];i.content=i.content+w.delta.content}if(u==="reference"&&(i.code=c.code,i.message=c.message,i.reference=g),u==="result"){i.code=c.code,i.message=c.message;const $=g.messageId,w=g.llmModel,P=g.messageTime;i.messageId=$,i.llmModel=w,i.messageTime=P,i.sessionId=e}a!=null&&a.onmessage&&a.onmessage(i)},onerror(){a!=null&&a.onerror&&a.onerror()},onclose(){const p=S(y({},i),{isReplying:!1});a!=null&&a.onclose&&a.onclose(p)}})})}getResourceToken(e){return s(this,null,function*(){return this.get("/resourceToken",e)})}postUploadTicket(e){return s(this,null,function*(){return this.post("/upload/ticket",e)})}postPrompts(e){return s(this,null,function*(){return this.post("/prompts",e)})}listPrompt(e){return s(this,null,function*(){return e!=null&&e.title&&e.title.length>D?[]:this.get("/prompts",e)})}getPrompt(e){return s(this,null,function*(){return this.get(`/prompts/${e}`)})}updatePrompt(e,t){return s(this,null,function*(){return this.put(`/prompts/${e}`,t)})}deletePrompt(e){return s(this,null,function*(){return this.delete(`/prompts/${e}`)})}chatSessionIdContext(e){return s(this,null,function*(){return this.patch(`/chatSession/${e}/context`,{})})}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}getApplicationId(e){return s(this,null,function*(){return this.get(`/applications/${e}`)})}getAppService(){return s(this,null,function*(){return this.get("/appservice")})}}window.Buffer=L.Buffer;class Ee extends m{constructor(e,t,r){super(e!=null?e:f.create(),r),this.axiosInstance=e,this.getToken=t}getApplicationIdSessions(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session`)})}getApplicationId(e,t){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`,t)})}postApplicationIdSession(e){return s(this,null,function*(){return this.post(`/data/v1/application/${e.applicationId}/sessions`,e)})}getApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}patchApplicationIdSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}/context`,{})})}delApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/sessions/${t}`)})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/sessions/${t}/comments`,r)})}getChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/chatHistory/${t}`)})}postChatV2EventSource(e,t,r,a,i,o){return s(this,null,function*(){const l={code:0,messageId:F.v4(),content:"",role:T.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1},h=yield this.getToken(),d=S(y({},r),{stream:!0});V(`https://aiot-dev.glodon.com/api/cvforcepd/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${h}`,"Content-Type":"application/json"},body:JSON.stringify(d),openWhenHidden:!0,signal:a,onopen(p){return p.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(p){if(!p.data.includes('{"code": ')){let u={};try{u=JSON.parse(p.data)}catch(v){}(u==null?void 0:u.mtype)==="search"?l.searchReference.push(u):l.content=l.content+p.data;const g={content:l.content,role:1,reference:l.reference,searchReference:l.searchReference,messageId:l.messageId,sessionId:t,messageTime:U(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(i==null?void 0:i.onmessage)&&i.onmessage(g)}const 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=>{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);r(e.fileKeys[0])})}})})}getRecommendQues(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/recommendQues`)})}postPrompts(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/prompts`,t)})}listPrompt(e,t){return s(this,null,function*(){return t!=null&&t.title&&t.title.length>D?[]:this.get(`/data/v1/application/${e}/prompts`,t)})}getPrompt(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/prompts/${t}`)})}updatePrompt(e,t,r){return s(this,null,function*(){return this.put(`/data/v1/application/${e}/prompts/${t}`,r)})}deletePrompt(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/prompts/${t}`)})}postGeneques(e,t){return s(this,null,function*(){return this.post("/data/v1/geneques",e,{},t)})}getApplicationIdSessionKnowledgeFiles(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file`,r)})}checkFileReady(e,t,r,a=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((l,h)=>{const d=()=>{if(!a()){clearInterval(p);return}r?this.getApplicationIdSessionKnowledgeFileId(e,t,r,{},!0).then(u=>{if(o==null||o(u),u.status===A.Success&&(clearInterval(p),l(u)),u.status===A.Failed){clearInterval(p);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:u}}))}}).catch(u=>{clearInterval(p),h(u)}):l(null)},p=setInterval(d,i);d()})})}getApplicationIdSessionKnowledgeFileId(e,t,r,a,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${r}`,a,i)})}delApplicationIdSessionKnowledgeFileId(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file/${r}`)})}postApplicationIdSessionKnowledgeSessionFile(e,t,r,a,i){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`,r,a,i)})}delApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file`,r)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`/data/v1/chatSession/${e}/file`,t)})}patchApplicationIdKnowledgeIdFileId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${r}`,a)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`)})}getApplicationIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/promptVariables`,t)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${r}`,a)})}updateSession(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}getSession(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}}globalThis.Buffer=L.Buffer;class xe extends m{constructor(e,t,r){super(e!=null?e:f.create(),r),this.axiosInstance=e,this.getToken=t}getBaseModelInfo(e){return s(this,null,function*(){return this.get("/data/v1/baseModelInfo",{serviceId:e})})}postGeneques(e){return s(this,null,function*(){return this.post("/data/v1/geneques",e)})}getApplicationId(e){return s(this,null,function*(){return this.get(`/data/v1/applications/${e}`)})}getApplicationIdSessions(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessionsa`,t)})}postApplicationIdSession(e){return s(this,null,function*(){return this.post(`/data/v1/application/${e.applicationId}/sessions`,e)})}getApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/sessions/${t}`)})}patchApplicationIdSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}`,r)})}delApplicationIdSessionsId(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/sessions/${t}`)})}getApplicationIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/promptVariables`,t)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/promptVariables`)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/promptVariables/${r}`,a)})}deleteSessionKnowledgeFiles(e,t){return s(this,null,function*(){return this.delete(`/data/v1/chatSession/${e}/file`,t)})}getRecommendQues(e){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/recommendQues`)})}postRecommendQues(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/recommendQues`,t)})}delRecommendQues(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/recommendQues/${t}`)})}getChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/chatHistory/${t}`)})}postPrompts(e,t){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/prompts`,t)})}listPrompt(e,t){return s(this,null,function*(){return t!=null&&t.title&&t.title.length>D?[]:this.get(`/data/v1/application/${e}/prompts`,t)})}getPrompt(e,t){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/prompts/${t}`)})}updatePrompt(e,t,r){return s(this,null,function*(){return this.put(`/data/v1/application/${e}/prompts/${t}`,r)})}deletePrompt(e,t){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/prompts/${t}`)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/sessions/${t}/context`,{})})}getApplicationIdSessionKnowledgeFiles(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file`,r)})}postApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/file`,r)})}postApplicationIdSessionKnowledgeSessionFile(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/session/${t}/sessionfile`,r)})}delApplicationIdSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file`,r)})}getApplicationIdSessionKnowledgeFileId(e,t,r,a,i){return s(this,null,function*(){return this.get(`/data/v1/application/${e}/session/${t}/file/${r}`,a,i)})}delApplicationIdSessionKnowledgeFileId(e,t,r){return s(this,null,function*(){return this.delete(`/data/v1/application/${e}/session/${t}/file/${r}`)})}patchApplicationIdKnowledgeIdFileId(e,t,r,a){return s(this,null,function*(){return this.patch(`/data/v1/application/${e}/session/${t}/file/${r}`,a)})}checkFileReady(e,t,r,a=()=>!0,i=1e4,o){return s(this,null,function*(){return new Promise((l,h)=>{const d=()=>{if(!a()){clearInterval(p);return}r?this.getApplicationIdSessionKnowledgeFileId(e,t,r,{},!0).then(u=>{if(o==null||o(u),u.status===A.Success&&(clearInterval(p),l(u)),u.status===A.Failed){clearInterval(p);const g="该文件无法读取,请上传可编辑pdf,doc,docx文档";h(Error(g,{cause:{code:-101,message:g,data:u}}))}}).catch(u=>{clearInterval(p),h(u)}):l(null)},p=setInterval(d,i);d()})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.postUploadTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}postUploadTicket(e){return s(this,null,function*(){return this.post("/data/v1/ticket",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{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);r(e.fileKeys[0])})}})})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/data/v1/application/${e}/sessions/${t}/comments`,r)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}`)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}`)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.get(`/data/v1/knowledge/${e}/file/${t}/data/${r}`)})}postChatV2EventSource(e,t,r,a,i){return s(this,null,function*(){var d;const o={code:0,messageId:F.v4(),content:"",role:T.Robot,sessionId:"",reference:[],searchReference:[],messageTime:"",llmModel:"",comment:{isAgree:0},isReplying:!1,message:""},l=yield this.getToken(),h=S(y({},r),{stream:!0});V(`${(d=this.axiosInstance)==null?void 0:d.defaults.baseURL}/chat/v2/chat?applicationId=${e}&sessionId=${t}`,{method:"POST",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify(h),openWhenHidden:!0,signal:a,onopen(p){return p.ok&&i!=null&&i.onopen&&i.onopen(),Promise.resolve()},onmessage(p){if(!p.data&&!p.event&&!p.id&&!p.retry)return;if(!p.data.includes('{"code": ')){let u={};try{u=JSON.parse(p.data)}catch(v){}(u==null?void 0:u.mtype)==="search"?o.searchReference.push(u):o.content=o.content+p.data;const g={content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:U(new Date).format("YYYY-MM-DD HH:mm:ss"),comment:{isAgree:0},isReplying:!0};return(i==null?void 0:i.onmessage)&&i.onmessage(g)}const c=JSON.parse(p.data);if(o.reference=c.data.reference,o.messageTime=c.data.messageTime,o.messageId=c.data.messageId,o.llmModel=c.data.llmModel,o.code=c.code,o.message=c.message,c.code===200){const u={code:o.code,content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:o.messageTime,isReplying:!0};i!=null&&i.onmessage&&i.onmessage(u)}},onerror(){i!=null&&i.onerror&&i.onerror()},onclose(){const p={code:o.code,content:o.content,role:1,reference:o.reference,searchReference:o.searchReference,messageId:o.messageId,sessionId:t,messageTime:o.messageTime,comment:{isAgree:0},isReplying:!1,message:o.message};i!=null&&i.onclose&&i.onclose(p)}})})}postChat(e,t){return s(this,null,function*(){var r;return this.post(`${(r=this.axiosInstance)==null?void 0:r.defaults.baseURL}/chat/v2/chat`,e,t)})}}var ee=(n=>(n[n.Dialog=0]="Dialog",n[n.TextGenerate=1]="TextGenerate",n[n.FileSummery=2]="FileSummery",n))(ee||{}),te=(n=>(n[n.Robot=1]="Robot",n[n.User=2]="User",n[n.System=3]="System",n))(te||{}),se=(n=>(n[n.Processing=1]="Processing",n[n.Done=2]="Done",n[n.Failed=3]="Failed",n))(se||{}),re=(n=>(n[n.File=0]="File",n[n.WebLink=1]="WebLink",n))(re||{}),ne=(n=>(n[n.Processing=1]="Processing",n[n.Success=2]="Success",n[n.Failed=3]="Failed",n))(ne||{}),ae=(n=>(n.InputFile="ui.input.file",n.LLMModel="ui.llm.model",n))(ae||{}),ie=(n=>(n[n.Idle=0]="Idle",n[n.Quoted=1]="Quoted",n))(ie||{}),oe=(n=>(n[n.Basic=0]="Basic",n[n.Pro=1]="Pro",n))(oe||{}),ce=(n=>(n[n.Dialog=0]="Dialog",n[n.Text=1]="Text",n[n.Agent=2]="Agent",n[n.All=3]="All",n))(ce||{}),le=(n=>(n.User="instruction",n.System="settings",n))(le||{});class Ce extends m{constructor(e,t){super(e!=null?e:f.create(),t)}getKnowledge(e,t){return s(this,null,function*(){return this.get("/knowledge",{docId:e,name:t})})}postKnowledge(e){return s(this,null,function*(){return this.post("/knowledge",e)})}getKnowledgeId(e){return s(this,null,function*(){return this.get(`/knowledge/${e}`)})}patchKnowledgeId(e,t){return s(this,null,function*(){return this.patch(`/knowledge/${e}`,t)})}delKnowledgeId(e){return s(this,null,function*(){return this.delete(`/knowledge/${e}`)})}getKnowledgeIdFile(e){return s(this,null,function*(){return this.get(`/knowledge/${e}/file`)})}getKnowledgeIdFileList(e,t){return s(this,null,function*(){return this.listPaged(`/knowledge/${e}/file`,t)})}postKnowledgeIdFile(e,t){return s(this,null,function*(){return this.post(`/knowledge/${e}/file`,t)})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}delKnowledgeIdFileFid(e,t){return s(this,null,function*(){return this.delete(`/knowledge/${e}/file/${t}`)})}patchKnowledgeIdFileFid(e,t,r){return s(this,null,function*(){return this.patch(`/knowledge/${e}/file/${t}`,r)})}listSessions(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessionsa`,t)})}postSession(e,t){return s(this,null,function*(){return this.post(`/application/${e}/sessions`,t)})}getSession(e,t){return s(this,null,function*(){return this.get(`/application/${e}/sessions/${t}`)})}patchSessionsId(e,t,r){return s(this,null,function*(){return this.patch(`/application/${e}/sessions/${t}`,r)})}delSessionsId(e,t){return s(this,null,function*(){return this.delete(`/application/${e}/sessions/${t}`)})}getSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.get(`/application/${e}session/${t}/file/${r}`)})}postSessionKnowledgeFile(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}session/${t}/file`,r)})}postComments(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}/sessions/${t}/comments`,r)})}getChatHistorySessionId(e,t,r){return s(this,null,function*(){return this.get(`application/${e}/chatHistory/${t}`,r)})}postChatHistorySessionId(e,t){return s(this,null,function*(){return this.post(`/chatHistory/${e}`,t)})}getApplications(e){return s(this,null,function*(){return this.get("/applications",e)})}postApplication(e){return s(this,null,function*(){return this.post("/applications",e)})}getApplicationId(e,t){return s(this,null,function*(){return this.get(`/applications/${e}`,t)})}patchApplicationId(e,t){return s(this,null,function*(){return this.patch(`/applications/${e}`,t)})}delApplicationId(e){return s(this,null,function*(){return this.delete(`/applications/${e}`)})}getApplicationIdSessions(e){return s(this,null,function*(){return this.get(`/applications/${e}/session`)})}patchFileId(e,t){return s(this,null,function*(){return this.patch(`/file/${e}`,t)})}getCvforceResource(e){return s(this,null,function*(){return this.get("/cvforce/resource",e)})}postKnowledgeIdComposedFiles(e,t){return s(this,null,function*(){return this.post(`/knowledge/${e}/composedFiles`,t)})}getTokensApplicationId(e,t){return s(this,null,function*(){return this.get(`/tokens/${e}`,t)})}getTokens(e){return s(this,null,function*(){return this.get("/tokens",e)})}uploadMinioFile(e,t){return s(this,null,function*(){return new Promise((r,a)=>{const i=new FileReader;i.readAsArrayBuffer(t),i.onload=o=>{k.initMinio({endPoint:e.endpoints[0],useSSL:e.useSSL,accessKey:e.accessKey,secretKey:e.secretKey});const l=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);r(e.fileKeys[0])})}})})}uploadFile(e,t){return s(this,null,function*(){const r={files:[t.name],isv:"minio",knowledgeId:e};return this.getUploadTicket(r).then(a=>this.uploadMinioFile(a.minio,t)).catch(a=>{throw Error(a)})})}uploadFiles(e,t){return s(this,null,function*(){const r={files:t.map(a=>a.name),isv:"minio",knowledgeId:e};return this.getUploadTicket(r).then(a=>Promise.all(t.map(i=>this.uploadMinioFile(a.minio,i)))).catch(a=>{throw Error(a)})})}getAecModels(){return s(this,null,function*(){return this.get("/aecModels")})}postTextFilter(e){return s(this,null,function*(){return this.post("/textFilter",e)})}getTenantModel(){return s(this,null,function*(){return this.get("/tenantModel")})}getPrompts(e,t){return s(this,null,function*(){return this.get(`application/${e}/promptVariables`,t)})}postPrompt(e,t){return s(this,null,function*(){return this.post(`application/${e}/promptVariables`,t)})}patchPromptId(e,t,r){return s(this,null,function*(){return this.patch(`application/${e}/promptVariables/${t}`,r)})}delPromptId(e,t){return s(this,null,function*(){return this.delete(`application/${e}/promptVariables/${t}`)})}getSessionPrompts(e){return s(this,null,function*(){return this.get(`session/${e}/promptVariables`)})}patchSessionPromptId(e,t,r){return s(this,null,function*(){return this.patch(`session/${t}/promptVariables/${e}`,r)})}getApplicationIdSessionIdPromptVariables(e,t){return s(this,null,function*(){return this.get(`/application/${e}/session/${t}/promptVariables`)})}patchApplicationIdSessionpromptVariablesId(e,t,r,a){return s(this,null,function*(){return this.patch(`/application/${e}/session/${t}/promptVariables/${r}`,a)})}getPresetApplication(e){return s(this,null,function*(){return this.get("presetApplication",e)})}postKnowledgeConfig(e){return s(this,null,function*(){return this.post("/knowledgeConfig",e)})}getKnowledgeConfig(e){return s(this,null,function*(){return this.get(`/knowledgeConfig/${e}`)})}patchKnowledgeConfig(e,t){return s(this,null,function*(){return this.patch(`/knowledgeConfig/${e}`,t)})}getKnowledgeIdFileId(e,t){return s(this,null,function*(){return this.get(`/knowledge/${e}/file/${t}`)})}getKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.listPaged(`/knowledge/${e}/file/${t}/data`,r)})}postKnowledgeIdFileIdData(e,t,r){return s(this,null,function*(){return this.post(`/knowledge/${e}/file/${t}/data`,{data:r})})}patchKnowledgeIdFileIdData(e,t,r,a){return s(this,null,function*(){return this.patch(`/knowledge/${e}/file/${t}/data/${r}`,{data:a})})}delKnowledgeIdFileIdDataDid(e,t,r){return s(this,null,function*(){return this.delete(`/knowledge/${e}/file/${t}/data/${r}`)})}getPresetKnowledge(e){return s(this,null,function*(){return this.get("/presetKnowledge",e)})}patchSessionsIdContext(e){return s(this,null,function*(){return this.patch(`/sessions/${e}/context`,{})})}postResourceToken(e){return s(this,null,function*(){return this.post("/resourceToken",e)})}getApplicationIdSession(e){return s(this,null,function*(){return this.get(`/application/${e}/session`)})}patchApplicationIdSessionsIdContext(e,t){return s(this,null,function*(){return this.patch(`/application/${e}/sessions/${t}/context`,{})})}postApplicationIdSessions(e,t){return s(this,null,function*(){return this.post(`/application/${e}/sessions`,t)})}getApplicationIdChatHistorySessionId(e,t){return s(this,null,function*(){return this.get(`/application/${e}/chatHistory/${t}`)})}postApplicationIdChatHistorySessionIdComments(e,t,r){return s(this,null,function*(){return this.post(`/application/${e}/sessions/${t}/comments`,r)})}getApplicationIdPrompts(e,t){return s(this,null,function*(){return this.get(`/application/${e}/promptVariables`,t)})}postKnowledgeSourceFile(e,t,r){return s(this,null,function*(){return this.post(`/knowledge/${e}/sourceFile/${t}`,r)})}getMetadata(e){return s(this,null,function*(){return this.get("/metadata",e)})}postGeneques(e){return s(this,null,function*(){return this.post("/geneques",e)})}getBaseModel(e){return s(this,null,function*(){return this.get("/baseModelInfo",{serviceId:e})})}}var de=(n=>(n[n.inital=0]="inital",n[n.success=1]="success",n[n.processing=2]="processing",n[n.failed=3]="failed",n))(de||{}),pe=(n=>(n[n.inital=0]="inital",n[n.processing=1]="processing",n[n.paused=2]="paused",n[n.failed=3]="failed",n[n.done=4]="done",n))(pe||{}),b=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Failure="FAILURE",n.Success="SUCCESS",n.Abort="ABORT",n))(b||{}),ue=(n=>(n.Pending="PENDING",n.Started="STARTED",n.Success="SUCCESS",n.Failure="FAILURE ",n))(ue||{}),he=(n=>(n[n.all=0]="all",n[n.general=1]="general",n[n.major=2]="major",n))(he||{});function Ue(){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 Le extends m{constructor(e,t){super(e!=null?e:f.create(),t)}getDatasets(e){return s(this,null,function*(){return this.get("/datasets",e)})}postDatasets(e){return s(this,null,function*(){return this.post("/datasets",e)})}getDatasetsId(e){return s(this,null,function*(){return this.get(`/datasets/${e}`)})}delDatasetsId(e){return s(this,null,function*(){return this.delete(`/datasets/${e}`)})}patchDatasetsId(e,t){return s(this,null,function*(){return this.patch(`/datasets/${e}`,t)})}getDatasetsIdVersions(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions?pageNo=${t}&pageSize=${r}`)})}getDatasetsIdVersionsVidNextno(e){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/nextno`)})}getS3Iam(e,t){return s(this,null,function*(){return this.post("/s3/iam",{datasetId:e,publicBucket:t})})}postDatasetsIdVersions(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/versions`,t)})}patchDatasetsIdVersionsVid(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}`,r)})}getDatasetsIdVersionsVid(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}`)})}delDatasetsIdVersionsVid(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}`)})}getDatasetsIdVersionsNo(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/no`,t)})}listDatasetsIdLabels(e,t){return s(this,null,function*(){return this.listPaged(`/datasets/${e}/labels`,t)})}getDatasetsIdVersionsVidLabelcount(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/labelcount`,r)})}getDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/samples`,r)})}updateSamples(e,t,r,a){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/samples`,{samples:r,confirmStatus:a})})}delDatasetsIdVersionsVidSamplesId(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/samples/${r}`)})}delDatasetsIdVersionsVidLlmSamplesId(e,t,r){return s(this,null,function*(){return this.delete(`datasets/${e}/versions/${t}/llmSamples/${r}`)})}getDatasetsIdVersionsVidSsamplesSid(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/samples/${r}`).then(a=>S(y({},a),{labels:a.labels?a.labels.map(i=>S(y({},i),{uuid:i.uuid||Ue()})):[]}))})}getImportInfo(){return s(this,null,function*(){return this.get("/importInfo")})}getOptionsMarkType(){return s(this,null,function*(){return this.get("/options/markType")})}getOptionsOcrMarkTmpl(){return s(this,null,function*(){return this.get("/options/ocrMarkTmpl")})}getOptionsLlmMarkTmpl(){return s(this,null,function*(){return this.get("/options/llmMarkTmpl")})}getOptionsLlmResponseSort(){return s(this,null,function*(){return this.get("/options/llmResponseSort")})}getOptionsImgproxy(){return s(this,null,function*(){return this.get("/options/imgproxy")})}getDeduplication(e,t){return s(this,null,function*(){return this.post("/files/deduplication",{md5s:e,datasetId:t})})}postDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/samples`,r)})}patchDatasetsIdVersionsVidSamples(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/versions/${t}/samples`,r)})}listCategory(e){return s(this,null,function*(){return this.list(`/datasets/${e}/catagory`)})}postCategory(e,t){return s(this,null,function*(){return this.post(`/datasets/${e}/catagory`,{name:t})})}updateCategory(e,t,r){return s(this,null,function*(){return this.patch(`/datasets/${e}/catagory/${t}`,{name:r})})}deleteCategory(e,t){return s(this,null,function*(){return this.delete(`/datasets/${e}/catagory/${t}`)})}postDatasetIdVersionIdFilesDeduplication(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/files/deduplication`,r)})}postDatasetIdVersionIdLlmSamples(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/llmSamples`,r)})}patchDatasetIdVersionIdLlmSampleId(e,t,r,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===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,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/uploadzip`,r)})}getUploadabort(e,t,r){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/uploadabort`,r)})}postPreLabelTask(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/prelabeltask`,r)})}getPreLabelTask(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/prelabeltask`)})}delPreLabelTask(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/prelabeltask/${r}`)})}getAllConfirmSamples(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/confirm`)})}getDataSetCopyTask(e,t){return s(this,null,function*(){return this.get(`/datasets/${e}/versions/${t}/copyDataset`)})}postDataSetCopyTask(e,t,r){return s(this,null,function*(){return this.post(`/datasets/${e}/versions/${t}/copyDataset`,r)})}deleteDatasetCopyTask(e,t,r){return s(this,null,function*(){return this.delete(`/datasets/${e}/versions/${t}/copyDataset`,r)})}}class Be extends m{constructor(e,t){super(e!=null?e:f.create(),t)}listModelServices(e){return s(this,null,function*(){return this.listPaged("/modelService",e)})}postModelService(e){return s(this,null,function*(){return this.post("/modelService",e)})}getModelServiceById(e){return s(this,null,function*(){return this.get(`/modelService/${e}`)})}patchModelServiceById(e,t){return s(this,null,function*(){return this.patch(`/modelService/${e}`,t)})}deleteModelService(e){return s(this,null,function*(){return this.delete(`/modelService/${e}`)})}getEnableModelService(e){return s(this,null,function*(){return this.get(`/modelService/${e}/enable`)})}getDisableModelService(e){return s(this,null,function*(){return this.get(`/modelService/${e}/disable`)})}getModelServiceList(e){return s(this,null,function*(){return this.get(`/modelService/${e}/list`)})}getModelServiceDelist(e){return s(this,null,function*(){return this.get(`/modelService/${e}/delist`)})}importService(e){return s(this,null,function*(){return this.post("/modelService/import",e)})}patchModelService(e,t){return s(this,null,function*(){return this.patch(`/modelService/${e}`,t)})}openModelServices(e){return s(this,null,function*(){return this.get("/openModelService",e)})}importMirronService(e){return s(this,null,function*(){return this.post("/modelService/importMirron",e)})}patchMirronService(e,t){return s(this,null,function*(){return this.patch(`/modelService/importMirron/${e}`,t)})}getServiceSignList(e){return s(this,null,function*(){return this.get("/serviceSign",e)})}}var ge=(n=>(n[n.minio=0]="minio",n[n.pvc=1]="pvc",n))(ge||{}),ye=(n=>(n.common="A100",n.idcard="A104",n.bankcard="A108",n.page="A112",n.rmwatermark="A115",n.seal="A116",n.rmseal="A117",n.table="A118",n))(ye||{}),me=(n=>(n.User="user",n.Assistant="assistant",n.System="system",n))(me||{});class Ne extends m{constructor(e,t){super(e!=null?e:f.create(),t)}ocr(e,t){return s(this,null,function*(){if(t.modelStore===ge.pvc){const r=this.convertToBatchParams(t),a=yield this.ocrPvcBatch(e,r);return this.convertToMinioResult(a)}else return this.ocrMinio(e,t)})}convertToBatchParams(e){return{pages:[{image:e.image}]}}convertToMinioResult(e){var t;return(t=e.pages)==null?void 0:t.flatMap(r=>{var a;return((a=r.textItems)==null?void 0:a.map(i=>({box:i.bbox})))||[]})}ocrMinio(e,t){return s(this,null,function*(){return t.image&&t.image.split("base64,").length>1&&(t.image=t.image.split("base64,")[1]),this.post(`/v2/infer?serviceId=${e}`,t)})}ocrPvcBatch(e,t){return s(this,null,function*(){return this.post(`/v2/infer?serviceId=${e}`,t)})}getSleep(e){return s(this,null,function*(){return new Promise(t=>{setTimeout(()=>{t(!0)},e*1e3)})})}postChatCompletions(e){return s(this,null,function*(){return this.postNonStandard("/v1/chat/completions",e)})}detection(e,t){return s(this,null,function*(){return this.post(`/v2/infer?serviceId=${e}`,t)})}getBaseModel(e){return s(this,null,function*(){return this.get("/v1/baseModel",{serviceId:e})})}postEmbeddings(e){return s(this,null,function*(){return this.postNonStandard("/v1/embeddings",e)})}}class He extends m{constructor(e,t){super(e!=null?e:f.create(),t)}listTasks(e){return s(this,null,function*(){return this.get("/tasks",e)})}createTask(e){return s(this,null,function*(){return this.post("/tasks",e)})}getTask(e){return s(this,null,function*(){return this.get(`/tasks/${e}`)})}updateTask(e,t){return s(this,null,function*(){return this.patch(`/tasks/${e}`,t)})}deleteTask(e){return s(this,null,function*(){return this.delete(`/tasks/${e}`)})}listTaskFiles(e){return s(this,null,function*(){return this.get(`/tasks/${e}/files`)})}uploadTaskFile(e,t){return s(this,null,function*(){return this.post(`/tasks/${e}/files`,t)})}listWorkflowExecutions(e){return s(this,null,function*(){return this.get("/workflows/executions",e)})}getWorkflowExecution(e){return s(this,null,function*(){return this.get(`/workflows/executions/${e}`)})}startWorkflowExecution(e){return s(this,null,function*(){return this.post("/workflows/executions",e)})}updateWorkflowExecution(e,t){return s(this,null,function*(){return this.patch(`/workflows/executions/${e}`,t)})}cancelWorkflowExecution(e){return s(this,null,function*(){return this.post(`/workflows/executions/${e}/cancel`,{})})}getUploadTicket(e){return s(this,null,function*(){return this.get("/upload/ticket",e)})}}exports.AECPilotApi=Ke;exports.AIShopApi=Ne;exports.AecKnowledgeFileStatus=A;exports.AecpilotUIApi=xe;exports.ApplicationTypes=ce;exports.ArchiGptUIKeys=ae;exports.AuthApi=Ie;exports.BaseApi=m;exports.BotClientApi=Ee;exports.CVForceApi=Ce;exports.CVForceDatahubApi=Le;exports.ChatMessageRole=te;exports.ChatMode=ee;exports.ContralyzeApi=He;exports.DataApi=ke;exports.FileProccessStatus=se;exports.GenerateStatus=pe;exports.IChatRole=me;exports.IDatasetLevel=he;exports.IFileOrigin=Z;exports.IHistoryRole=T;exports.ISourceType=z;exports.ISpacetwinStatus=Y;exports.IThinkingStatus=X;exports.IversionInfo=G;exports.KnowledgeFileStatus=ne;exports.KnowledgeType=oe;exports.ModelServiceApi=Be;exports.OCRServiceId=ye;exports.PROMPT_SEARCH_MAX_LENGTH=D;exports.PROMPT_TITLE_MAX_LENGTH=De;exports.PanoramaApi=Ae;exports.PanoramaPluginMgrApi=be;exports.PreLabelTaskStatus=ue;exports.PromptStatus=ie;exports.PromptVariableType=le;exports.RecordStatus=j;exports.SourceType=re;exports.SubsectionStatus=de;exports.UploadZipsStatus=b;exports.needPrettifyMsg=q;exports.prettifyMsg=J;
@@ -1,3 +1,4 @@
1
+ import { PromptVariableType } from '../cvforce/model';
1
2
  export interface IArrange {
2
3
  llmModel: string;
3
4
  prePrompt: string;
@@ -122,6 +123,7 @@ export interface IAecSessionPrompt {
122
123
  key: string;
123
124
  name: string;
124
125
  value: string;
126
+ type: PromptVariableType;
125
127
  }
126
128
  export interface IAecSession {
127
129
  id: string;
@@ -1,3 +1,4 @@
1
+ import { PromptVariableType } from '../cvforce';
1
2
  export interface IFileData {
2
3
  key: string;
3
4
  name: string;
@@ -48,12 +49,14 @@ export interface IPromptVariables {
48
49
  key: string;
49
50
  name: string;
50
51
  status?: number;
52
+ type?: PromptVariableType;
51
53
  }
52
54
  export interface ISessionPrompt {
53
55
  id: string;
54
56
  key: string;
55
57
  name: string;
56
58
  value: string;
59
+ type: PromptVariableType;
57
60
  }
58
61
  export interface IGeneques {
59
62
  content: string;
@@ -3,6 +3,7 @@ import { ApiErrorHandler, BaseApi } from '../base';
3
3
  import { IApplication, ICommentParam, IAecFile as IFile, IAecFileDataParam as IFileDataParam, IHistory, IAecKnowledge, IAecPrompt as IPrompt, IAecPromptParam as IPromptParam, IPromptType, IQuestion, IAecSessionParam as ISessionParam, IAecSession as ISession, KnowledgeFileMetadata, KnowledgeFileMetadataParams, IFileParams, IKnowledgeFileParams } from '../aecpilot/model';
4
4
  import { IBaseModel, IUploadParam, IUploadTicket, MinioConfig } from './model';
5
5
  import { IGeneques, IPromptVariables, ISessionPrompt } from '../aecpilotui/model';
6
+ import { PromptVariableType } from '../cvforce/model';
6
7
  export declare class BotClientApi extends BaseApi {
7
8
  private axiosInstance;
8
9
  private getToken;
@@ -64,6 +65,7 @@ export declare class BotClientApi extends BaseApi {
64
65
  getApplicationIdSessionIdPromptVariables(appId: string, sessionId: string): Promise<ISessionPrompt[]>;
65
66
  getApplicationIdPromptVariables(appId: string, params?: {
66
67
  status: number;
68
+ type?: PromptVariableType;
67
69
  }): Promise<IPromptVariables[]>;
68
70
  patchApplicationIdSessionpromptVariablesId(appId: string, sid: string, id: string, params: Partial<ISessionPrompt>): Promise<IPrompt[]>;
69
71
  updateSession(appId: any, sid: string, params: ISessionParam): Promise<string>;
@@ -1,6 +1,6 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import { ApiErrorHandler, BaseApi } from '../base';
3
- import { IKnowledge, IKnowledgeParam, IFileParam, IFile, IUploadParam, IUploadTicket, ISessionParam, ISession, ICommentParam, IChatMessage, IHistory, IApplication, IApplicationParam, IFileNameParam, IResource, IResourceParam, IComposedFile, IAppToken, IEmbeddingData, IAppList, MinioConfig, KnowledgeFileMetadata, KnowledgeFileMetadataParams, IAecModel, IPrompt, ISessionPrompt, IAppGetParam, IPresetApplication, IKnowledgeConfig, IFileData, IFileDataParam, IResourceTokenParam, IResourceToken, IPresetKnowledge, IMetaData, IGeneques, SessionQueryParams, ChatHistoryParams } from './model';
3
+ import { IKnowledge, IKnowledgeParam, IFileParam, IFile, IUploadParam, IUploadTicket, ISessionParam, ISession, ICommentParam, IChatMessage, IHistory, IApplication, IApplicationParam, IFileNameParam, IResource, IResourceParam, IComposedFile, IAppToken, IEmbeddingData, IAppList, MinioConfig, KnowledgeFileMetadata, KnowledgeFileMetadataParams, IAecModel, IPrompt, ISessionPrompt, IAppGetParam, IPresetApplication, IKnowledgeConfig, IFileData, IFileDataParam, IResourceTokenParam, IResourceToken, IPresetKnowledge, IMetaData, IGeneques, SessionQueryParams, ChatHistoryParams, PromptVariableType } from './model';
4
4
  import { PageQueryParams } from '../base/model';
5
5
  import { IBaseModel } from '../bot-client/model';
6
6
  export declare class CVForceApi extends BaseApi {
@@ -77,7 +77,8 @@ export declare class CVForceApi extends BaseApi {
77
77
  defaultModel: string;
78
78
  }>;
79
79
  getPrompts(applicationId: string, params?: {
80
- status: number;
80
+ status?: number;
81
+ type?: PromptVariableType;
81
82
  }): Promise<IPrompt[]>;
82
83
  postPrompt(applicationId: string, params: IPrompt): Promise<IPrompt[]>;
83
84
  patchPromptId(applicationId: string, id: string, params: IPrompt): Promise<IPrompt[]>;
@@ -427,6 +427,7 @@ export interface IPrompt {
427
427
  key?: string;
428
428
  name?: string;
429
429
  status?: PromptStatus;
430
+ type?: PromptVariableType;
430
431
  }
431
432
  export interface ISessionPrompt {
432
433
  id?: string;
@@ -434,6 +435,7 @@ export interface ISessionPrompt {
434
435
  name?: string;
435
436
  value: string;
436
437
  status?: PromptStatus;
438
+ type?: PromptVariableType;
437
439
  }
438
440
  export interface IAppGetParam {
439
441
  available?: boolean;
@@ -521,3 +523,7 @@ export interface ChatHistoryParams {
521
523
  pageSize?: number;
522
524
  contextOnly?: boolean;
523
525
  }
526
+ export declare enum PromptVariableType {
527
+ User = "instruction",
528
+ System = "settings"
529
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glodon-aiot/apis",
3
- "version": "3.3.2",
3
+ "version": "3.3.4-beta.1",
4
4
  "author": "glodoncv",
5
5
  "description": "aiot apis",
6
6
  "type": "module",