Commit c03a7db6 by archer

perf: 聊天页优化

parent 2cc32d18
......@@ -353,6 +353,7 @@
line-height: 1.6;
letter-spacing: 0.5px;
text-align: justify;
white-space: pre;
pre {
display: block;
width: 100%;
......
......@@ -42,7 +42,7 @@ const Markdown = ({ source, isChatting }: { source: string; isChatting: boolean
</Flex>
<SyntaxHighlighter
style={codeLight as any}
language={match?.[1] || 'bash'}
language={match?.[1]}
PreTag="pre"
{...props}
>
......
......@@ -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(
......
......@@ -300,10 +300,14 @@ const Chat = () => {
></Image>
</Box>
<Box flex={'1 0 0'} w={0} overflowX={'auto'}>
<Markdown
source={item.value}
isChatting={isChatting && index === chatList.length - 1}
/>
{item.obj === 'AI' ? (
<Markdown
source={item.value}
isChatting={isChatting && index === chatList.length - 1}
/>
) : (
<Box whiteSpace={'pre'}>{item.value}</Box>
)}
</Box>
</Flex>
</Box>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment