ghetto ollama auth
This commit is contained in:
parent
c62684407d
commit
e34b6f3d8d
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue