Skip to content

feat(search): 在原服务入口启用官方原生搜索 - #977

Merged
vastsa merged 6 commits into
vastsa:mainfrom
hui455:feat/provider-search-guidance
Sep 23, 2026
Merged

vastsa merged 6 commits into
vastsa:mainfrom
hui455:feat/provider-search-guidance

Conversation

@hui455

@hui455 hui455 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

问题与变化

现有 DeepSeek 和 xAI 预设使用 Chat Completions,导致模型的原生搜索选项置灰,尽管官方已经提供可用的搜索接口。旧 OpenAI Completions 配置也受同一协议门控影响。

本 PR 保留原服务入口及连接配置,用户直接勾选模型的「原生联网搜索」即可。运行时仅对已确认的官方来源和路径选择搜索适配器:DeepSeek 使用同源 Anthropic Messages,xAI 和旧 OpenAI 配置使用同源 Responses。关闭搜索后恢复原配置的请求方式。复用现有适配器,不新增搜索引擎或服务配置。

界面和运行时共用路由判断;代理站点、自定义端口和未识别路径不会被转到官方服务。保存只改变模型搜索选项,保留服务名称、地址、格式、密钥引用和其他模型设置。尚未集成的连接显示“应用尚未适配”,不再把应用限制表述为厂商没有搜索能力。

同时提供完整请求 URL 的显式格式建议,并保留手动格式优先级及 OpenCode Go 的正确请求后缀。关联 #907;完整联网探测、按模型自动猜测协议和错误驱动自动切换不在本 PR 范围,因此不关闭该 issue。

前后对比

Windows、浅色、1200×860,真实配置组件和合成 API 数据。修改前来自 main cb8a87d99;当前 base 后续仅有文档变化,可执行内容相同。不是完整应用或线上搜索结果。

DeepSeek 修改前:原入口中的搜索选项置灰。
DeepSeek 修改前

本 PR:同一个 DeepSeek 入口,地址不变,直接勾选搜索。
DeepSeek 原入口直接勾选

第三方修改前:完整 Responses 请求地址与所选格式不一致,无提示。
第三方修改前

本 PR:显示明确的格式建议,保留用户决定权及原服务来源。
第三方格式建议

验证

  • pnpm build:js、Desktop / agent-runtime 类型检查、pnpm lint、架构检查、pnpm check:pr-base 通过。

  • Shared:1,026 项;服务配置相关:38 项;请求、搜索回放和子代理相关:108 项,全部通过。

  • pnpm test:e2e:provider-api-style:20 个中英文场景通过,包括三家官方服务勾选、取消、保存、重开、关闭搜索及已有 OAuth 路径。

  • pnpm test:e2e:hosted-search:7 个离线 sidecar 场景通过。真实适配器捕获验证最终路径、凭据和工具定义;同一 DeepSeek 会话关闭→开启→关闭搜索后仍能继续并保留文本历史。

  • 新测试在上游组件上重现 DeepSeek 搜索置灰;在候选上通过。640px 窗口格式建议按钮可见、可命中,无页面横向溢出。

  • pnpm docs:check、git diff --check 通过。

  • 未调用真实或付费 API。表单夹具不验证 Host/SQLite 保存,未做 macOS/Linux 原生验证。端点协议支持不保证每个模型都支持搜索工具。

  • Linux CI 的 JS 完整构建/类型/静态检查/测试、Rust、文档及基线检查均已通过:运行 35901344345。未知旧接口格式覆盖实际归一化结果及界面打开、保存路径。

  • Windows 本机完整桌面测试未全绿(2,696 通过、44 失败、7 跳过,测试版本 2db48b0b8),其中包含 macOS 签名与 POSIX/SSH 平台相关测试;不将其记为全量通过。上述定向检查和离线集成验证通过。

兼容性与其他官方服务

现有模型默认仍不开搜索;不改存储格式、IPC 或凭据归属。明确配置的其他协议和已有 Responses/Codex/Anthropic 路径保持不变。

核查发现 Google、通义、智谱、Kimi 等也有搜索能力,但工具格式、返回内容或工具执行流程不同,不能通过本次路由直接兼容。它们的独立适配仍未完成;详见 docs/project/native-search-provider-audit.md,其中列出证据和未确认项。

同步 ADR 0297、提供商与模型规格、中英 E2E 场景、八种界面语言和发布说明。

Let users enable search on their existing DeepSeek, xAI and legacy
OpenAI configurations. Resolve published search routes only for opted-in
requests, preserving stored settings and relay credential boundaries.

Share the capability decision between settings and runtime, cover
search toggling and conversation continuity, and document the verified
routes and vendor-specific integration gaps.

Refs vastsa#907
@vastsa

vastsa commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

太强啦,邪恶水蜜桃,还在肝
image

The endpoint normalizer moved out of the provider dialog, so checking
for its former switch statement rejects a working implementation. Test
the fallback result and the mounted legacy-provider save path instead.

Refs vastsa#907
Keep the published search branch current without rewriting its history.
Include the upstream streaming changes before validating the CI repair.
@hui455

hui455 commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

哈哈谢谢夸奖!其实是纯粹是自己接官方 DeepSeek API 的时候发现搜索用不了,排查了一会儿发现是协议门控的问题,干脆就顺手把这个 PR 肝了。

@vastsa

vastsa commented Sep 23, 2026

Copy link
Copy Markdown
Owner

哈哈谢谢夸奖!其实是纯粹是自己接官方 DeepSeek API 的时候发现搜索用不了,排查了一会儿发现是协议门控的问题,干脆就顺手把这个 PR 肝了。

正在审查,过了我直接合入

lan and others added 3 commits September 24, 2026 03:30
…rom the preset

providerSetupPreset now declines a published preset whose wire format
disagrees with the stored one, so the row opens as the custom service.
The save payload then took `namedPreset?.vendorKey ?? "custom"` and
rewrote a stored `openai` / `deepseek` identity as `custom`, losing the
models.dev catalog match and the `vendor/<model>` subagent pins. Fall
back to the stored vendorKey before the custom sentinel.

The model lookup context uses the same chain so catalog metadata is
resolved for the row being edited instead of a generic custom host.

Refs vastsa#907
origin/main grew the pt-BR catalog after this branch was cut. The
endpoint format guidance keys, the reworded native-search hint and the
0.15.6 highlight therefore had no pt-BR counterpart, and the catalog
parity and changelog alignment tests failed on the merge.

Refs vastsa#907
@vastsa
vastsa merged commit 920b12b into vastsa:main Sep 23, 2026
3 of 4 checks passed
@vastsa

vastsa commented Sep 23, 2026

Copy link
Copy Markdown
Owner

已合入。合入前补了两个落地问题:

  1. 保存会丢厂商标识:providerSetupPreset 现在会拒绝「已存接口格式与预设不一致」的预设,这类条目按自定义服务打开,保存时 vendorKey 被写成 custom,丢失 models.dev 目录匹配和 厂商/模型 子代理绑定。现在先回落到已存的 vendorKey,并在 saved-protocol-wins-over-preset 场景补了断言(该断言在改动前确实会红)。
  2. 合入 main 后 pt-BR 缺文案:endpointFormatGuidance、applyEndpointFormat、nativeWebSearchUnsupported 和 0.15.6 更新日志在 pt-BR 没有对应项,目录一致性 / changelog 对齐测试会挂。已补齐。

origin/main 已非破坏性合入(merge commit,保留原作者)。

无关本 PR、未改动的遗留问题:apps/desktop/test/context-compaction.test.mjs 的 ADR 0299 断言 /contextBudgetFor\(input\.model/ 在 main 上本来就是红的(subagent-context.ts 实际是 contextBudgetFor(model, requestMessages)),本次 CI 的 JS job 因此失败。

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.

3 participants