ghetto ollama auth
This commit is contained in:
parent
c62684407d
commit
e34b6f3d8d
|
@ -95,12 +95,18 @@ export const getAvailableChatModelProviders = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ollamaEndpoint) {
|
if (ollamaEndpoint) {
|
||||||
try {
|
let headers;
|
||||||
const response = await fetch(`${ollamaEndpoint}/api/tags`, {
|
if (typeof process.env['OLLAMA_AUTH_HEADER'] !== undefined) {
|
||||||
headers: {
|
headers = {
|
||||||
'Content-Type': 'application/json',
|
'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 });
|
||||||
|
|
||||||
const { models: ollamaModels } = (await response.json()) as any;
|
const { models: ollamaModels } = (await response.json()) as any;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue