@blueking/chat-helper 0.0.1-beta.13 → 0.0.1-beta.15

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.
@@ -51,6 +51,7 @@ export interface IAgentCommandComponentApi {
51
51
  }
52
52
  export interface IAgentInfo {
53
53
  agentName?: string;
54
+ resources?: IAgentResources;
54
55
  saasUrl?: string;
55
56
  chatGroup?: {
56
57
  enabled: boolean;
@@ -69,6 +70,7 @@ export interface IAgentInfo {
69
70
  }
70
71
  export interface IAgentInfoApi {
71
72
  agent_name: string;
73
+ resources?: IAgentResources;
72
74
  saas_url?: string;
73
75
  chat_group?: {
74
76
  enabled: boolean;
@@ -85,3 +87,15 @@ export interface IAgentInfoApi {
85
87
  content?: IMessage[];
86
88
  };
87
89
  }
90
+ export interface IAgentResourceItem {
91
+ code: string;
92
+ icon: null | string;
93
+ id: null | number;
94
+ name: string;
95
+ }
96
+ export interface IAgentResources {
97
+ command?: IAgentResourceItem[];
98
+ knowledgebase?: IAgentResourceItem[];
99
+ mcp?: IAgentResourceItem[];
100
+ tool?: IAgentResourceItem[];
101
+ }
@@ -11,6 +11,32 @@ import type { IAgentInfo } from './type';
11
11
  export declare const useAgent: (mediator: IMediatorModule, protocol: ISSEProtocol) => {
12
12
  info: import("vue").Ref<{
13
13
  agentName?: string;
14
+ resources?: {
15
+ command?: {
16
+ code: string;
17
+ icon: null | string;
18
+ id: null | number;
19
+ name: string;
20
+ }[];
21
+ knowledgebase?: {
22
+ code: string;
23
+ icon: null | string;
24
+ id: null | number;
25
+ name: string;
26
+ }[];
27
+ mcp?: {
28
+ code: string;
29
+ icon: null | string;
30
+ id: null | number;
31
+ name: string;
32
+ }[];
33
+ tool?: {
34
+ code: string;
35
+ icon: null | string;
36
+ id: null | number;
37
+ name: string;
38
+ }[];
39
+ };
14
40
  saasUrl?: string;
15
41
  chatGroup?: {
16
42
  enabled: boolean;
@@ -272,6 +298,32 @@ export declare const useAgent: (mediator: IMediatorModule, protocol: ISSEProtoco
272
298
  };
273
299
  }, IAgentInfo | {
274
300
  agentName?: string;
301
+ resources?: {
302
+ command?: {
303
+ code: string;
304
+ icon: null | string;
305
+ id: null | number;
306
+ name: string;
307
+ }[];
308
+ knowledgebase?: {
309
+ code: string;
310
+ icon: null | string;
311
+ id: null | number;
312
+ name: string;
313
+ }[];
314
+ mcp?: {
315
+ code: string;
316
+ icon: null | string;
317
+ id: null | number;
318
+ name: string;
319
+ }[];
320
+ tool?: {
321
+ code: string;
322
+ icon: null | string;
323
+ id: null | number;
324
+ name: string;
325
+ }[];
326
+ };
275
327
  saasUrl?: string;
276
328
  chatGroup?: {
277
329
  enabled: boolean;
@@ -63,6 +63,7 @@
63
63
  staff: data.chat_group.staff,
64
64
  username: data.chat_group.username
65
65
  } : undefined,
66
- saasUrl: data === null || data === void 0 ? void 0 : data.saas_url
66
+ saasUrl: data === null || data === void 0 ? void 0 : data.saas_url,
67
+ resources: data === null || data === void 0 ? void 0 : data.resources
67
68
  };
68
69
  };
package/dist/index.d.ts CHANGED
@@ -13,6 +13,32 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
13
13
  agent: {
14
14
  info: import("vue").Ref<{
15
15
  agentName?: string;
16
+ resources?: {
17
+ command?: {
18
+ code: string;
19
+ icon: null | string;
20
+ id: null | number;
21
+ name: string;
22
+ }[];
23
+ knowledgebase?: {
24
+ code: string;
25
+ icon: null | string;
26
+ id: null | number;
27
+ name: string;
28
+ }[];
29
+ mcp?: {
30
+ code: string;
31
+ icon: null | string;
32
+ id: null | number;
33
+ name: string;
34
+ }[];
35
+ tool?: {
36
+ code: string;
37
+ icon: null | string;
38
+ id: null | number;
39
+ name: string;
40
+ }[];
41
+ };
16
42
  saasUrl?: string;
17
43
  chatGroup?: {
18
44
  enabled: boolean;
@@ -274,6 +300,32 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
274
300
  };
275
301
  }, import("./agent").IAgentInfo | {
276
302
  agentName?: string;
303
+ resources?: {
304
+ command?: {
305
+ code: string;
306
+ icon: null | string;
307
+ id: null | number;
308
+ name: string;
309
+ }[];
310
+ knowledgebase?: {
311
+ code: string;
312
+ icon: null | string;
313
+ id: null | number;
314
+ name: string;
315
+ }[];
316
+ mcp?: {
317
+ code: string;
318
+ icon: null | string;
319
+ id: null | number;
320
+ name: string;
321
+ }[];
322
+ tool?: {
323
+ code: string;
324
+ icon: null | string;
325
+ id: null | number;
326
+ name: string;
327
+ }[];
328
+ };
277
329
  saasUrl?: string;
278
330
  chatGroup?: {
279
331
  enabled: boolean;
@@ -2416,6 +2468,7 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
2416
2468
  isCreateLoading: import("vue").Ref<boolean, boolean>;
2417
2469
  isUpdateLoading: import("vue").Ref<boolean, boolean>;
2418
2470
  isDeleteLoading: import("vue").Ref<boolean, boolean>;
2471
+ isBatchDeleteLoading: import("vue").Ref<boolean, boolean>;
2419
2472
  getSessions: () => Promise<void>;
2420
2473
  chooseSession: (sessionCode: string, options?: {
2421
2474
  loadMessages?: boolean;
@@ -2426,6 +2479,7 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
2426
2479
  }) => Promise<void>;
2427
2480
  updateSession: (session: import("./session").ISession) => Promise<void>;
2428
2481
  deleteSession: (sessionCode: string) => Promise<void>;
2482
+ batchDeleteSessions: (sessionCodes: string[]) => Promise<void>;
2429
2483
  postSessionFeedback: (data: import("./session").ISessionFeedback) => Promise<{
2430
2484
  sessionCode: string;
2431
2485
  sessionContentIds: number[];
@@ -1877,6 +1877,7 @@ export declare const useSession: (mediator: IMediatorModule) => {
1877
1877
  isCreateLoading: import("vue").Ref<boolean, boolean>;
1878
1878
  isUpdateLoading: import("vue").Ref<boolean, boolean>;
1879
1879
  isDeleteLoading: import("vue").Ref<boolean, boolean>;
1880
+ isBatchDeleteLoading: import("vue").Ref<boolean, boolean>;
1880
1881
  getSessions: () => Promise<void>;
1881
1882
  chooseSession: (sessionCode: string, options?: {
1882
1883
  loadMessages?: boolean;
@@ -1887,6 +1888,7 @@ export declare const useSession: (mediator: IMediatorModule) => {
1887
1888
  }) => Promise<void>;
1888
1889
  updateSession: (session: ISession) => Promise<void>;
1889
1890
  deleteSession: (sessionCode: string) => Promise<void>;
1891
+ batchDeleteSessions: (sessionCodes: string[]) => Promise<void>;
1890
1892
  postSessionFeedback: (data: ISessionFeedback) => Promise<{
1891
1893
  sessionCode: string;
1892
1894
  sessionContentIds: number[];
@@ -92,6 +92,7 @@ import { ref } from 'vue';
92
92
  const isCreateLoading = ref(false);
93
93
  const isUpdateLoading = ref(false);
94
94
  const isDeleteLoading = ref(false);
95
+ const isBatchDeleteLoading = ref(false);
95
96
  const isRenameLoading = ref(false);
96
97
  /**
97
98
  * 更新 list 中的 session,并同步更新 current
@@ -111,7 +112,7 @@ import { ref } from 'vue';
111
112
  isListLoading.value = true;
112
113
  return (_mediator_http = mediator.http) === null || _mediator_http === void 0 ? void 0 : _mediator_http.session.getSessions().then((res)=>{
113
114
  list.value = res;
114
- })['finally'](()=>{
115
+ }).finally(()=>{
115
116
  isListLoading.value = false;
116
117
  });
117
118
  };
@@ -151,7 +152,7 @@ import { ref } from 'vue';
151
152
  isCurrentLoading.value = true;
152
153
  return (_mediator_http = mediator.http) === null || _mediator_http === void 0 ? void 0 : _mediator_http.session.getSession(sessionCode).then((res)=>{
153
154
  current.value = res;
154
- })['finally'](()=>{
155
+ }).finally(()=>{
155
156
  isCurrentLoading.value = false;
156
157
  });
157
158
  };
@@ -187,7 +188,7 @@ import { ref } from 'vue';
187
188
  isUpdateLoading.value = true;
188
189
  return (_mediator_http = mediator.http) === null || _mediator_http === void 0 ? void 0 : _mediator_http.session.modifySession(session).then((res)=>{
189
190
  updateSessionInList(res);
190
- })['finally'](()=>{
191
+ }).finally(()=>{
191
192
  isUpdateLoading.value = false;
192
193
  });
193
194
  };
@@ -211,6 +212,36 @@ import { ref } from 'vue';
211
212
  };
212
213
  }();
213
214
  /**
215
+ * 批量删除会话
216
+ * @param sessionCodes - 要删除的会话编码列表
217
+ */ const batchDeleteSessions = function() {
218
+ var _ref = _async_to_generator(function*(sessionCodes) {
219
+ if (sessionCodes.length === 0) return;
220
+ isBatchDeleteLoading.value = true;
221
+ try {
222
+ var _mediator_http;
223
+ yield (_mediator_http = mediator.http) === null || _mediator_http === void 0 ? void 0 : _mediator_http.session.batchDeleteSessions(sessionCodes);
224
+ const deletedSet = new Set(sessionCodes);
225
+ list.value = list.value.filter((item)=>!deletedSet.has(item.sessionCode));
226
+ if (current.value && deletedSet.has(current.value.sessionCode)) {
227
+ if (list.value.length > 0) {
228
+ yield chooseSession(list.value[0].sessionCode);
229
+ } else {
230
+ current.value = null;
231
+ if (mediator.message) {
232
+ mediator.message.list.value = [];
233
+ }
234
+ }
235
+ }
236
+ } finally{
237
+ isBatchDeleteLoading.value = false;
238
+ }
239
+ });
240
+ return function batchDeleteSessions(sessionCodes) {
241
+ return _ref.apply(this, arguments);
242
+ };
243
+ }();
244
+ /**
214
245
  * 提交会话反馈,sessionContentIds 只需要传 user 对应的 sessionContentId
215
246
  * @param data - ISessionFeedback
216
247
  */ const postSessionFeedback = (data)=>{
@@ -231,7 +262,7 @@ import { ref } from 'vue';
231
262
  sessionCode: res.sessionCode,
232
263
  sessionName: res.sessionName
233
264
  });
234
- })['finally'](()=>{
265
+ }).finally(()=>{
235
266
  isRenameLoading.value = false;
236
267
  });
237
268
  };
@@ -250,6 +281,7 @@ import { ref } from 'vue';
250
281
  isCreateLoading.value = false;
251
282
  isUpdateLoading.value = false;
252
283
  isDeleteLoading.value = false;
284
+ isBatchDeleteLoading.value = false;
253
285
  isRenameLoading.value = false;
254
286
  };
255
287
  return {
@@ -260,12 +292,14 @@ import { ref } from 'vue';
260
292
  isCreateLoading,
261
293
  isUpdateLoading,
262
294
  isDeleteLoading,
295
+ isBatchDeleteLoading,
263
296
  getSessions,
264
297
  chooseSession,
265
298
  getSession,
266
299
  createSession,
267
300
  updateSession,
268
301
  deleteSession,
302
+ batchDeleteSessions,
269
303
  postSessionFeedback,
270
304
  getSessionFeedbackReasons,
271
305
  renameSession,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/chat-helper",
3
- "version": "0.0.1-beta.13",
3
+ "version": "0.0.1-beta.15",
4
4
  "description": "",
5
5
  "main": "./dist/index.ts.js",
6
6
  "types": "./dist/index.d.ts",