Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

答案内容展示的时候,内容重复展示问题 #7

Open
nigulasikk opened this issue Jan 12, 2024 · 1 comment
Open

答案内容展示的时候,内容重复展示问题 #7

nigulasikk opened this issue Jan 12, 2024 · 1 comment

Comments

@nigulasikk
Copy link

后端返回的流式数据 是增量的 ,前端处理字符串的时候拿最后一个结果就行了。 目前 join字符串的方式会导致显示内容重复

更改后的代码
image

@nigulasikk
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant