Skip to content

feat: add optional you.com search integration - #154

Open
brainsparker wants to merge 1 commit into
limecloud:mainfrom
brainsparker:feat/youcom-search
Open

brainsparker wants to merge 1 commit into
limecloud:mainfrom
brainsparker:feat/youcom-search

Conversation

@brainsparker

Copy link
Copy Markdown

I work at You.com, so treat the recommendation accordingly.(先说明:我在 You.com 工作。)

本 PR 在 Multi Search Engine 里加入一个 youcom 引擎。它默认关闭(enabled: false),不改变现有默认引擎顺序和 duckduckgo_instant 默认 provider。用户在多引擎配置里启用后才会调用。

改动

  • src/components/settings-v2/system/web-search/webSearchConfig.ts:DEFAULT_MSE_ENGINES 增加 youcom,url_template 为 https://api.you.com/v1/agents/search?query={query},默认关闭。
  • lime-rs/crates/core/src/config/types.rs 与 lime-rs/crates/tool-runtime/src/web_search/support.rs:Rust 侧默认引擎列表同步增加同一条目(默认关闭)。
  • lime-rs/crates/tool-runtime/src/web_search.rs:
    • 多引擎循环中识别 You.com API 主机(api.you.com、ydc-index.io),走 JSON 解析,不走 HTML 链接抽取。
    • 未设置 YDC_API_KEY:GET 免密钥端点(每个 IP 每天 100 次)。设置后:POST https://ydc-index.io/v1/search,带 X-API-Key。
    • results.web[] 和 results.news[] 映射为 SearchResult(description + snippets 作为 snippet,page_age 作为 publish_date)。
    • 401/403、402、429 返回明确的错误信息,429 带上 Retry-After。失败只记入 failed_engines,不影响其他引擎。
    • 仅对 You.com 请求设置 User-Agent: youdotcom-integration/limecloud-lime。
    • 复用现有 timeout_ms 与 max_results_per_engine(count 上限 20)。
  • 测试:web_search.rs 增加 2 个单元测试(默认关闭、JSON 解析、错误信息),webSearchConfig.unit.test.ts 增加 1 个用例。

验证

  • npm run lint:通过。
  • npm run typecheck:通过。
  • vitest run src/components/settings-v2/system/web-search:3 个文件,43 个用例通过。
  • Rust: the two new unit tests in web_search.rs were added but NOT run locally, and the Rust code was not compiled here (not enough disk). Please treat it as unverified until CI or cargo test -p tool-runtime runs. 新增的 Rust 单元测试未在本地运行,Rust 代码也未在本地编译。

说明

  • 没有新增用户可见文案,所以没有改五种语言的 i18n。如果希望在设置页给 youcom 加说明文字,我会补齐 zh-CN、zh-TW、en-US、ja-JP、ko-KR。
  • 如果这个方向不合适,直接说,我会关闭。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant