Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
Refactor: CoT runner (#2157)
Yeuoly48d5628fd4e4
diff --git a/api/core/features/assistant_cot_runner.py b/api/core/features/assistant_cot_runner.pyindex f2778a020c5..0d6725d0515 100644--- a/api/core/features/assistant_cot_runner.py+++ b/api/core/features/assistant_cot_runner.py@@ -19,8 +19,6 @@ from core.features.assistant_base_runner import BaseAssistantApplicationRunnerfrom models.model import Conversation, Message-logger = logging.getLogger(__name__)-class AssistantCotApplicationRunner(BaseAssistantApplicationRunner):def run(self, model_instance: ModelInstance,conversation: Conversation,@@ -93,6 +91,7 @@ class AssistantCotApplicationRunner(BaseAssistantApplicationRunner):prompt_messages_tools = []message_file_ids = []+agent_thought = self.create_agent_thought(message_id=message.id,message='',@@ -100,7 +99,9 @@ class AssistantCotApplicationRunner(BaseAssistantApplicationRunner):tool_input='',messages_ids=message_file_ids)- self.queue_manager.publish_agent_thought(agent_thought, PublishFrom.APPLICATION_MANAGER)++ if iteration_step > 1:+ self.queue_manager.publish_agent_thought(agent_thought, PublishFrom.APPLICATION_MANAGER)# update prompt messagesprompt_messages = self._originze_cot_prompt_messages(@@ -137,7 +138,11 @@ class AssistantCotApplicationRunner(BaseAssistantApplicationRunner):# get llm usageif llm_result.usage:increse_usage(llm_usage, llm_result.usage)-++ # publish agent thought if it's first iteration+ if iteration_step == 1:+ self.queue_manager.publish_agent_thought(agent_thought, PublishFrom.APPLICATION_MANAGER)+self.save_agent_thought(agent_thought=agent_thought,tool_name=scratchpad.action.action_name if scratchpad.action else '',tool_input=scratchpad.action.action_input if scratchpad.action else '',@@ -187,7 +192,6 @@ class AssistantCotApplicationRunner(BaseAssistantApplicationRunner):tool_call_args = scratchpad.action.action_inputtool_instance = tool_instances.get(tool_call_name)if not tool_instance:- logger.error(f"failed to find tool instance: {tool_call_name}")answer = f"there is not a tool named {tool_call_name}"self.save_agent_thought(agent_thought=agent_thought,tool_name='',@@ -237,7 +241,6 @@ class AssistantCotApplicationRunner(BaseAssistantApplicationRunner):if error_response:observation = error_response- logger.error(error_response)else:observation = self._convert_tool_response_to_str(tool_response)@@ -543,13 +546,13 @@ class AssistantCotApplicationRunner(BaseAssistantApplicationRunner):# add assistant messageif len(agent_scratchpad) > 0:prompt_messages.append(AssistantPromptMessage(- content=(agent_scratchpad[-1].thought or '') + "\n" + (agent_scratchpad[-1].observation or '')+ content=(agent_scratchpad[-1].thought or '')))-+# add user messageif len(agent_scratchpad) > 0:prompt_messages.append(UserPromptMessage(- content=input,+ content=(agent_scratchpad[-1].observation or ''),))return prompt_messagesdiff --git a/api/core/tools/provider/builtin/youtube/youtube.yaml b/api/core/tools/provider/builtin/youtube/youtube.yamlindex 0fa267b2a94..98b2905dfaa 100644--- a/api/core/tools/provider/builtin/youtube/youtube.yaml+++ b/api/core/tools/provider/builtin/youtube/youtube.yaml@@ -2,13 +2,13 @@ identity:author: Difyname: youtubelabel:- en_US: Youtube- zh_Hans: Youtube- pt_BR: Youtube+ en_US: YouTube+ zh_Hans: YouTube+ pt_BR: YouTubedescription:- en_US: Youtube- zh_Hans: Youtube(油管)是全球最大的视频分享网站,用户可以在上面上传、观看和分享视频。- pt_BR: Youtube é o maior site de compartilhamento de vídeos do mundo, onde os usuários podem fazer upload, assistir e compartilhar vídeos.+ en_US: YouTube+ zh_Hans: YouTube(油管)是全球最大的视频分享网站,用户可以在上面上传、观看和分享视频。+ pt_BR: YouTube é o maior site de compartilhamento de vídeos do mundo, onde os usuários podem fazer upload, assistir e compartilhar vídeos.icon: icon.pngcredentials_for_provider:google_api_key: