From cf8e2dd7b655db45111f9508b434442436801a11 Mon Sep 17 00:00:00 2001 From: ChenZhaoYu <790348264@qq.com> Date: Tue, 14 Feb 2023 15:56:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=A4=9A=E4=BC=9A?= =?UTF-8?q?=E8=AF=9D=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/business/Chat/hooks/useChat.ts | 23 ++++++++++++------- src/components/business/Chat/index.vue | 19 +++++++++++++-- src/store/modules/history/index.ts | 9 ++++---- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/components/business/Chat/hooks/useChat.ts b/src/components/business/Chat/hooks/useChat.ts index 270fe5e..7e7ea5e 100644 --- a/src/components/business/Chat/hooks/useChat.ts +++ b/src/components/business/Chat/hooks/useChat.ts @@ -3,14 +3,21 @@ import { useHistoryStore } from '@/store' export function useChat() { const historyStore = useHistoryStore() - function addChat(message: string, args?: { reversal?: boolean; error?: boolean; options?: Chat.ChatOptions }) { - historyStore.addChat({ - dateTime: new Date().toLocaleString(), - message, - reversal: args?.reversal ?? false, - error: args?.error ?? false, - options: args?.options ?? undefined, - }) + function addChat( + message: string, + args?: { reversal?: boolean; error?: boolean; options?: Chat.ChatOptions }, + uuid?: number | null, + ) { + historyStore.addChat( + { + dateTime: new Date().toLocaleString(), + message, + reversal: args?.reversal ?? false, + error: args?.error ?? false, + options: args?.options ?? undefined, + }, + uuid, + ) } function clearChat() { diff --git a/src/components/business/Chat/index.vue b/src/components/business/Chat/index.vue index c22942a..dfdceaf 100644 --- a/src/components/business/Chat/index.vue +++ b/src/components/business/Chat/index.vue @@ -1,5 +1,5 @@