Repository navigation
feat(web-search): add Kimi search with shared chat credentials (opt-in) - #1911
Conversation
|
Live-tested with a real Moonshot Open Platform key (api.moonshot.cn). API contract: End-to-end (two runs, both full course generations):
Legacy regressions: One configuration-interplay observation (repro included), as a supplement: with an |
|
Thanks for the thorough live test.
|
bdd8d90 to
daf7e3e
Compare
daf7e3e to
522d59d
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 522d59da48
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ( | ||
| slot.capability === 'webSearch' && | ||
| !isOfficialWebSearchBaseUrl(offered.registryId ?? model, provider.baseUrl) | ||
| ) | ||
| continue; |
There was a problem hiding this comment.
Preserve search for official Kimi alternate URLs
When a workspace user selects an official non-default Kimi endpoint such as https://api.moonshot.ai/v1, modelSettingsView classifies every stored chat baseUrl as custom and exposes that provider as chat-only, so offered is already undefined before this allowlist check runs. Consequently the wizard does not assign web search; if an existing assignment survives, resolve-slot.ts marks the URL as customBaseUrl and media.ts rejects the search at runtime. The official Kimi URLs need to be recognized in the model-settings capability and resolution path, not only here.
Useful? React with 👍 / 👎.
Summary
Add Kimi web search using the existing Kimi chat account's API key and base URL, with explicit opt-in. This AI-assisted PR implements the web-search portion of #1909.
Moonshot Open Platform accounts use
/tools/search_proand combine page chunks, falling back to snippets. Coding Plan accounts use/search, enable page crawling, and prefer page content over snippets. The adapter uses Bearer authentication, a 30-second server timeout, the shared 400-character query limit, at most 20 results enforced locally for both endpoints, and proxy-aware fetch with caller cancellation.Configuration and review corrections
webSearchinopenmaic.ymlor workspace settings, addweb-search.kimiinserver-providers.yml, or setWEB_SEARCH_KIMI_ENABLED=trueto opt into legacy search with shared credentials.WEB_SEARCH_KIMI_ENABLED=falseforce-disables search.WEB_SEARCH_KIMI_ENABLEDis the only Kimi search switch.KIMI_MODELSremains chat-only.openmaic.yml.openmaic.ymlexists without awebSearchassignment, a loaded legacy Kimi search opt-in produces a specific one-time startup warning telling the operator to declare the provider and assignslots.webSearch. The docs include this requirement in every maintained locale./coding/v1selects/search; otherwise the adapter selects/tools/search_pro. Deployment-configured proxies must preserve this path layout.Opting in on a deployment with no other search provider makes Kimi the default search provider for all workspaces.
The existing switch dispatch remains. Existing search defaults retain precedence after Kimi opt-in;
webFetchand published packages are unchanged. Existing Kimi labels and logo are reused across settings; the 12 settings locales already contain the label.Verification
All commands run with Node 22.22.0 and the required environment cleanup. Dependencies were installed with
pnpm install; standalone render-service test dependencies remain installed from CI'sPUPPETEER_SKIP_DOWNLOAD=true npm cistep.pnpm checkpnpm lintpnpm exec tsc --noEmitpnpm check:i18n-keyspnpm exec vitest run tests/web-search tests/config tests/model-settings tests/server tests/providerspnpm testpnpm buildRegression coverage includes both API contracts and result mapping; query/result limits, including 19 returned results for a request limited to 3 on both endpoints; malformed/HTTP errors and cancellation; chat-only Kimi; Kimi plus SearXNG/Tavily; user Tavily requests under operator preference; explicit env/YAML opt-in; no activation without credentials; the dedicated search switch; opted-in Kimi preserving existing SearXNG/Brave/Doubao defaults while remaining assignable; chat pins; conflicting legacy accounts; wizard official/proxy bases; and the ignored file-backed opt-in warning, its once-only logging, and absence for assigned/disabled slots or inactive opt-ins.
Self-review checked opt-in activation and both default-selection paths, account collision handling, credential/base-URL precedence, endpoint validation, locale consistency, and scope. All local automated Kimi requests are mocked; this implementation run made no live authenticated calls. No open design questions remain for this scope.
Maintainer live verification
Open Platform search was verified end-to-end by a maintainer with a real key against
api.moonshot.cn: two full course generations used current search results in their outlines, and page chunks provided substantial body content. The maintainer also verified the legacy regressions: a chat key alone leaves search disabled; explicit opt-in with no other search provider makes Kimi the default; an existing Tavily provider keeps precedence. Withopenmaic.yml, declaring the Kimi provider and assigningslots.webSearchenabled search.Coding Plan
/searchresponse fields were verified with a real key:content,date,icon,mime,site_name,snippet,title, andurl. The endpoint ignoredlimit: 3and returned 19 results; the adapter therefore enforces the requested result cap locally. This verifies the Coding Plan response contract, rather than a full Coding Plan course-generation run.International Open Platform search Pro availability remains unverified.
Related #1909