Update logic-hooks.ts (#15194)

Empty reply configured in knowledge base chat, no content returned when
matched empty content

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Co-authored-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
魏家家
2026-08-10 15:08:30 +08:00
committed by GitHub
parent 73d006fa0e
commit 6f590a7fcd

View File

@@ -300,6 +300,9 @@ export const useSendMessageWithSse = () => {
if (typeof d !== 'boolean') {
setAnswer((prev) => {
const prevAnswer = prev.answer || '';
// Skip final-chunk answer only when prior stream chunks exist (avoids duplicate).
// Empty-response and other single-shot answers arrive with final=true only.
// const currentAnswer = d.final ? '' : d.answer || '';
const currentAnswer =
d.final && prevAnswer ? '' : d.answer || '';