Repository navigation
添加 [DeepSeek 联网搜索] 工具 - #135
Merged
Merged
Conversation
基于 DeepSeek 官方 Search API(https://api.deepseek.com/v1/tools/search) 封装的联网搜索工具,为 MaxKB 智能体提供实时网页检索能力。 - 支持 site:/lang:/after:/before:/-关键词 等搜索语法 - 可选返回网页正文(need_content) - 同时返回结构化 results 与带引用的 markdown - 分级错误处理(400/401/402/429/5xx)并给出排查提示 - api_key 作为启动参数(密码框),与输入参数分离
✅ PR 自动校验结果状态: 校验通过 |
gzzwp
added a commit
to gzzwp/MaxKB-toolstore
that referenced
this pull request
Oct 19, 2026
与 1Panel-dev#135 的联网搜索工具配套:Search 负责检索, Fetch 负责抓取单个网页并转换为 Markdown 正文。 - POST https://api.deepseek.com/v1/tools/fetch - max_chars 控制正文上限,超长自动截断并标注 - 403/404 等按业务失败处理(success=false + 中文 hint),不抛异常 - api_key 作为启动参数(密码框),与输入参数分离
This was referenced Oct 19, 2026
gzzwp
added a commit
to gzzwp/MaxKB-toolstore
that referenced
this pull request
Oct 19, 2026
Tool.desc 在数据库中是 varchar(128),1Panel-dev#135 中的描述为 168 字符, 导入时抛 StringDataRightTruncation: value too long for type character varying(128)。 将描述压缩至 108 字符并重新生成 .tool,其余文件与 1Panel-dev#135 一致。
hao65103940
pushed a commit
that referenced
this pull request
Oct 19, 2026
配套 DeepSeek 联网搜索工具(#135):Search 负责检索,Fetch 负责抓正文。 - POST https://api.deepseek.com/v1/tools/fetch - max_chars 控制正文上限(默认 8000),超长截断并标注 - 403/404 等按业务失败处理(success=false + 中文 hint),不抛异常 - 描述压缩至 89 字符,避免 Tool.desc 的 varchar(128) 溢出
hao65103940
added a commit
that referenced
this pull request
Oct 19, 2026
添加 [DeepSeek 网页抓取] 工具(Fetch,配套 #135)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
添加 [DeepSeek 联网搜索] 工具
工具的功能和用途
基于 DeepSeek 官方 Search API(
https://api.deepseek.com/v1/tools/search)封装的联网搜索工具,为 MaxKB 智能体提供实时网页检索能力:4)与重排分数(rerank_score 03)site:/-site:/"精确短语"/-关键词/lang:/after:/before:,可组合使用need_content=true时返回网页正文,默认关闭以节省上下文results数组 + 拼装好的markdown(带链接与来源标注),模型可直接引用出处success: false而非抛异常,工作流可据此退化为"不联网回答"与现有
tool_tavily_search、tool_duckduckgo_search、tool_bochaai_search、tool_langsearch_search互补:面向已使用 DeepSeek 开放平台的用户,无需再注册第三方搜索服务;DeepSeek 账户余额即可直接使用(5 元/1000 次成功请求,无结果不计费)。目录结构
实现要点(符合 MaxKB 工具开发规范)
main(api_key, query, count=10, need_content="false", ori_question=""),形参名与工具面板参数名逐字一致,且main位于代码末尾api_key作为启动参数(密码框组件)与输入参数分离,避免 Key 在编排界面暴露;query/need_content/ori_question支持引用参数,count支持自定义参数requests缺失时自动回退标准库urllib,无需额外安装依赖"5"/5.0/true等字符串值自动转换为正确类型,count自动夹逼到 1~50error与中文hint排查建议.tool文件按 MaxKB 导出格式生成:pickle.dumps(ToolInstance(tool_dict, "v2")),仅引用白名单类tools.serializers.tool.ToolInstance,已通过RestrictedUnpickler白名单规则的自测验证。测试情况
api_key、空query均返回结构化错误而非异常success:false+error+hint,HTTP 与 JSON 解析路径无误.tool文件:按 MaxKBRestrictedUnpickler白名单反序列化验证通过,字段与ToolExportModelSerializer导出字段集一致相关依赖
仅依赖
requests(MaxKB 镜像已内置;代码内置urllib回退,缺失时无需 pip 安装)。审核标准自查(对照"如何提交工具.md")
更新(追加第二个工具:DeepSeek 网页抓取)
按"增量提交"的讨论结果,在同一个分支上追加了配套的
tools/tool_deepseek_fetch/:/v1/tools/fetch)抓取单个网页,返回标题与 Markdown 正文max_chars控制正文上限(默认 8000,超长截断并标注)403/404等按业务失败处理(success=false+ 中文hint),编排中可据此跳过链接继续RestrictedUnpickler白名单自测,入口main位于代码末尾若维护者认为应拆分独立 PR,告知即可,我会立即拆出。