Skip to content

fix: custom empty_response not shown in streaming chat (Go mode) - #16989

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
euvre:fix/go-empty-response
Jul 16, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
euvre:fix/go-empty-response

Conversation

@euvre

@euvre euvre commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix the issue where a user-configured custom empty_response is not displayed in the chat when no knowledge chunks are retrieved (Go mode).

Root cause: In the Go chat pipeline (internal/service/chat_pipeline.go), the empty_response fallback was sent as a single Final=true result. The streaming handler in chat_session.go ignores the answer text on Final=true results (treating them purely as stream-close signals), so the custom empty_response message was never displayed to the user.

Fix: Mirror the Python dialog_service.py behavior by yielding two results:

  1. Final=false — carries the empty_response text so streaming consumers display it.
  2. Final=true — closes the stream with reference/prompt/TTS metadata, with an empty Answer to avoid duplication in non-streaming accumulation mode.

In the Go chat pipeline, the empty_response fallback was sent as a single
Final=true result. The streaming handler in chat_session.go ignores the
answer text on Final=true results (treats them as stream-close signals),
so the custom empty_response message was never displayed to the user.

Mirror Python dialog_service.py by yielding two results:
1. Final=false with the empty_response text (consumed by streaming)
2. Final=true with empty answer text + reference/prompt/TTS metadata

This fixes the case where a user configures a custom empty_response but
no message appears when no knowledge chunks are retrieved.
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. labels Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 557f4392-bb2d-460f-96fd-d97d2036ff7a

📥 Commits

Reviewing files that changed from the base of the PR and between d8a6cac and b12d016.

📒 Files selected for processing (1)
  • internal/service/chat_pipeline.go
 ___________________________________________________________________
< This refactor is like rearranging furniture during an earthquake. >
 -------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@euvre euvre added the ci Continue Integration label Jul 16, 2026
@wangq8
wangq8 merged commit feba9e1 into infiniflow:main Jul 16, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants