From 57538495523893e11cb4b9def69bbe50159acfa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E7=9F=B3=E5=A4=B4?= Date: Tue, 23 Jan 2024 20:34:07 +0800 Subject: [PATCH] Refactor RegenerationButton component and reset error message in ChatStore --- .../components/RegenerationButton/index.tsx | 75 ++++++++++--------- src/views/stores/ChatStore.ts | 1 + 2 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/views/components/RegenerationButton/index.tsx b/src/views/components/RegenerationButton/index.tsx index 04acad5..2143e1c 100644 --- a/src/views/components/RegenerationButton/index.tsx +++ b/src/views/components/RegenerationButton/index.tsx @@ -1,43 +1,44 @@ - -import * as React from 'react'; -import { Button } from '@mantine/core'; -import { IconRotateDot } from '@tabler/icons-react'; +import * as React from "react"; +import { Button } from "@mantine/core"; +import { IconRotateDot } from "@tabler/icons-react"; import { observer } from "mobx-react-lite"; import { useMst } from "@/views/stores/RootStore"; - const RegenerationButton = observer(() => { - const { chat } = useMst(); - return (); + const { chat } = useMst(); + return ( + + ); }); -export default RegenerationButton; \ No newline at end of file +export default RegenerationButton; diff --git a/src/views/stores/ChatStore.ts b/src/views/stores/ChatStore.ts index f515008..6fdde0a 100644 --- a/src/views/stores/ChatStore.ts +++ b/src/views/stores/ChatStore.ts @@ -403,6 +403,7 @@ Thinking... self.isLastPage = true; if (reset) { self.messages = [] as any; + self.errorMessage = ""; } if (self.messages.length === 0) { helpMessage(true);