fix(tools): refine DeepSeek search credentials and query validation

Require a configured Search API key while preserving explicit ${VAR_NAME} references.
Reject overlong Unicode queries locally instead of silently truncating them.
Keep the shared Settings flow and condense the configuration documentation.
This commit is contained in:
chengyongru authored and chengyongru committed 2026-10-19 16:50:17 +08:00
1 parent e5b469ebd4
commit dca49c258a
6 files changed
+136 -82

No files matched your search

@@ -3,7 +3,7 @@ import type { TFunction } from "i18next";
import {
webSearchProviderAcceptsApiKey,
webSearchProviderRequiresApiKey,
webSearchDraftState,
} from "@/components/settings/capabilities/WebSettings";
import type { CapabilitySettingsState } from "@/components/settings/capabilities/useCapabilitySettingsState";
import type {
@@ -151,17 +151,7 @@ export function useCapabilitySettingsActions({
if (!provider) return;
const apiKey = webSearchForm.apiKey?.trim() ?? "";
const baseUrl = webSearchForm.baseUrl?.trim() ?? "";
const hasExistingSecret =
webSearchProviderAcceptsApiKey(provider) &&
webSearchForm.provider === settings.web_search.provider &&
!!settings.web_search.api_key_hint;
if (webSearchProviderRequiresApiKey(provider) && !apiKey && !hasExistingSecret) {
return;
}
if (provider.credential === "base_url" && !baseUrl) {
return;
}
if (webSearchDraftState(settings, webSearchForm).missingCredential) return;
setError("web");
setWebSearchSaving(true);