mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
fix: anthropic completion error in blocking mode (#591)
This commit is contained in:
parent
07cde4f8fe
commit
eff115267f
|
@ -69,8 +69,7 @@ class LLMCallbackHandler(BaseCallbackHandler):
|
|||
if not self.conversation_message_task.streaming:
|
||||
self.conversation_message_task.append_message_text(response.generations[0][0].text)
|
||||
self.llm_message.completion = response.generations[0][0].text
|
||||
self.llm_message.completion_tokens = response.llm_output['token_usage']['completion_tokens']
|
||||
else:
|
||||
|
||||
self.llm_message.completion_tokens = self.llm.get_num_tokens(self.llm_message.completion)
|
||||
|
||||
self.conversation_message_task.save_message(self.llm_message)
|
||||
|
|
Loading…
Reference in New Issue
Block a user