@glodon-aiot/agent-cli-sdk 2.4.7 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +128 -41
  2. package/dist/agent-cli-sdk.js +28505 -30335
  3. package/dist/agent-cli-sdk.umd.cjs +113 -123
  4. package/dist/src/AgentSession.d.ts +4 -3
  5. package/dist/src/BotClient.d.ts +7 -5
  6. package/dist/src/DialogSession.d.ts +4 -3
  7. package/dist/src/Session.d.ts +70 -16
  8. package/dist/src/api/fetchEventSource/fetch.d.ts +1 -1
  9. package/dist/src/api/fetchEventSource/index.d.ts +1 -1
  10. package/package.json +13 -22
  11. package/dist/cdn/agent-cli-sdk.js +0 -32945
  12. package/dist/cdn/agent-cli-sdk.umd.cjs +0 -140
  13. package/dist/cdn/src/AgentPlugin.d.ts +0 -17
  14. package/dist/cdn/src/AgentSession.d.ts +0 -8
  15. package/dist/cdn/src/BotClient.d.ts +0 -46
  16. package/dist/cdn/src/Config.d.ts +0 -32
  17. package/dist/cdn/src/DialogSession.d.ts +0 -21
  18. package/dist/cdn/src/EventBus.d.ts +0 -23
  19. package/dist/cdn/src/Logger.d.ts +0 -12
  20. package/dist/cdn/src/PayloadTypes.d.ts +0 -84
  21. package/dist/cdn/src/Session.d.ts +0 -156
  22. package/dist/cdn/src/__ tests __/AgentClient.spec.d.ts +0 -1
  23. package/dist/cdn/src/__ tests __/AgentSession.spec.d.ts +0 -1
  24. package/dist/cdn/src/__ tests __/DialogClient.spec.d.ts +0 -1
  25. package/dist/cdn/src/api/fetchEventSource/fetch.d.ts +0 -44
  26. package/dist/cdn/src/api/fetchEventSource/index.d.ts +0 -1
  27. package/dist/cdn/src/api/fetchEventSource/parse.d.ts +0 -36
  28. package/dist/cdn/src/api/index.d.ts +0 -2
  29. package/dist/cdn/src/index.d.ts +0 -5
  30. package/dist/cdn/src/utils.d.ts +0 -4
  31. package/dist/es/AgentPlugin.mjs +0 -20
  32. package/dist/es/AgentSession.mjs +0 -243
  33. package/dist/es/BotClient.mjs +0 -242
  34. package/dist/es/Config.mjs +0 -34
  35. package/dist/es/DialogSession.mjs +0 -281
  36. package/dist/es/EventBus.mjs +0 -64
  37. package/dist/es/Logger.mjs +0 -31
  38. package/dist/es/PayloadTypes.mjs +0 -4
  39. package/dist/es/Session.mjs +0 -527
  40. package/dist/es/_virtual/_commonjsHelpers.mjs +0 -4
  41. package/dist/es/_virtual/index.mjs +0 -4
  42. package/dist/es/_virtual/index2.mjs +0 -4
  43. package/dist/es/_virtual/index3.mjs +0 -4
  44. package/dist/es/_virtual/minio-zj.mjs +0 -4
  45. package/dist/es/api/fetchEventSource/fetch.mjs +0 -112
  46. package/dist/es/api/fetchEventSource/parse.mjs +0 -97
  47. package/dist/es/api/index.mjs +0 -48
  48. package/dist/es/index.mjs +0 -11
  49. package/dist/es/node_modules/@glodon-aiot/minio/dist/minio-zj.mjs +0 -26485
  50. package/dist/es/node_modules/@socket.io/component-emitter/lib/esm/index.mjs +0 -54
  51. package/dist/es/node_modules/base64-js/index.mjs +0 -47
  52. package/dist/es/node_modules/buffer/index.mjs +0 -927
  53. package/dist/es/node_modules/engine.io-client/build/esm/contrib/has-cors.mjs +0 -9
  54. package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseqs.mjs +0 -18
  55. package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseuri.mjs +0 -24
  56. package/dist/es/node_modules/engine.io-client/build/esm/contrib/yeast.mjs +0 -19
  57. package/dist/es/node_modules/engine.io-client/build/esm/globalThis.browser.mjs +0 -4
  58. package/dist/es/node_modules/engine.io-client/build/esm/socket.mjs +0 -317
  59. package/dist/es/node_modules/engine.io-client/build/esm/transport.mjs +0 -113
  60. package/dist/es/node_modules/engine.io-client/build/esm/transports/index.mjs +0 -11
  61. package/dist/es/node_modules/engine.io-client/build/esm/transports/polling.mjs +0 -273
  62. package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket-constructor.browser.mjs +0 -8
  63. package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket.mjs +0 -87
  64. package/dist/es/node_modules/engine.io-client/build/esm/transports/webtransport.mjs +0 -52
  65. package/dist/es/node_modules/engine.io-client/build/esm/transports/xmlhttprequest.browser.mjs +0 -21
  66. package/dist/es/node_modules/engine.io-client/build/esm/util.mjs +0 -23
  67. package/dist/es/node_modules/engine.io-parser/build/esm/commons.mjs +0 -21
  68. package/dist/es/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.mjs +0 -14
  69. package/dist/es/node_modules/engine.io-parser/build/esm/decodePacket.browser.mjs +0 -39
  70. package/dist/es/node_modules/engine.io-parser/build/esm/encodePacket.browser.mjs +0 -28
  71. package/dist/es/node_modules/engine.io-parser/build/esm/index.mjs +0 -105
  72. package/dist/es/node_modules/ieee754/index.mjs +0 -28
  73. package/dist/es/node_modules/js-base64/base64.mjs +0 -31
  74. package/dist/es/node_modules/socket.io-client/build/esm/contrib/backo2.mjs +0 -26
  75. package/dist/es/node_modules/socket.io-client/build/esm/index.mjs +0 -25
  76. package/dist/es/node_modules/socket.io-client/build/esm/manager.mjs +0 -242
  77. package/dist/es/node_modules/socket.io-client/build/esm/on.mjs +0 -8
  78. package/dist/es/node_modules/socket.io-client/build/esm/socket.mjs +0 -608
  79. package/dist/es/node_modules/socket.io-client/build/esm/url.mjs +0 -19
  80. package/dist/es/node_modules/socket.io-parser/build/esm/binary.mjs +0 -52
  81. package/dist/es/node_modules/socket.io-parser/build/esm/index.mjs +0 -203
  82. package/dist/es/node_modules/socket.io-parser/build/esm/is-binary.mjs +0 -26
  83. package/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +0 -6
  84. package/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +0 -10
  85. package/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +0 -9
  86. package/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +0 -19
  87. package/dist/es/packages/apis/dist/es/aecpilot/model.mjs +0 -4
  88. package/dist/es/packages/apis/dist/es/aecpilotui/index.mjs +0 -8
  89. package/dist/es/packages/apis/dist/es/agentcliui/index.mjs +0 -8
  90. package/dist/es/packages/apis/dist/es/base/index.mjs +0 -154
  91. package/dist/es/packages/apis/dist/es/cvforce/index.mjs +0 -431
  92. package/dist/es/packages/apis/dist/es/cvforce/model.mjs +0 -5
  93. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +0 -1
  94. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +0 -3
  95. package/dist/es/utils.mjs +0 -11
  96. package/dist/lib/index.js +0 -126
@@ -1,431 +0,0 @@
1
- import h from "axios";
2
- import { BaseApi as d } from "../base/index.mjs";
3
- import { m as c } from "../../../../../node_modules/@glodon-aiot/minio/dist/minio-zj.mjs";
4
- var e = (a, t, n) => new Promise((i, r) => {
5
- var l = (s) => {
6
- try {
7
- u(n.next(s));
8
- } catch (o) {
9
- r(o);
10
- }
11
- }, p = (s) => {
12
- try {
13
- u(n.throw(s));
14
- } catch (o) {
15
- r(o);
16
- }
17
- }, u = (s) => s.done ? i(s.value) : Promise.resolve(s.value).then(l, p);
18
- u((n = n.apply(a, t)).next());
19
- });
20
- class m extends d {
21
- constructor(t, n) {
22
- super(t != null ? t : h.create(), n);
23
- }
24
- getKnowledge(t, n) {
25
- return e(this, null, function* () {
26
- return this.get("/knowledge", {
27
- docId: t,
28
- name: n
29
- });
30
- });
31
- }
32
- postKnowledge(t) {
33
- return e(this, null, function* () {
34
- return this.post("/knowledge", t);
35
- });
36
- }
37
- getKnowledgeId(t) {
38
- return e(this, null, function* () {
39
- return this.get(`/knowledge/${t}`);
40
- });
41
- }
42
- patchKnowledgeId(t, n) {
43
- return e(this, null, function* () {
44
- return this.patch(`/knowledge/${t}`, n);
45
- });
46
- }
47
- delKnowledgeId(t) {
48
- return e(this, null, function* () {
49
- return this.delete(`/knowledge/${t}`);
50
- });
51
- }
52
- getKnowledgeIdFile(t) {
53
- return e(this, null, function* () {
54
- return this.get(`/knowledge/${t}/file`);
55
- });
56
- }
57
- getKnowledgeIdFileList(t, n) {
58
- return e(this, null, function* () {
59
- return this.listPaged(`/knowledge/${t}/file`, n);
60
- });
61
- }
62
- postKnowledgeIdFile(t, n) {
63
- return e(this, null, function* () {
64
- return this.post(`/knowledge/${t}/file`, n);
65
- });
66
- }
67
- getUploadTicket(t) {
68
- return e(this, null, function* () {
69
- return this.get("/upload/ticket", t);
70
- });
71
- }
72
- delKnowledgeIdFileFid(t, n) {
73
- return e(this, null, function* () {
74
- return this.delete(`/knowledge/${t}/file/${n}`);
75
- });
76
- }
77
- patchKnowledgeIdFileFid(t, n, i) {
78
- return e(this, null, function* () {
79
- return this.patch(`/knowledge/${t}/file/${n}`, i);
80
- });
81
- }
82
- listSessions(t, n) {
83
- return e(this, null, function* () {
84
- return this.get(`/application/${t}/sessionsa`, n);
85
- });
86
- }
87
- postSession(t, n) {
88
- return e(this, null, function* () {
89
- return this.post(`/application/${t}/sessions`, n);
90
- });
91
- }
92
- getSession(t, n) {
93
- return e(this, null, function* () {
94
- return this.get(`/application/${t}/sessions/${n}`);
95
- });
96
- }
97
- patchSessionsId(t, n, i) {
98
- return e(this, null, function* () {
99
- return this.patch(`/application/${t}/sessions/${n}`, i);
100
- });
101
- }
102
- delSessionsId(t, n) {
103
- return e(this, null, function* () {
104
- return this.delete(`/application/${t}/sessions/${n}`);
105
- });
106
- }
107
- getSessionKnowledgeFile(t, n, i) {
108
- return e(this, null, function* () {
109
- return this.get(`/application/${t}session/${n}/file/${i}`);
110
- });
111
- }
112
- postSessionKnowledgeFile(t, n, i) {
113
- return e(this, null, function* () {
114
- return this.post(`/application/${t}session/${n}/file`, i);
115
- });
116
- }
117
- postComments(t) {
118
- return e(this, null, function* () {
119
- return this.post("/comments", t);
120
- });
121
- }
122
- /**
123
- * 查询会话记录
124
- * 规则:
125
- * 1. startTime + pageSize:向后查询
126
- * 2. startTime + pageSize:向前查询
127
- * 3. startTIme + endTime :查询区间(忽略pageSize)
128
- * 4. pageSize 必须是偶数,问答必须一同查询。不严谨,但前端没有办法😭
129
- * 5. 这里的time对应的是对话记录里的messageTime字段,该字段只精确到秒,并不严谨,导致规则4的出现
130
- **/
131
- getChatHistorySessionId(t, n, i) {
132
- return e(this, null, function* () {
133
- return this.get(`application/${t}/chatHistory/${n}`, i);
134
- });
135
- }
136
- postChatHistorySessionId(t, n) {
137
- return e(this, null, function* () {
138
- return this.post(`/chatHistory/${t}`, n);
139
- });
140
- }
141
- getApplications(t) {
142
- return e(this, null, function* () {
143
- return this.get("/applications", t);
144
- });
145
- }
146
- postApplication(t) {
147
- return e(this, null, function* () {
148
- return this.post("/applications", t);
149
- });
150
- }
151
- getApplicationId(t) {
152
- return e(this, null, function* () {
153
- return this.get(`/applications/${t}`);
154
- });
155
- }
156
- patchApplicationId(t, n) {
157
- return e(this, null, function* () {
158
- return this.patch(`/applications/${t}`, n);
159
- });
160
- }
161
- delApplicationId(t) {
162
- return e(this, null, function* () {
163
- return this.delete(`/applications/${t}`);
164
- });
165
- }
166
- getApplicationIdSessions(t) {
167
- return e(this, null, function* () {
168
- return this.get(`/applications/${t}/session`);
169
- });
170
- }
171
- patchFileId(t, n) {
172
- return e(this, null, function* () {
173
- return this.patch(`/file/${t}`, n);
174
- });
175
- }
176
- getCvforceResource(t) {
177
- return e(this, null, function* () {
178
- return this.get("/cvforce/resource", t);
179
- });
180
- }
181
- postKnowledgeIdComposedFiles(t, n) {
182
- return e(this, null, function* () {
183
- return this.post(`/knowledge/${t}/composedFiles`, n);
184
- });
185
- }
186
- getTokensApplicationId(t, n) {
187
- return e(this, null, function* () {
188
- return this.get(`/tokens/${t}`, n);
189
- });
190
- }
191
- getTokens(t) {
192
- return e(this, null, function* () {
193
- return this.get("/tokens", t);
194
- });
195
- }
196
- uploadMinioFile(t, n) {
197
- return e(this, null, function* () {
198
- return new Promise((i, r) => {
199
- const l = new FileReader();
200
- l.readAsArrayBuffer(n), l.onload = (p) => {
201
- c.initMinio({
202
- endPoint: t.endpoints[0],
203
- useSSL: t.useSSL,
204
- accessKey: t.accessKey,
205
- secretKey: t.secretKey
206
- });
207
- const u = Buffer.from(p.target.result), s = {
208
- "Content-Type": "application/octet-stream"
209
- };
210
- c.putObjectBuffer(t.bucket, t.fileKeys[0], u, s, (o) => {
211
- if (o)
212
- throw console.error(o), Error(o);
213
- i(t.fileKeys[0]);
214
- });
215
- };
216
- });
217
- });
218
- }
219
- uploadFile(t, n) {
220
- return e(this, null, function* () {
221
- const i = {
222
- files: [n.name],
223
- isv: "minio",
224
- knowledgeId: t
225
- };
226
- return this.getUploadTicket(i).then((r) => this.uploadMinioFile(r.minio, n)).catch((r) => {
227
- throw Error(r);
228
- });
229
- });
230
- }
231
- uploadFiles(t, n) {
232
- return e(this, null, function* () {
233
- const i = {
234
- files: n.map((r) => r.name),
235
- isv: "minio",
236
- knowledgeId: t
237
- };
238
- return this.getUploadTicket(i).then((r) => Promise.all(n.map((l) => this.uploadMinioFile(r.minio, l)))).catch((r) => {
239
- throw Error(r);
240
- });
241
- });
242
- }
243
- getAecModels() {
244
- return e(this, null, function* () {
245
- return this.get("/aecModels");
246
- });
247
- }
248
- postTextFilter(t) {
249
- return e(this, null, function* () {
250
- return this.post("/textFilter", t);
251
- });
252
- }
253
- getTenantModel() {
254
- return e(this, null, function* () {
255
- return this.get("/tenantModel");
256
- });
257
- }
258
- // 获取prompt变量列表
259
- getPrompts(t, n) {
260
- return e(this, null, function* () {
261
- return this.get(`application/${t}/promptVariables`, n);
262
- });
263
- }
264
- // 新增prompt
265
- postPrompt(t, n) {
266
- return e(this, null, function* () {
267
- return this.post(`application/${t}/promptVariables`, n);
268
- });
269
- }
270
- // 修改单个prompt
271
- patchPromptId(t, n, i) {
272
- return e(this, null, function* () {
273
- return this.patch(`application/${t}/promptVariables/${n}`, i);
274
- });
275
- }
276
- // 删除单个prompt
277
- delPromptId(t, n) {
278
- return e(this, null, function* () {
279
- return this.delete(`application/${t}/promptVariables/${n}`);
280
- });
281
- }
282
- // 获取session下的prompt变量列表
283
- getSessionPrompts(t) {
284
- return e(this, null, function* () {
285
- return this.get(`session/${t}/promptVariables`);
286
- });
287
- }
288
- // 修改session单个prompt
289
- patchSessionPromptId(t, n, i) {
290
- return e(this, null, function* () {
291
- return this.patch(`session/${n}/promptVariables/${t}`, i);
292
- });
293
- }
294
- getApplicationIdSessionIdPromptVariables(t, n) {
295
- return e(this, null, function* () {
296
- return this.get(`/application/${t}/session/${n}/promptVariables`);
297
- });
298
- }
299
- patchApplicationIdSessionpromptVariablesId(t, n, i, r) {
300
- return e(this, null, function* () {
301
- return this.patch(`/application/${t}/session/${n}/promptVariables/${i}`, r);
302
- });
303
- }
304
- // 查询预置应用
305
- getPresetApplication(t) {
306
- return e(this, null, function* () {
307
- return this.get("presetApplication", t);
308
- });
309
- }
310
- // 新建知识库配置
311
- postKnowledgeConfig(t) {
312
- return e(this, null, function* () {
313
- return this.post("/knowledgeConfig", t);
314
- });
315
- }
316
- // 获取知识库配置
317
- getKnowledgeConfig(t) {
318
- return e(this, null, function* () {
319
- return this.get(`/knowledgeConfig/${t}`);
320
- });
321
- }
322
- // 编辑知识库配置
323
- patchKnowledgeConfig(t, n) {
324
- return e(this, null, function* () {
325
- return this.patch(`/knowledgeConfig/${t}`, n);
326
- });
327
- }
328
- getKnowledgeIdFileId(t, n) {
329
- return e(this, null, function* () {
330
- return this.get(`/knowledge/${t}/file/${n}`);
331
- });
332
- }
333
- getKnowledgeIdFileIdData(t, n, i) {
334
- return e(this, null, function* () {
335
- return this.listPaged(`/knowledge/${t}/file/${n}/data`, i);
336
- });
337
- }
338
- postKnowledgeIdFileIdData(t, n, i) {
339
- return e(this, null, function* () {
340
- return this.post(`/knowledge/${t}/file/${n}/data`, {
341
- data: i
342
- });
343
- });
344
- }
345
- patchKnowledgeIdFileIdData(t, n, i, r) {
346
- return e(this, null, function* () {
347
- return this.patch(`/knowledge/${t}/file/${n}/data/${i}`, {
348
- data: r
349
- });
350
- });
351
- }
352
- delKnowledgeIdFileIdDataDid(t, n, i) {
353
- return e(this, null, function* () {
354
- return this.delete(`/knowledge/${t}/file/${n}/data/${i}`);
355
- });
356
- }
357
- // 获取预置知识库
358
- getPresetKnowledge(t) {
359
- return e(this, null, function* () {
360
- return this.get("/presetKnowledge", t);
361
- });
362
- }
363
- patchSessionsIdContext(t) {
364
- return e(this, null, function* () {
365
- return this.patch(`/sessions/${t}/context`, {});
366
- });
367
- }
368
- postResourceToken(t) {
369
- return e(this, null, function* () {
370
- return this.post("/resourceToken", t);
371
- });
372
- }
373
- // 应用嵌入接口
374
- getApplicationIdSession(t) {
375
- return e(this, null, function* () {
376
- return this.get(`/application/${t}/session`);
377
- });
378
- }
379
- patchApplicationIdSessionsIdContext(t, n) {
380
- return e(this, null, function* () {
381
- return this.patch(`/application/${t}/sessions/${n}/context`, {});
382
- });
383
- }
384
- postApplicationIdSessions(t, n) {
385
- return e(this, null, function* () {
386
- return this.post(`/application/${t}/sessions`, n);
387
- });
388
- }
389
- getApplicationIdChatHistorySessionId(t, n) {
390
- return e(this, null, function* () {
391
- return this.get(`/application/${t}/chatHistory/${n}`);
392
- });
393
- }
394
- postApplicationIdChatHistorySessionIdComments(t, n, i) {
395
- return e(this, null, function* () {
396
- return this.post(`/application/${t}/sessions/${n}/comments`, i);
397
- });
398
- }
399
- getApplicationIdPrompts(t, n) {
400
- return e(this, null, function* () {
401
- return this.get(`/application/${t}/promptVariables`, n);
402
- });
403
- }
404
- // 上传知识库内文件的知识引用源文件
405
- postKnowledgeSourceFile(t, n, i) {
406
- return e(this, null, function* () {
407
- return this.post(`/knowledge/${t}/sourceFile/${n}`, i);
408
- });
409
- }
410
- //元数据接口
411
- getMetadata(t) {
412
- return e(this, null, function* () {
413
- return this.get("/metadata", t);
414
- });
415
- }
416
- postGeneques(t) {
417
- return e(this, null, function* () {
418
- return this.post("/geneques", t);
419
- });
420
- }
421
- getBaseModel(t) {
422
- return e(this, null, function* () {
423
- return this.get("/baseModelInfo", {
424
- serviceId: t
425
- });
426
- });
427
- }
428
- }
429
- export {
430
- m as CVForceApi
431
- };
@@ -1,5 +0,0 @@
1
- var t = /* @__PURE__ */ ((e) => (e[e.Robot = 1] = "Robot", e[e.User = 2] = "User", e[e.System = 3] = "System", e))(t || {}), o = /* @__PURE__ */ ((e) => (e[e.Dialog = 0] = "Dialog", e[e.Text = 1] = "Text", e[e.Agent = 2] = "Agent", e[e.All = 3] = "All", e))(o || {});
2
- export {
3
- o as ApplicationTypes,
4
- t as ChatMessageRole
5
- };
@@ -1 +0,0 @@
1
- typeof crypto != "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
@@ -1,3 +0,0 @@
1
- const i = [];
2
- for (let t = 0; t < 256; ++t)
3
- i.push((t + 256).toString(16).slice(1));
package/dist/es/utils.mjs DELETED
@@ -1,11 +0,0 @@
1
- import { fromBase64 as n } from "./node_modules/js-base64/base64.mjs";
2
- const o = (e) => JSON.parse(n(e.split(".")[1])), s = (e) => {
3
- const r = o(e).exp;
4
- return (/* @__PURE__ */ new Date()).valueOf() / 1e3 >= r;
5
- }, t = (e) => e == null ? void 0 : e.replace(/[\r\n]+/gm, ""), i = (e) => e.replace(/\\|\\/g, "");
6
- export {
7
- s as isExpired,
8
- o as parseJWT,
9
- i as removeLeadingAndTrailingBackslashes,
10
- t as removeNewlines
11
- };