mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-07-10 17:58:46 +08:00
### What this PR does Before this PR: Web Search settings still depended on legacy renderer-side settings wiring and provider-specific UI structure. Provider selection, API key editing, blacklist handling, and compression settings were split across legacy hooks/routes and were not aligned with the v2 preference/provider configuration model. After this PR: Web Search settings are migrated to the v2 data and architecture path: - Adds `useWebSearch` as the renderer settings hook backed by v2 preference APIs. - Rebuilds the Web Search settings page around smaller components, hooks, and utilities for provider metadata, API keys, defaults, blacklist, and provider checks. - Uses v2 provider presets and resolved provider capability data for keyword search and URL fetch defaults. - Updates preference mappings/classification for removed or normalized Web Search settings. - Adds focused tests for the new settings hooks, provider metadata, API key handling, blacklist parsing, and provider check behavior. - Documents user-visible v2 Web Search setting changes in the breaking changes log. <!-- (optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: --> Fixes # N/A ### Why we need it and why it was done in this way The v2 refactor is moving settings and provider configuration away from legacy renderer-local state. Web Search settings need to read and write through the same v2 preference source of truth as the main-side Web Search service so the UI, migration layer, and runtime configuration use one provider model. The following tradeoffs were made: - The PR keeps the work scoped to Web Search settings and the preference/provider metadata needed by that settings surface. - Deprecated settings are removed instead of preserved through compatibility UI, because v1 Web Search settings are throwaway during the v2 refactor. - The settings page is split into local hooks/components instead of introducing a broader settings framework abstraction. - Runtime service adjustments are limited to what is required by the settings schema and preference changes. The following alternatives were considered: - Keeping the old `useWebSearchProviders` path as a compatibility layer, but that would continue dual settings ownership during the v2 migration. - Preserving the removed subscription-source and cutoff-unit UI, but those settings do not map cleanly to the v2 Web Search configuration model. - Combining this with runtime Web Search tool behavior changes, but that would make the PR too broad and harder to review. Links to places where the discussion took place: N/A ### Breaking changes This PR removes deprecated Web Search settings from the v2 settings surface: - Web Search subscription-source management is removed. - Compression cutoff is normalized to a token-based cutoff limit; the cutoff unit selector is removed. Impact: users will configure Web Search through v2 provider defaults, API keys, capability hosts, blacklist, and compression settings. No manual migration action is expected. ### Special notes for your reviewer Scope of this PR: - Web Search settings UI migration to v2 data/preferences. - Renderer settings hooks/components/utilities for Web Search provider configuration. - Preference classification/mapping changes required by the settings migration. - Tests for the settings-side behavior introduced here. Explicitly out of scope: - Web Search runtime orchestration in chat responses. - Built-in/external Web Search tool execution behavior. - Message rendering for Web Search tool results or citations. - Model switching behavior and assistant-level `enableWebSearch` semantics outside the settings migration. - Large-scale UI design-system replacement beyond the files touched for this settings migration. - New provider integrations or provider search algorithm changes. Review scope note: this PR is based on `v2`, but the intended review scope is limited to the Web Search settings migration described above. Web Search runtime/service/tool changes that are already part of the prerequisite v2 Web Search work are not part of this PR's review scope. Validation: - Not run in this PR creation pass. ### Checklist This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR. Approvers are expected to review this list. - [x] PR: The PR description is expressive enough and will help future contributors - [x] Code: [Write code that humans can understand](https://en.wikiquote.org/wiki/Martin_Fowler#code-for-humans) and [Keep it simple](https://en.wikipedia.org/wiki/KISS_principle) - [x] Refactor: You have [left the code cleaner than you found it (Boy Scout Rule)](https://learning.oreilly.com/library/view/97-things-every/9780596809515/ch08.html) - [x] Upgrade: Impact of this change on upgrade flows was considered and addressed if required - [x] Documentation: A [user-guide update](https://docs.cherry-ai.com) was considered and is present (link) or not required. Check this only when the PR introduces or changes a user-facing feature or behavior. Present in `v2-refactor-temp/docs/breaking-changes/`. - [x] Self-review: I have reviewed my own code (e.g., via [`/gh-pr-review`](/.claude/skills/gh-pr-review/SKILL.md), `gh pr diff`, or GitHub UI) before requesting review from others ### Release note <!-- Write your release note: 1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required". 2. If no release note is required, just write "NONE". 3. Only include user-facing changes (new features, bug fixes visible to users, UI changes, behavior changes). For CI, maintenance, internal refactoring, build tooling, or other non-user-facing work, write "NONE". --> ```release-note Web Search settings now use the v2 preference/provider configuration path. Deprecated subscription-source settings were removed, and compression cutoff is now token-based. ``` --------- Signed-off-by: eeee0717 <chentao020717Work@outlook.com>