mirror of
https://github.com/langgenius/webapp-text-generator.git
synced 2026-07-25 13:46:05 -04:00
答案内容展示的时候,内容重复展示问题 #2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nigulasikk on GitHub (Jan 12, 2024).
后端返回的流式数据 是增量的 ,前端处理字符串的时候拿最后一个结果就行了。 目前 join字符串的方式会导致显示内容重复
更改后的代码

@nigulasikk commented on GitHub (Jan 12, 2024):
sendCompletionMessage(data, {
onData: (data: string, _isFirstMessage: boolean, { messageId }) => {
tempMessageId = messageId
res.push(data)
// 下面这一行 当前main分支代码: setCompletionRes(res?.join(''))
setCompletionRes(res?.[res?.length - 1])
},