fix: stop completion response not save to db (#351)

pull/354/head
John Wang 3 years ago committed by GitHub
parent 433f8cb57e
commit a11f36ca60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -75,7 +75,11 @@ class LLMCallbackHandler(BaseCallbackHandler):
self.conversation_message_task.save_message(self.llm_message)
def on_llm_new_token(self, token: str, **kwargs: Any) -> None:
self.conversation_message_task.append_message_text(token)
try:
self.conversation_message_task.append_message_text(token)
except ConversationTaskStoppedException as ex:
self.on_llm_error(error=ex)
self.llm_message.completion += token
def on_llm_error(

Loading…
Cancel
Save