ghetto ollama auth

This commit is contained in:
projectmoon 2024-06-29 10:41:30 +02:00
parent c62684407d
commit e34b6f3d8d
1 changed files with 11 additions and 5 deletions

View File

@ -95,12 +95,18 @@ export const getAvailableChatModelProviders = async () => {
}
if (ollamaEndpoint) {
let headers;
if (typeof process.env['OLLAMA_AUTH_HEADER'] !== undefined) {
headers = {
'Content-Type': 'application/json',
'Authorization': process.env['OLLAMA_AUTH_HEADER']
};
} else {
headers = { 'Content-Type': 'application/json' };
}
try {
const response = await fetch(`${ollamaEndpoint}/api/tags`, {
headers: {
'Content-Type': 'application/json',
},
});
const response = await fetch(`${ollamaEndpoint}/api/tags`, { headers });
const { models: ollamaModels } = (await response.json()) as any;