mirror of
https://github.com/langgenius/dify.git
synced 2026-09-05 00:31:19 +08:00
fix: update message answer on completion after resume from pause
When a ChatFlow workflow pauses (e.g., Human Input node) after a Question Classifier or Condition Branch, the message is saved with PAUSED status and empty answer. On resume and completion, _handle_advanced_chat_message_ end_event skipped saving the final state because _message_saved_on_pause was True, leaving the message stuck with PAUSED status and no answer. The fix removes the guard so _save_message is always called on completion. _save_message updates the existing message in-place (it does a SELECT by message_id), overwriting the stale PAUSED snapshot with the final answer and NORMAL status. Fixes #38614
This commit is contained in:
parent
12c06a61be
commit
2551ee2d8b
@ -807,10 +807,11 @@ class AdvancedChatAppGenerateTaskPipeline(GraphRuntimeStateSupport):
|
||||
reason=QueueMessageReplaceEvent.MessageReplaceReason.OUTPUT_MODERATION,
|
||||
)
|
||||
|
||||
# Save message unless it has already been persisted on pause.
|
||||
if not self._message_saved_on_pause:
|
||||
with self._database_session() as session:
|
||||
self._save_message(session=session, graph_runtime_state=resolved_state)
|
||||
# Always save the final message state, even if it was already
|
||||
# persisted on pause. The previous snapshot (PAUSED status, empty
|
||||
# answer) must be replaced with the completed answer.
|
||||
with self._database_session() as session:
|
||||
self._save_message(session=session, graph_runtime_state=resolved_state)
|
||||
|
||||
yield self._message_end_to_stream_response()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user