Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

unify moderation and annotation's response behavior in message log of chatflow app with other types of app (#14800)

Qunf0fb38fed43c
diff --git a/api/core/app/apps/advanced_chat/generate_task_pipeline.py b/api/core/app/apps/advanced_chat/generate_task_pipeline.py
index 3d6ba5ce374..5dd3ba11c8d 100644
--- a/api/core/app/apps/advanced_chat/generate_task_pipeline.py
+++ b/api/core/app/apps/advanced_chat/generate_task_pipeline.py
@@ -582,6 +582,15 @@ class AdvancedChatAppGenerateTaskPipeline:
session.commit()
yield workflow_finish_resp
+ elif event.stopped_by in (
+ QueueStopEvent.StopBy.INPUT_MODERATION,
+ QueueStopEvent.StopBy.ANNOTATION_REPLY,
+ ):
+ # When hitting input-moderation or annotation-reply, the workflow will not start
+ with Session(db.engine, expire_on_commit=False) as session:
+ # Save message
+ self._save_message(session=session)
+ session.commit()
yield self._message_end_to_stream_response()
break