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} + )}