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
|
|
@ -126,12 +126,12 @@ class BasedGenerateTaskPipeline:
|
|||
if self._output_moderation_handler:
|
||||
self._output_moderation_handler.stop_thread()
|
||||
|
||||
completion = self._output_moderation_handler.moderation_completion(
|
||||
completion, flagged = self._output_moderation_handler.moderation_completion(
|
||||
completion=completion, public_event=False
|
||||
)
|
||||
|
||||
self._output_moderation_handler = None
|
||||
|
||||
return completion
|
||||
if flagged:
|
||||
return completion
|
||||
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -182,10 +182,12 @@ class MessageCycleManage:
|
|||
from_variable_selector=from_variable_selector,
|
||||
)
|
||||
|
||||
def _message_replace_to_stream_response(self, answer: str) -> MessageReplaceStreamResponse:
|
||||
def _message_replace_to_stream_response(self, answer: str, reason: str = "") -> MessageReplaceStreamResponse:
|
||||
"""
|
||||
Message replace to stream response.
|
||||
:param answer: answer
|
||||
:return:
|
||||
"""
|
||||
return MessageReplaceStreamResponse(task_id=self._application_generate_entity.task_id, answer=answer)
|
||||
return MessageReplaceStreamResponse(
|
||||
task_id=self._application_generate_entity.task_id, answer=answer, reason=reason
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue