Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

feat(工具): 新增小宿(Xiaosu)联网搜索服务商 - #2820

Open
wachoo wants to merge 1 commit into
dataelement:mainfrom
wachoo:feat/xiaosu-web-search
Open

wachoo wants to merge 1 commit into
dataelement:mainfrom
wachoo:feat/xiaosu-web-search

Conversation

@wachoo

@wachoo wachoo commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

背景

平台「内置工具 → 联网搜索」目前支持 Bing、博查、Jina、SerpApi、Tavily、Cloudsway、searXNG、DeepSeek,缺少小宿(Xiaosu)智能搜索。

本 PR 参照小宿官方 Go 客户端的接口契约,把 Xiaosu 接入为新的联网搜索服务商。

改动

  • 后端 bisheng_langchain/gpts/tools/web_search/tool.py
    • 新增 XiaosuSearch:GET https://{base_path}/search/{endpoint}/smart,Authorization: Bearer <api_key>,查询参数 q / count / mainText / enableContent / contentType=TEXT
    • 把 webPages.value[] 解析为平台统一的结果结构(标题、摘要、URL、来源、图标、发布时间)
    • 在 SearchTool.init_search_tool 中注册 xiaosu
    • base_path、endpoint 均可配置,默认值与参考实现一致(searchapi.xiaosuai.com / AOLwWFjoedCbmysb)
  • 前端 内置工具表单新增「小宿联网搜索」选项,提供 API Key、Base Path、Endpoint 三个字段
  • 国际化 补齐 en-US / zh-Hans / ja 三语文案
  • 测试 新增 test/tool/test_web_search_xiaosu.py:覆盖默认 URL 与查询参数、Bearer 请求头、结果归一化、自定义 base_path/endpoint,以及 10/60 秒默认超时

测试

uv run pytest test/tool/test_web_search_xiaosu.py test/tool/test_web_search_timeout.py -q
9 passed

已在真实部署中联调验证:配置 API Key 后能正常返回搜索结果。

Port the XiaoSu smart-search client from the Go reference
(internal/infrastructure/web_search/xiaosu.go): a bearer-authenticated
GET /search/{endpoint}/smart whose hits live under webPages.value.

- register the provider in SearchTool.init_search_tool
- expose api_key / base_path / endpoint in the admin web-search form
- translate the new labels and tips into en-US, zh-Hans and ja
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