mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(Ollama Credentials): Add optional API key support to Ollama credentials (Openwebui proxy) (#17857)
This commit is contained in:
committed by
GitHub
parent
c4c46b8ff9
commit
acfb79bd97
@@ -1,4 +1,9 @@
|
||||
import type { ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
||||
import type {
|
||||
ICredentialTestRequest,
|
||||
ICredentialType,
|
||||
INodeProperties,
|
||||
IAuthenticateGeneric,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export class OllamaApi implements ICredentialType {
|
||||
name = 'ollamaApi';
|
||||
@@ -15,12 +20,30 @@ export class OllamaApi implements ICredentialType {
|
||||
type: 'string',
|
||||
default: 'http://localhost:11434',
|
||||
},
|
||||
{
|
||||
displayName: 'API Key',
|
||||
hint: 'When using Ollama behind a proxy with authentication (such as Open WebUI), provide the Bearer token/API key here. This is not required for the default Ollama installation',
|
||||
name: 'apiKey',
|
||||
type: 'string',
|
||||
typeOptions: { password: true },
|
||||
default: '',
|
||||
required: false,
|
||||
},
|
||||
];
|
||||
|
||||
authenticate: IAuthenticateGeneric = {
|
||||
type: 'generic',
|
||||
properties: {
|
||||
headers: {
|
||||
Authorization: '=Bearer {{$credentials.apiKey}}',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
test: ICredentialTestRequest = {
|
||||
request: {
|
||||
baseURL: '={{ $credentials.baseUrl }}',
|
||||
url: '/',
|
||||
url: '/api/tags',
|
||||
method: 'GET',
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user