Add config for multiple search engines

This commit is contained in:
Hadi Cherkaoui
2025-02-27 18:21:00 +01:00
parent df4350f966
commit 5b15bcfe17
5 changed files with 1058 additions and 1390 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
node_modules/
npm-debug.log
yarn-error.log
package-lock.json
# Build output
/.next/

View File

@ -2,6 +2,7 @@
PORT = 3001 # Port to run the server on
SIMILARITY_MEASURE = "cosine" # "cosine" or "dot"
KEEP_ALIVE = "5m" # How long to keep Ollama models loaded into memory. (Instead of using -1 use "-1m")
SEARCH_ENGINE_BACKEND = "google" # "google" | "searxng" | "ddg" | "bing" | "brave"
[MODELS.OPENAI]
API_KEY = ""
@ -22,5 +23,15 @@ API_URL = ""
[MODELS.OLLAMA]
API_URL = "" # Ollama API URL - http://host.docker.internal:11434
[API_ENDPOINTS]
SEARXNG = "http://localhost:32768" # SearxNG API URL
[SEARCH_ENGINES.GOOGLE]
API_KEY = ""
CSE_ID = ""
[SEARCH_ENGINES.SEARXNG]
ENDPOINT = ""
[SEARCH_ENGINES.BING]
SUBSCRIPTION_KEY = ""
[SEARCH_ENGINES.BRAVE]
API_KEY = ""

View File

@ -9,6 +9,7 @@ interface Config {
PORT: number;
SIMILARITY_MEASURE: string;
KEEP_ALIVE: string;
SEARCH_ENGINE_BACKEND: string;
};
MODELS: {
OPENAI: {
@ -32,8 +33,20 @@ interface Config {
MODEL_NAME: string;
};
};
API_ENDPOINTS: {
SEARXNG: string;
SEARCH_ENGINES: {
GOOGLE: {
API_KEY: string;
CSE_ID: string;
};
SEARXNG: {
ENDPOINT: string;
};
BING: {
SUBSCRIPTION_KEY: string;
};
BRAVE: {
API_KEY: string;
};
};
}
@ -61,8 +74,18 @@ export const getAnthropicApiKey = () => loadConfig().MODELS.ANTHROPIC.API_KEY;
export const getGeminiApiKey = () => loadConfig().MODELS.GEMINI.API_KEY;
export const getSearchEngineBackend = () => loadConfig().GENERAL.SEARCH_ENGINE_BACKEND;
export const getGoogleApiKey = () => loadConfig().SEARCH_ENGINES.GOOGLE.API_KEY;
export const getGoogleCseId = () => loadConfig().SEARCH_ENGINES.GOOGLE.CSE_ID;
export const getBraveApiKey = () => loadConfig().SEARCH_ENGINES.BRAVE.API_KEY;
export const getBingSubscriptionKey = () => loadConfig().SEARCH_ENGINES.BING.SUBSCRIPTION_KEY;
export const getSearxngApiEndpoint = () =>
process.env.SEARXNG_API_URL || loadConfig().API_ENDPOINTS.SEARXNG;
process.env.SEARXNG_API_URL || loadConfig().SEARCH_ENGINES.SEARXNG.ENDPOINT;
export const getOllamaApiEndpoint = () => loadConfig().MODELS.OLLAMA.API_URL;

File diff suppressed because it is too large Load Diff

1313
yarn.lock

File diff suppressed because it is too large Load Diff