Co-authored-by: 聂政 <niezheng@pjlab.org.cn>
This commit is contained in:
parent
37e2f73909
commit
5e2b3b34e5
6 changed files with 36 additions and 12 deletions
|
|
@ -684,7 +684,9 @@ class AdvancedChatAppGenerateTaskPipeline:
|
|||
)
|
||||
elif isinstance(event, QueueMessageReplaceEvent):
|
||||
# published by moderation
|
||||
yield self._message_cycle_manager._message_replace_to_stream_response(answer=event.text)
|
||||
yield self._message_cycle_manager._message_replace_to_stream_response(
|
||||
answer=event.text, reason=event.reason
|
||||
)
|
||||
elif isinstance(event, QueueAdvancedChatMessageEndEvent):
|
||||
if not graph_runtime_state:
|
||||
raise ValueError("graph runtime state not initialized.")
|
||||
|
|
@ -695,7 +697,8 @@ class AdvancedChatAppGenerateTaskPipeline:
|
|||
if output_moderation_answer:
|
||||
self._task_state.answer = output_moderation_answer
|
||||
yield self._message_cycle_manager._message_replace_to_stream_response(
|
||||
answer=output_moderation_answer
|
||||
answer=output_moderation_answer,
|
||||
reason=QueueMessageReplaceEvent.MessageReplaceReason.OUTPUT_MODERATION,
|
||||
)
|
||||
|
||||
# Save message
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue