From d532207d594a8acb197c50c7c88cb47ef152c8e1 Mon Sep 17 00:00:00 2001 From: leslie2046 <253605712@qq.com> Date: Mon, 22 Dec 2025 15:01:01 +0800 Subject: [PATCH 1/5] fix: no content write back to plugin --- api/core/agent/fc_agent_runner.py | 7 ++++--- api/core/model_runtime/entities/message_entities.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/api/core/agent/fc_agent_runner.py b/api/core/agent/fc_agent_runner.py index dcc1326b33..8b445b8b34 100644 --- a/api/core/agent/fc_agent_runner.py +++ b/api/core/agent/fc_agent_runner.py @@ -187,7 +187,8 @@ class FunctionCallAgentRunner(BaseAgentRunner): ), ) - assistant_message = AssistantPromptMessage(content="", tool_calls=[]) + assistant_message = AssistantPromptMessage(content=response, tool_calls=[]) + if tool_calls: assistant_message.tool_calls = [ AssistantPromptMessage.ToolCall( @@ -199,8 +200,8 @@ class FunctionCallAgentRunner(BaseAgentRunner): ) for tool_call in tool_calls ] - else: - assistant_message.content = response + + logger.debug(f"FunctionCallAgentRunner: assistant_message: {assistant_message.model_dump()}") self._current_thoughts.append(assistant_message) diff --git a/api/core/model_runtime/entities/message_entities.py b/api/core/model_runtime/entities/message_entities.py index 89dae2dbff..142d9ee13e 100644 --- a/api/core/model_runtime/entities/message_entities.py +++ b/api/core/model_runtime/entities/message_entities.py @@ -249,7 +249,7 @@ class AssistantPromptMessage(PromptMessage): :return: True if prompt message is empty, False otherwise """ - if not super().is_empty() and not self.tool_calls: + if not super().is_empty() or self.tool_calls: return False return True From 1b6520efddf06bd3eaad2963e192fc3e3fd0e6d1 Mon Sep 17 00:00:00 2001 From: leslie2046 <253605712@qq.com> Date: Mon, 22 Dec 2025 15:01:01 +0800 Subject: [PATCH 2/5] fix: no content write back to plugin --- api/core/agent/fc_agent_runner.py | 7 ++++--- api/core/model_runtime/entities/message_entities.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/api/core/agent/fc_agent_runner.py b/api/core/agent/fc_agent_runner.py index dcc1326b33..8b445b8b34 100644 --- a/api/core/agent/fc_agent_runner.py +++ b/api/core/agent/fc_agent_runner.py @@ -187,7 +187,8 @@ class FunctionCallAgentRunner(BaseAgentRunner): ), ) - assistant_message = AssistantPromptMessage(content="", tool_calls=[]) + assistant_message = AssistantPromptMessage(content=response, tool_calls=[]) + if tool_calls: assistant_message.tool_calls = [ AssistantPromptMessage.ToolCall( @@ -199,8 +200,8 @@ class FunctionCallAgentRunner(BaseAgentRunner): ) for tool_call in tool_calls ] - else: - assistant_message.content = response + + logger.debug(f"FunctionCallAgentRunner: assistant_message: {assistant_message.model_dump()}") self._current_thoughts.append(assistant_message) diff --git a/api/core/model_runtime/entities/message_entities.py b/api/core/model_runtime/entities/message_entities.py index 89dae2dbff..142d9ee13e 100644 --- a/api/core/model_runtime/entities/message_entities.py +++ b/api/core/model_runtime/entities/message_entities.py @@ -249,7 +249,7 @@ class AssistantPromptMessage(PromptMessage): :return: True if prompt message is empty, False otherwise """ - if not super().is_empty() and not self.tool_calls: + if not super().is_empty() or self.tool_calls: return False return True From 16eb9a6dc24126818bc6f7c59d39925786fe3ab6 Mon Sep 17 00:00:00 2001 From: leslie2046 <253605712@qq.com> Date: Wed, 24 Dec 2025 14:42:08 +0800 Subject: [PATCH 3/5] remove log --- api/core/agent/fc_agent_runner.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/api/core/agent/fc_agent_runner.py b/api/core/agent/fc_agent_runner.py index 8b445b8b34..f22ee6baa0 100644 --- a/api/core/agent/fc_agent_runner.py +++ b/api/core/agent/fc_agent_runner.py @@ -188,7 +188,6 @@ class FunctionCallAgentRunner(BaseAgentRunner): ) assistant_message = AssistantPromptMessage(content=response, tool_calls=[]) - if tool_calls: assistant_message.tool_calls = [ AssistantPromptMessage.ToolCall( @@ -201,8 +200,6 @@ class FunctionCallAgentRunner(BaseAgentRunner): for tool_call in tool_calls ] - logger.debug(f"FunctionCallAgentRunner: assistant_message: {assistant_message.model_dump()}") - self._current_thoughts.append(assistant_message) # save thought From 4db3037adf9c816162514b5427ff702304694c8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=86=E8=90=8C=E9=97=B7=E6=B2=B9=E7=93=B6?= <253605712@qq.com> Date: Wed, 24 Dec 2025 15:20:10 +0800 Subject: [PATCH 4/5] Update api/core/model_runtime/entities/message_entities.py merged Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- api/core/model_runtime/entities/message_entities.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/api/core/model_runtime/entities/message_entities.py b/api/core/model_runtime/entities/message_entities.py index 142d9ee13e..2ffc714a49 100644 --- a/api/core/model_runtime/entities/message_entities.py +++ b/api/core/model_runtime/entities/message_entities.py @@ -249,10 +249,8 @@ class AssistantPromptMessage(PromptMessage): :return: True if prompt message is empty, False otherwise """ - if not super().is_empty() or self.tool_calls: - return False + return super().is_empty() and not self.tool_calls - return True class SystemPromptMessage(PromptMessage): From 0935cd0501a09b7b5214a39e86e3108ae046ed9a Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Wed, 24 Dec 2025 07:21:47 +0000 Subject: [PATCH 5/5] [autofix.ci] apply automated fixes --- api/core/model_runtime/entities/message_entities.py | 1 - 1 file changed, 1 deletion(-) diff --git a/api/core/model_runtime/entities/message_entities.py b/api/core/model_runtime/entities/message_entities.py index 2ffc714a49..fa74f35d28 100644 --- a/api/core/model_runtime/entities/message_entities.py +++ b/api/core/model_runtime/entities/message_entities.py @@ -252,7 +252,6 @@ class AssistantPromptMessage(PromptMessage): return super().is_empty() and not self.tool_calls - class SystemPromptMessage(PromptMessage): """ Model class for system prompt message.