Skip to content

fix: show only provider-relevant fields in Search settings#570

Merged
pancacake merged 2 commits into
HKUDS:devfrom
IliaAvdeev:fix/search-settings-conditional-fields
Jun 19, 2026
Merged

fix: show only provider-relevant fields in Search settings#570
pancacake merged 2 commits into
HKUDS:devfrom
IliaAvdeev:fix/search-settings-conditional-fields

Conversation

@IliaAvdeev

@IliaAvdeev IliaAvdeev commented Jun 14, 2026

Copy link
Copy Markdown

Description

The Search settings editor (/settings/search) rendered both the API Key and Base URL inputs for every web-search provider, regardless of whether the selected provider uses them. This is misleading:

  • DuckDuckGo (zero-config) showed an API Key box that does nothing.
  • SearXNG (which is configured by its instance URL) gave no indication that Base URL is mandatory — leave it blank and search silently falls back to DuckDuckGo.

This PR renders the two connection fields conditionally, per provider, mirroring the backend resolver resolve_search_runtime_config in deeptutor/services/config/provider_runtime.py:

Provider API Key Base URL
brave / tavily / jina / perplexity / serper shown hidden
searxng hidden shown, with an amber required hint when empty
duckduckgo / none hidden hidden
unknown / deprecated / unselected shown shown (never hide a field we can't model)

A small pure helper (web/components/settings/search-providers.ts) holds the capability table so it can be unit-tested and kept in sync with the backend. LLM and embedding editors are unchanged. One new i18n string was added (en + zh).

💬 Open to discussion

These visibility rules are a proposal, not dogma. If anything doesn't match your intent, let's discuss before merging — happy to adjust. A few choices I'd especially welcome feedback on:

  • Hiding Base URL for key-based providers (every search provider ships an empty base_url from the API, so it's only ever set for SearXNG — but say the word if you'd rather keep it visible as an advanced override).
  • Showing the API Key field for the deprecated serper (the backend still treats it as supported and key-requiring, so I kept it shown).
  • The amber "required" hint wording for SearXNG's Base URL.

Related Issues

No existing issue — searched open/closed issues and PRs; none cover this. Happy to open one if preferred.

Module(s) Affected

  • agents
  • api
  • config
  • core
  • knowledge
  • logging
  • services
  • tools
  • utils
  • web (Frontend)
  • docs (Documentation)
  • scripts
  • tests
  • Other: ...

Checklist

  • I have read and followed the contribution guidelines.
  • My code follows the project's coding standards.
  • I have run pre-commit run on the changed files — all hooks pass.
  • I have added relevant tests for my changes.
  • I have updated the documentation (if necessary).
  • My changes do not introduce any new security vulnerabilities.

Screenshots

A couple of representative examples (not exhaustive — the full behavior is in the table above):

Key-based provider (e.g. Jina) — only the API Key field is shown; Base URL is hidden:

image

Zero-config provider (DuckDuckGo) — no API Key or Base URL fields at all; the form goes straight to the optional Extra section:

image

Other providers follow the same rule set: SearXNG shows only a required Base URL, and key-based providers (Brave/Tavily/Perplexity/Serper) behave like Jina.

Additional Notes

Verification

  • tsc --noEmit (full project) — clean
  • node --testtests/search-providers.test.ts (7 cases: key-only, searxng-required, zero-config, unknown→show-all, case-insensitive, plus two invariant guards) passes; full web suite green
  • eslint — 0 errors (no new warnings)
  • i18n:parity — OK (new key present in en + zh)
  • Rebuilt the Docker image and confirmed the change is bundled and the app boots healthy.

Scope (intentionally left out)

  • The collapsed Extra (optional) section still shows an API Version field for search, which the search resolver ignores. Left as-is to keep this PR focused; candidate for a small follow-up.
  • Pre-existing FE/BE mismatch on serper (frontend marks it deprecated in the warning text; backend treats it as supported and key-requiring). This PR shows the API Key field for serper per the backend (it needs one) and does not otherwise touch that mismatch.

@pancacake
pancacake merged commit 9710b9d into HKUDS:dev Jun 19, 2026
11 checks passed
vaskoyudha added a commit to vaskoyudha/deeptutor-for-programmer-fork that referenced this pull request Jul 25, 2026
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.

2 participants