fix: web_search结果注入批量抓取引导,AGENT.md加强链式调用描述,避免AI只抓一条
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
## 链式调用模式
|
## 链式调用模式
|
||||||
|
|
||||||
- 搜索 → 获取详情(先搜再深挖)
|
- 搜索 → 批量获取详情:对搜索结果中前 3-5 条依次调用 web_fetch,不要只抓一条,获取完整内容后综合回答
|
||||||
- 浏览目录 → 读取文件(先看结构再读内容)
|
- 浏览目录 → 读取文件(先看结构再读内容)
|
||||||
- 搜索定位 → 精确修改(先找再改)
|
- 搜索定位 → 精确修改(先找再改)
|
||||||
|
|
||||||
|
|||||||
@@ -222,7 +222,13 @@ function formatToolResultForModel(toolName: string, result: ToolResult): string
|
|||||||
const top = raw.slice(0, 5).map((r, i) =>
|
const top = raw.slice(0, 5).map((r, i) =>
|
||||||
`[${i + 1}] ${r.title}\n URL: ${r.url}\n ${r.snippet}`
|
`[${i + 1}] ${r.title}\n URL: ${r.url}\n ${r.snippet}`
|
||||||
).join('\n\n');
|
).join('\n\n');
|
||||||
return JSON.stringify({ success: true, query: result.query, total: result.total, results: top });
|
return JSON.stringify({
|
||||||
|
success: true,
|
||||||
|
query: result.query,
|
||||||
|
total: result.total,
|
||||||
|
results: top,
|
||||||
|
_next: `以上是搜索结果摘要。请对前 ${Math.min(5, raw.length)} 条中与用户问题相关的条目,逐一调用 web_fetch 获取详细内容后再综合回答。不要只抓取一条!每条抓取都是独立的 web_fetch 调用。`
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'web_fetch': {
|
case 'web_fetch': {
|
||||||
|
|||||||
Reference in New Issue
Block a user