From 7229a6d91ffea60836d5fcc561590748e2c59786 Mon Sep 17 00:00:00 2001 From: projectmoon Date: Sat, 29 Jun 2024 10:45:37 +0200 Subject: [PATCH] better --- src/config.ts | 2 ++ src/lib/providers.ts | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/config.ts b/src/config.ts index 7c0c7f1..172c8ca 100644 --- a/src/config.ts +++ b/src/config.ts @@ -41,6 +41,8 @@ export const getSearxngApiEndpoint = () => loadConfig().API_ENDPOINTS.SEARXNG; export const getOllamaApiEndpoint = () => loadConfig().API_ENDPOINTS.OLLAMA; +export const getOllamaAuthHeader = () => loadConfig().API_ENDPOINTS.OLLAMA_AUTH_HEADER; + export const updateConfig = (config: RecursivePartial) => { const currentConfig = loadConfig(); diff --git a/src/lib/providers.ts b/src/lib/providers.ts index 3bf23b6..224448f 100644 --- a/src/lib/providers.ts +++ b/src/lib/providers.ts @@ -13,6 +13,7 @@ export const getAvailableChatModelProviders = async () => { const openAIApiKey = getOpenaiApiKey(); const groqApiKey = getGroqApiKey(); const ollamaEndpoint = getOllamaApiEndpoint(); + const ollamaAuthHeader = getOllamaAuthHeader(); const models = {}; @@ -96,10 +97,10 @@ export const getAvailableChatModelProviders = async () => { if (ollamaEndpoint) { let headers; - if (typeof process.env['OLLAMA_AUTH_HEADER'] !== undefined) { + if (typeof ollamaAuthHeader !== undefined) { headers = { 'Content-Type': 'application/json', - 'Authorization': process.env['OLLAMA_AUTH_HEADER'] + 'Authorization': ollamaAuthHeader }; } else { headers = { 'Content-Type': 'application/json' };