import { useTranslation } from "react-i18next" import type { WebSearchConfigResponse } from "@/api/tools" import { ConfigChangeNotice } from "@/components/config-change-notice" import { Button } from "@/components/ui/button" import { Skeleton } from "@/components/ui/skeleton" import type { WebSearchDraftUpdater } from "./types" import { WebSearchGeneralSettings } from "./web-search-general-settings" import { WebSearchProviderSettings } from "./web-search-provider-settings" interface WebSearchTabProps { draft: WebSearchConfigResponse | null providerLabelMap: Map expandedProvider: string | null isLoading: boolean hasError: boolean isSaving: boolean isDirty: boolean onSave: () => void onToggleProviderExpand: (providerId: string) => void onUpdateDraft: WebSearchDraftUpdater } export function WebSearchTab({ draft, providerLabelMap, expandedProvider, isLoading, hasError, isSaving, isDirty, onSave, onToggleProviderExpand, onUpdateDraft, }: WebSearchTabProps) { const { t } = useTranslation() return (
{hasError ? (

{t( "pages.agent.tools.web_search.load_error", "Failed to load web search configuration", )}

) : isLoading || !draft ? ( ) : ( <>

{t( "pages.agent.tools.web_search.title", "Web Search Configuration", )}

{t( "pages.agent.tools.web_search.description", "Configure how the web search tool behaves by default, including whether the model may use its built-in search capability.", )}

{isDirty && ( )}
)}
) } function LoadingState() { return (
) }