|
@@ -218,8 +218,7 @@ export function useChatSession(options: UseChatSessionOptions) {
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
if (currentSessionId.value <= 0) {
|
|
if (currentSessionId.value <= 0) {
|
|
|
- const overview = await AgentWorkApi.getQuestionOverview(userMessages.map(m => m.content).join('\n'));
|
|
|
|
|
- const historyId = (await AgentApi.createChatHistory(overview, currentGroupId.value)).requireData();
|
|
|
|
|
|
|
+ const historyId = (await AgentApi.createChatHistory('新会话', currentGroupId.value)).requireData();
|
|
|
|
|
|
|
|
await addChatHistoryItems(historyId);
|
|
await addChatHistoryItems(historyId);
|
|
|
currentSessionId.value = historyId;
|
|
currentSessionId.value = historyId;
|
|
@@ -227,6 +226,16 @@ export function useChatSession(options: UseChatSessionOptions) {
|
|
|
await events.emitAsync('pager-init', historyId);
|
|
await events.emitAsync('pager-init', historyId);
|
|
|
//移除未持久化的消息
|
|
//移除未持久化的消息
|
|
|
messages.value = messages.value.filter(m => m.isPersisted);
|
|
messages.value = messages.value.filter(m => m.isPersisted);
|
|
|
|
|
+
|
|
|
|
|
+ //异步更新会话摘要
|
|
|
|
|
+ AgentWorkApi.getQuestionOverview(userMessages.map(m => m.content).join('\n')).then(overview => {
|
|
|
|
|
+ const session = sessions.value.find(s => s.id === historyId);
|
|
|
|
|
+ if (session) {
|
|
|
|
|
+ session.summary = overview;
|
|
|
|
|
+ AgentApi.updateChatHistory(historyId, session as AgentChatHistory);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
} else {
|
|
} else {
|
|
|
await addChatHistoryItems(currentSessionId.value);
|
|
await addChatHistoryItems(currentSessionId.value);
|
|
|
}
|
|
}
|