diff --git a/src/frontend/src/components/bs-comp/chatComponent/ChatInput.tsx b/src/frontend/src/components/bs-comp/chatComponent/ChatInput.tsx index 6d52cfafb..7607d0114 100644 --- a/src/frontend/src/components/bs-comp/chatComponent/ChatInput.tsx +++ b/src/frontend/src/components/bs-comp/chatComponent/ChatInput.tsx @@ -1,15 +1,16 @@ +import { ClearIcon } from "@/components/bs-icons/clear"; import { FormIcon } from "@/components/bs-icons/form"; import { SendIcon } from "@/components/bs-icons/send"; +import { Button } from "@/components/bs-ui/button"; import { Textarea } from "@/components/bs-ui/input"; import { useToast } from "@/components/bs-ui/toast/use-toast"; import { locationContext } from "@/contexts/locationContext"; +import { PauseIcon } from "@radix-ui/react-icons"; import { useContext, useEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; -import { useMessageStore } from "./messageStore"; import GuideQuestions from "./GuideQuestions"; -import { ClearIcon } from "@/components/bs-icons/clear"; -import { Button } from "@/components/bs-ui/button"; -import { PauseIcon, StopIcon } from "@radix-ui/react-icons"; +import { useMessageStore } from "./messageStore"; +import { formatDate } from "@/util/utils"; export default function ChatInput({ clear, form, stop, questions, inputForm, wsUrl, onBeforSend }) { const { toast } = useToast() @@ -198,6 +199,7 @@ export default function ChatInput({ clear, form, stop, questions, inputForm, wsU const handleWsMessage = (data) => { if (Array.isArray(data) && data.length) return if (data.type === 'start') { + setStoped(false) createWsMsg(data) } else if (data.type === 'stream') { //@ts-ignore @@ -213,13 +215,12 @@ export default function ChatInput({ clear, form, stop, questions, inputForm, wsU thought: data.intermediate_steps || '', messageId: data.message_id, noAccess: false, - liked: 0 + liked: 0, + update_time: formatDate(new Date(), 'yyyy-MM-ddTHH:mm:ss') }, data.type === 'end_cover') } else if (data.type === "close") { setStoped(true) setInputLock({ locked: false, reason: '' }) - } else if (data.type === 'begin') { - setStoped(false) } } diff --git a/src/frontend/src/components/bs-comp/chatComponent/MessageBs.tsx b/src/frontend/src/components/bs-comp/chatComponent/MessageBs.tsx index 67346538a..2899e453c 100644 --- a/src/frontend/src/components/bs-comp/chatComponent/MessageBs.tsx +++ b/src/frontend/src/components/bs-comp/chatComponent/MessageBs.tsx @@ -79,8 +79,8 @@ export default function MessageBs({ data, onUnlike = () => { }, onSource }: { da const chatId = useMessageStore(state => state.chatId) return
{data.sender}
} diff --git a/src/frontend/src/components/bs-comp/chatComponent/MessageUser.tsx b/src/frontend/src/components/bs-comp/chatComponent/MessageUser.tsx index 51ac9480d..81ef6c47f 100644 --- a/src/frontend/src/components/bs-comp/chatComponent/MessageUser.tsx +++ b/src/frontend/src/components/bs-comp/chatComponent/MessageUser.tsx @@ -1,9 +1,9 @@ import { locationContext } from "@/contexts/locationContext"; import { ChatMessageType } from "@/types/chat"; +import { formatStrTime } from "@/util/utils"; import { MagnifyingGlassIcon, Pencil2Icon, ReloadIcon } from "@radix-ui/react-icons"; -import { useContext, useState } from "react"; +import { useContext } from "react"; import { useMessageStore } from "./messageStore"; -import { formatStrTime } from "@/util/utils"; export default function MessageUser({ useName = 'xxx', data }: { data: ChatMessageType }) { const msg = data.message[data.chatKey] @@ -26,8 +26,8 @@ export default function MessageUser({ useName = 'xxx', data }: { data: ChatMessa } return{useName}
} diff --git a/src/frontend/src/components/bs-comp/chatComponent/messageStore.ts b/src/frontend/src/components/bs-comp/chatComponent/messageStore.ts index 61184ab2a..a0d0d3e00 100644 --- a/src/frontend/src/components/bs-comp/chatComponent/messageStore.ts +++ b/src/frontend/src/components/bs-comp/chatComponent/messageStore.ts @@ -1,9 +1,8 @@ -import { message } from '@/components/bs-ui/toast/use-toast'; -import { generateUUID } from '@/components/bs-ui/utils' -import { MessageDB, getChatHistory } from '@/controllers/API' -import { ChatMessageType } from '@/types/chat' -import { cloneDeep } from 'lodash' -import { create } from 'zustand' +import { getChatHistory } from '@/controllers/API'; +import { ChatMessageType } from '@/types/chat'; +import { cloneDeep } from 'lodash'; +import { create } from 'zustand'; +import { formatDate } from '@/util/utils'; /** * 会话消息管理 @@ -138,7 +137,8 @@ export const useMessageStore = create