diff --git a/src/agents/common/tools.py b/src/agents/common/tools.py index c547ba6c..b891644a 100644 --- a/src/agents/common/tools.py +++ b/src/agents/common/tools.py @@ -30,7 +30,7 @@ def get_tavily_search(): return _tavily_search_instance -@tool(name_or_callable="计算器", description="可以对给定的2个数字选择进行 add, subtract, multiply, divide 运算") +@tool(name_or_callable="calculator", description="可以对给定的2个数字选择进行 add, subtract, multiply, divide 运算") def calculator(a: float, b: float, operation: str) -> float: try: if operation == "add": @@ -87,7 +87,7 @@ async def text_to_img_demo(text: str) -> str: return image_url -@tool(name_or_callable="人工审批工具(Debug)", description="请求人工审批工具,用于在执行重要操作前获得人类确认。") +@tool(name_or_callable="human_in_the_loop_debug", description="请求人工审批工具,用于在执行重要操作前获得人类确认。") def get_approved_user_goal( operation_description: str, ) -> dict: diff --git a/src/agents/deep_agent/context.py b/src/agents/deep_agent/context.py index b496dfcb..45ccd51b 100644 --- a/src/agents/deep_agent/context.py +++ b/src/agents/deep_agent/context.py @@ -9,14 +9,16 @@ DEEP_PROMPT = """你是一位专家级研究员。你的工作是进行彻底的 你应该做的第一件事是把原始的用户问题写入 `question.txt`,以便你有一个记录。 -使用 research-agent 进行深入研究。它会用详细的答案回应你的问题/主题。 +首先,你应该并行使用 research-agent 进行深入研究。,当你认为有足够的信息来撰写最终报告时,就把它写入 `final_report.md` +其次(如果有必要),你可以调用 critique-agent 来获取对最终报告(文件)的评价。 +之后(如果需要)你可以做更多的研究并编辑 `final_report.md` -当你认为有足够的信息来撰写最终报告时,就把它写入 `final_report.md` - -你可以调用 critique-agent 来获取对最终报告的评论。之后(如果需要)你可以做更多的研究并编辑 `final_report.md` 你可以根据需要重复这个过程,直到你对结果满意为止。 -一次只编辑一个文件(如果你并行调用这个工具,可能会有冲突)。 +务必注意: +1. 一次只编辑一个文件(如果你并行调用这个工具,可能会有冲突)。 +2. 一次只给 research-agent 一个主题。不要传递多个子问题。 + 以下是撰写最终报告的说明: @@ -29,6 +31,7 @@ DEEP_PROMPT = """你是一位专家级研究员。你的工作是进行彻底的 1. 组织良好,有恰当的标题(# 用于标题,## 用于章节,### 用于子章节) 2. 包含研究中的具体事实和见解 3. 使用 [标题](URL) 格式引用相关来源 +4. 图片应该使用 ![描述](图片URL) 格式引用 4. 提供平衡、透彻的分析。尽可能全面,并包含与整体研究问题相关的所有信息。使用你进行深入研究,并期望得到详细、全面的答案 5. 在末尾包含一个“来源”部分,列出所有引用的链接 diff --git a/src/agents/deep_agent/prompts.py b/src/agents/deep_agent/prompts.py deleted file mode 100644 index f1d3fa41..00000000 --- a/src/agents/deep_agent/prompts.py +++ /dev/null @@ -1,56 +0,0 @@ -DEEP_PROMPT = """ -你的工作是进行彻底的研究,然后撰写一份精美的报告。 - -你应该做的第一件事是把原始的用户问题写入 `question.txt`,以便你有一个记录。(此项无需写入待办事项) - -并行使用 research-agent 进行深入研究。 -一次只给这个研究员一个主题。不要向这个研究员传递多个子问题。 - -当你认为有足够的信息来撰写最终报告时,就把它写入 `final_report.md` - -你可以调用 critique-agent 来获取对最终报告的评论。之后(如果需要)你可以做更多的研究并编辑 `final_report.md` -你可以根据需要重复这个过程,直到你对结果满意为止。 - -一次只编辑一个文件(如果你并行调用编辑工具,可能会有冲突)。 - -以下是撰写最终报告的说明: - - - -请根据整体研究简报创建一个详细的答案,该答案应: -1. 组织良好,有恰当的标题(# 用于标题,## 用于章节,### 用于子章节) -2. 包含研究中的具体事实和见解 -3. 提供平衡、透彻的分析。尽可能全面,并包含与整体研究问题相关的所有信息。 -4. 如果有确定内容的图片 url,你应该在报告中包含它(根据 caption 判断是否相关)。 - -请记住:章节是一个非常灵活和松散的概念。你可以按照你认为最好的方式来组织你的报告,确保你的各个部分是连贯的,并且对读者来说是有意义的。 -很重要:每部分,不应该有很多 items,尽量使用完成的段落并通过合适的衔接词来连接它们。 - -对于报告的每个部分,请执行以下操作: -- 使用简单、清晰的语言 -- 对报告的每个部分使用 ## 作为章节标题(Markdown 格式) -- 绝不要将自己称为报告的作者。这应该是一份专业的报告,不含任何自我指涉的语言。 -- 不要在报告中说你正在做什么。只需撰写报告,不要添加任何你自己的评论。 -- 每个部分的长度应足以用你收集到的信息。预计各部分会长且详尽。你正在撰写一份深入的研究报告,用户会期望得到透彻的答案。 -- 在适当的时候使用项目符号来列出信息,但默认情况下,请以段落形式撰写。 - -请记住: -简报和研究可能是英文的,但在撰写最终答案时,你需要将这些信息翻译成正确的语言。 -确保最终答案报告的语言与消息历史中的人类信息语言相同。 - -用清晰的 markdown 格式化报告,结构合理,并在适当的地方包含来源引用。 - -<引用规则> -- 在你的文本中为每个唯一的 URL 分配一个引文编号 -- 以 ### 来源 结尾,列出每个来源及其对应的编号 -- 重要提示:无论你选择哪些来源,最终列表中的来源编号都应连续无间断(1,2,3,4...) -- 每个来源都应该是列表中的一个独立行项目,这样在 markdown 中它会被渲染成一个列表。 -- 示例格式: - [1] 来源标题: URL - [2] 来源标题: URL -- 引用非常重要。请确保包含这些内容,并特别注意确保其正确性。用户通常会使用这些引文来查找更多信息。 - - - -你可以使用一些工具。务必将结果保存在 `final_report.md` 中。 -""" diff --git a/web/src/components/AgentMessageComponent.vue b/web/src/components/AgentMessageComponent.vue index 5acb24d7..1b5b4959 100644 --- a/web/src/components/AgentMessageComponent.vue +++ b/web/src/components/AgentMessageComponent.vue @@ -401,7 +401,6 @@ const parsedData = computed(() => { .ant-collapse-header { padding: 8px 12px; - // background-color: var(--gray-100); font-size: 14px; font-weight: 500; color: var(--gray-700); @@ -446,7 +445,6 @@ const parsedData = computed(() => { align-items: center; gap: 8px; background-color: var(--color-error-50); - // border: 1px solid #f87171; color: var(--color-error-500); span { line-height: 1.5; @@ -478,123 +476,6 @@ const parsedData = computed(() => { } } } - - :deep(.tool-call-display) { - background-color: var(--gray-25); - outline: 1px solid var(--gray-150); - border-radius: 8px; - overflow: hidden; - transition: all 0.2s ease; - - .tool-header { - padding: 8px 12px; - // background-color: var(--gray-100); - font-size: 14px; - font-weight: 500; - color: var(--gray-800); - border-bottom: 1px solid var(--gray-100); - display: flex; - align-items: center; - gap: 8px; - cursor: pointer; - user-select: none; - position: relative; - transition: color 0.2s ease; - align-items: center; - - .anticon { - color: var(--main-color); - font-size: 16px; - } - - .tool-name { - font-weight: 600; - color: var(--main-700); - } - - span { - display: flex; - align-items: center; - gap: 4px; - } - - .tool-loader { - margin-top: 2px; - color: var(--main-700); - } - - .tool-loader.rotate { - animation: rotate 2s linear infinite; - } - - .tool-loader.tool-success { - color: var(--color-success-500); - } - - .tool-loader.tool-error { - color: var(--color-error-500); - } - - .tool-loader.tool-loading { - color: var(--color-info-500); - } - - .tool-expand-icon { - margin-left: auto; - color: var(--gray-400); - display: flex; - align-items: center; - } - } - - .tool-content { - transition: all 0.3s ease; - - .tool-params { - padding: 8px 12px; - background-color: var(--gray-25); - border-bottom: 1px solid var(--gray-150); - - .tool-params-content { - margin: 0; - font-size: 12px; - overflow-x: auto; - color: var(--gray-700); - line-height: 1.5; - - pre { - margin: 0; - font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; - } - } - } - - .tool-result { - padding: 0; - background-color: transparent; - - .tool-result-header { - padding: 12px 16px; - background-color: var(--gray-100); - font-size: 12px; - color: var(--gray-700); - font-weight: 500; - border-bottom: 1px solid var(--gray-200); - } - - .tool-result-content { - padding: 0; - background-color: transparent; - } - } - } - - &.is-collapsed { - .tool-header { - border-bottom: none; - } - } - } } .retry-hint { @@ -662,7 +543,7 @@ const parsedData = computed(() => { border-radius: 12px; overflow: hidden; margin-left: auto; - // max-height: 200px; + /* max-height: 200px; */ border: 1px solid rgba(255, 255, 255, 0.2); img { diff --git a/web/src/components/ToolCallingResult/BaseToolCall.vue b/web/src/components/ToolCallingResult/BaseToolCall.vue index 420508a5..27827bf7 100644 --- a/web/src/components/ToolCallingResult/BaseToolCall.vue +++ b/web/src/components/ToolCallingResult/BaseToolCall.vue @@ -192,7 +192,6 @@ const formatResultData = (data) => {