fix(websearch): preserve searxng results when fetch fails#13611
fix(websearch): preserve searxng results when fetch fails#13611156554395 wants to merge 3 commits intoCherryHQ:mainfrom
Conversation
GeorgeDong32
left a comment
There was a problem hiding this comment.
感谢您的贡献!
首先,非常感谢您为 Cherry Studio 提交这个修复!这是一个高质量的初次贡献,我们非常欢迎新贡献者加入社区。🎉
问题修复评估
您对 fix(websearch): preserve searxng results when fetch fails 的修复完全解决了 Issue #12954 的根本问题:
根本原因: 原始代码在 fetchWebContent 失败或返回 noContent 时,直接丢弃整个搜索结果项,导致 LLM 只能收到部分"恰好能抓取成功"的结果,呈现出"固定且不相关"的现象。
您的修复方案:
- ✅ 正确实现了 fallback 机制,保留 SearXNG 原始数据
- ✅ 添加了超时控制防止页面抓取无限期挂起
- ✅ 测试覆盖了核心场景
需要修改的问题
⚠️ 此 PR 包含了多个不相关的变更
我们发现此 PR 混合了以下几个独立的功能/修复:
| Commit | 内容 | 建议 |
|---|---|---|
feat: Add configurable web-search timeout setting |
Web 搜索超时配置 UI | 应拆分为独立 PR |
fix(agent): allow clearing accessible directories |
Agent 目录清理修复 | 应拆分为独立 PR |
fix(websearch): preserve searxng results when fetch fails |
SearXNG fallback 修复 | 本 PR 应只保留此项 |
请将不相关的 commits 拆分到独立的 PR 中,这样可以:
- 更容易进行 code review
- 独立追踪每个功能/修复的变更
- 降低合并风险
测试相关说明
Windows 平台上的 BaseService.resolveAccessiblePaths 测试失败可以忽略(那是其他变更引入的),我们只需要关注您 SearXNG 修改部分的测试即可。您的测试用例覆盖了核心场景,很好!
总结
感谢您的耐心和贡献!请将不相关的变更拆分后,我们可以尽快合并 SearXNG fallback 修复的部分。如果有任何问题,欢迎在评论中讨论。
35ef1fd to
3cafa7d
Compare
|
Thanks for the review! I have updated this PR to keep only the SearXNG fallback fix and its related websearch-only adjustments.\n\nChanges made:\n- removed the unrelated timeout settings UI changes\n- removed the unrelated agent accessible-directories changes\n- kept only the SearXNG fallback fix and its focused tests\n\nI also re-ran the SearXNG renderer tests and verified the modified files pass Biome formatting locally.\n\nPlease take another look when convenient. Thanks! |
Summary
Problem
Fixes #12954.
SearXNG may return relevant search results, but Cherry Studio currently fetches each result page and drops items when readable content extraction fails. In practice, this can make the LLM receive a smaller, distorted, or seemingly fixed set of results even though SearXNG itself returned useful matches.
Fix
When
fetchWebContent()fails or returnsNo content found, keep the original SearXNG result by falling back to its existingtitle/content/urlfields.This keeps successful page extraction behavior unchanged, while avoiding loss of relevant search results when downstream fetching fails.
Testing
No content foundnode node_modules/vitest/vitest.mjs run src/renderer/src/providers/WebSearchProvider/SearxngProvider.test.ts