This commit is contained in:
projectmoon 2024-06-29 10:45:37 +02:00
parent e34b6f3d8d
commit 7229a6d91f
2 changed files with 5 additions and 2 deletions

View File

@ -41,6 +41,8 @@ export const getSearxngApiEndpoint = () => loadConfig().API_ENDPOINTS.SEARXNG;
export const getOllamaApiEndpoint = () => loadConfig().API_ENDPOINTS.OLLAMA; export const getOllamaApiEndpoint = () => loadConfig().API_ENDPOINTS.OLLAMA;
export const getOllamaAuthHeader = () => loadConfig().API_ENDPOINTS.OLLAMA_AUTH_HEADER;
export const updateConfig = (config: RecursivePartial<Config>) => { export const updateConfig = (config: RecursivePartial<Config>) => {
const currentConfig = loadConfig(); const currentConfig = loadConfig();

View File

@ -13,6 +13,7 @@ export const getAvailableChatModelProviders = async () => {
const openAIApiKey = getOpenaiApiKey(); const openAIApiKey = getOpenaiApiKey();
const groqApiKey = getGroqApiKey(); const groqApiKey = getGroqApiKey();
const ollamaEndpoint = getOllamaApiEndpoint(); const ollamaEndpoint = getOllamaApiEndpoint();
const ollamaAuthHeader = getOllamaAuthHeader();
const models = {}; const models = {};
@ -96,10 +97,10 @@ export const getAvailableChatModelProviders = async () => {
if (ollamaEndpoint) { if (ollamaEndpoint) {
let headers; let headers;
if (typeof process.env['OLLAMA_AUTH_HEADER'] !== undefined) { if (typeof ollamaAuthHeader !== undefined) {
headers = { headers = {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Authorization': process.env['OLLAMA_AUTH_HEADER'] 'Authorization': ollamaAuthHeader
}; };
} else { } else {
headers = { 'Content-Type': 'application/json' }; headers = { 'Content-Type': 'application/json' };