Helper functions to resolve and validate the API key field for a dialog's configured web search provider, supporting keyless and keyed providers like Tavily.
// Source: https://github.com/infiniflow/ragflow | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import {
KEYLESS_WEB_SEARCH_PROVIDERS,
WebSearchProvider,
} from '@/constants/chat';
/**
* The subset of a dialog's prompt_config these helpers read — the web-search
* provider and its per-provider key slots.
*
* Structural rather than PromptConfig because the save-time form schema allows
* web_search_provider to be '' (a cleared select), which PromptConfig does not;
* with this shape the schema can call the helpers without casting.
*/
export type WebSearchKeyConfig = {
web_search_provider?: WebSearchProvider | '';
tavily_api_key?: string;
};
const WEB_SEARCH_PROVIDERS
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key