mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-27 16:33:49 +00:00
perf: 聊天页优化
This commit is contained in:
@@ -353,6 +353,7 @@
|
|||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
letter-spacing: 0.5px;
|
letter-spacing: 0.5px;
|
||||||
text-align: justify;
|
text-align: justify;
|
||||||
|
white-space: pre;
|
||||||
pre {
|
pre {
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@@ -42,7 +42,7 @@ const Markdown = ({ source, isChatting }: { source: string; isChatting: boolean
|
|||||||
</Flex>
|
</Flex>
|
||||||
<SyntaxHighlighter
|
<SyntaxHighlighter
|
||||||
style={codeLight as any}
|
style={codeLight as any}
|
||||||
language={match?.[1] || 'bash'}
|
language={match?.[1]}
|
||||||
PreTag="pre"
|
PreTag="pre"
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
|
@@ -50,7 +50,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||||||
content: item.value
|
content: item.value
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// 获取 chatAPI
|
// 获取 chatAPI
|
||||||
const chatAPI = getOpenAIApi(userApiKey);
|
const chatAPI = getOpenAIApi(userApiKey);
|
||||||
const chatResponse = await chatAPI.createChatCompletion(
|
const chatResponse = await chatAPI.createChatCompletion(
|
||||||
|
@@ -300,10 +300,14 @@ const Chat = () => {
|
|||||||
></Image>
|
></Image>
|
||||||
</Box>
|
</Box>
|
||||||
<Box flex={'1 0 0'} w={0} overflowX={'auto'}>
|
<Box flex={'1 0 0'} w={0} overflowX={'auto'}>
|
||||||
<Markdown
|
{item.obj === 'AI' ? (
|
||||||
source={item.value}
|
<Markdown
|
||||||
isChatting={isChatting && index === chatList.length - 1}
|
source={item.value}
|
||||||
/>
|
isChatting={isChatting && index === chatList.length - 1}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Box whiteSpace={'pre'}>{item.value}</Box>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Box>
|
</Box>
|
||||||
|
Reference in New Issue
Block a user