mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 20:48:01 +08:00
fix: missing content if assistant message with tool_calls (#30083)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
8f43629cd8
commit
9be863fefa
@ -188,7 +188,7 @@ class FunctionCallAgentRunner(BaseAgentRunner):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
assistant_message = AssistantPromptMessage(content="", tool_calls=[])
|
assistant_message = AssistantPromptMessage(content=response, tool_calls=[])
|
||||||
if tool_calls:
|
if tool_calls:
|
||||||
assistant_message.tool_calls = [
|
assistant_message.tool_calls = [
|
||||||
AssistantPromptMessage.ToolCall(
|
AssistantPromptMessage.ToolCall(
|
||||||
@ -200,8 +200,6 @@ class FunctionCallAgentRunner(BaseAgentRunner):
|
|||||||
)
|
)
|
||||||
for tool_call in tool_calls
|
for tool_call in tool_calls
|
||||||
]
|
]
|
||||||
else:
|
|
||||||
assistant_message.content = response
|
|
||||||
|
|
||||||
self._current_thoughts.append(assistant_message)
|
self._current_thoughts.append(assistant_message)
|
||||||
|
|
||||||
|
|||||||
@ -251,10 +251,7 @@ class AssistantPromptMessage(PromptMessage):
|
|||||||
|
|
||||||
:return: True if prompt message is empty, False otherwise
|
:return: True if prompt message is empty, False otherwise
|
||||||
"""
|
"""
|
||||||
if not super().is_empty() and not self.tool_calls:
|
return super().is_empty() and not self.tool_calls
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
class SystemPromptMessage(PromptMessage):
|
class SystemPromptMessage(PromptMessage):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user