From c03a7db63371c8c0abf136306dc369c337029ff4 Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Sun, 5 Mar 2023 13:16:56 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E8=81=8A=E5=A4=A9=E9=A1=B5=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Markdown/index.module.scss | 1 + src/components/Markdown/index.tsx | 2 +- src/pages/api/chat/chatGpt.ts | 1 - src/pages/chat/index.tsx | 12 ++++++++---- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/components/Markdown/index.module.scss b/src/components/Markdown/index.module.scss index 44e047a36..a15fc1198 100644 --- a/src/components/Markdown/index.module.scss +++ b/src/components/Markdown/index.module.scss @@ -353,6 +353,7 @@ line-height: 1.6; letter-spacing: 0.5px; text-align: justify; + white-space: pre; pre { display: block; width: 100%; diff --git a/src/components/Markdown/index.tsx b/src/components/Markdown/index.tsx index 27a891f7f..c112cf934 100644 --- a/src/components/Markdown/index.tsx +++ b/src/components/Markdown/index.tsx @@ -42,7 +42,7 @@ const Markdown = ({ source, isChatting }: { source: string; isChatting: boolean diff --git a/src/pages/api/chat/chatGpt.ts b/src/pages/api/chat/chatGpt.ts index ded6787b4..4fda08656 100644 --- a/src/pages/api/chat/chatGpt.ts +++ b/src/pages/api/chat/chatGpt.ts @@ -50,7 +50,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) content: item.value }) ); - // 获取 chatAPI const chatAPI = getOpenAIApi(userApiKey); const chatResponse = await chatAPI.createChatCompletion( diff --git a/src/pages/chat/index.tsx b/src/pages/chat/index.tsx index b84f57b44..72f01f279 100644 --- a/src/pages/chat/index.tsx +++ b/src/pages/chat/index.tsx @@ -300,10 +300,14 @@ const Chat = () => { > - + {item.obj === 'AI' ? ( + + ) : ( + {item.value} + )}