diff --git a/src/routes/config.ts b/src/routes/config.ts index afb19c6..9bfe158 100644 --- a/src/routes/config.ts +++ b/src/routes/config.ts @@ -11,6 +11,9 @@ import { getGeminiApiKey, getOpenaiApiKey, updateConfig, + getCustomOpenaiApiUrl, + getCustomOpenaiApiKey, + getCustomOpenaiModelName, } from '../config'; import logger from '../utils/logger'; @@ -56,6 +59,9 @@ router.get('/', async (_, res) => { config['anthropicApiKey'] = getAnthropicApiKey(); config['groqApiKey'] = getGroqApiKey(); config['geminiApiKey'] = getGeminiApiKey(); + config['customOpenaiApiUrl'] = getCustomOpenaiApiUrl(); + config['customOpenaiApiKey'] = getCustomOpenaiApiKey(); + config['customOpenaiModelName'] = getCustomOpenaiModelName() res.status(200).json(config); } catch (err: any) { @@ -68,15 +74,30 @@ router.post('/', async (req, res) => { const config = req.body; const updatedConfig = { - API_KEYS: { - OPENAI: config.openaiApiKey, - GROQ: config.groqApiKey, - ANTHROPIC: config.anthropicApiKey, - GEMINI: config.geminiApiKey, - }, - API_ENDPOINTS: { - OLLAMA: config.ollamaApiUrl, - LMSTUDIO: config.lmStudioApiUrl, + MODELS: { + OPENAI: { + API_KEY: config.openaiApiKey, + }, + GROQ: { + API_KEY: config.groqApiKey, + }, + ANTHROPIC: { + API_KEY: config.anthropicApiKey, + }, + GEMINI: { + API_KEY: config.geminiApiKey, + }, + OLLAMA: { + API_URL: config.ollamaApiUrl, + }, + LMSTUDIO: { + API_URL: config.lmStudioApiUrl, + }, + CUSTOM_OPENAI: { + API_URL: config.customOpenaiApiUrl, + API_KEY: config.customOpenaiApiKey, + MODEL_NAME: config.customOpenaiModelName, + }, }, };