@blueking/chat-helper 0.0.1-beta.14 → 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.
package/dist/index.d.ts
CHANGED
|
@@ -2468,6 +2468,7 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
|
|
|
2468
2468
|
isCreateLoading: import("vue").Ref<boolean, boolean>;
|
|
2469
2469
|
isUpdateLoading: import("vue").Ref<boolean, boolean>;
|
|
2470
2470
|
isDeleteLoading: import("vue").Ref<boolean, boolean>;
|
|
2471
|
+
isBatchDeleteLoading: import("vue").Ref<boolean, boolean>;
|
|
2471
2472
|
getSessions: () => Promise<void>;
|
|
2472
2473
|
chooseSession: (sessionCode: string, options?: {
|
|
2473
2474
|
loadMessages?: boolean;
|
|
@@ -2478,6 +2479,7 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
|
|
|
2478
2479
|
}) => Promise<void>;
|
|
2479
2480
|
updateSession: (session: import("./session").ISession) => Promise<void>;
|
|
2480
2481
|
deleteSession: (sessionCode: string) => Promise<void>;
|
|
2482
|
+
batchDeleteSessions: (sessionCodes: string[]) => Promise<void>;
|
|
2481
2483
|
postSessionFeedback: (data: import("./session").ISessionFeedback) => Promise<{
|
|
2482
2484
|
sessionCode: string;
|
|
2483
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
|
-
})
|
|
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
|
-
})
|
|
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
|
-
})
|
|
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
|
-
})
|
|
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,
|