perf: 聊天页优化

This commit is contained in:
archer
2023-03-05 13:16:56 +08:00
parent 2cc32d1806
commit c03a7db633
4 changed files with 10 additions and 6 deletions

View File

@@ -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(

View File

@@ -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>