mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
51 lines
1.0 KiB
TypeScript
51 lines
1.0 KiB
TypeScript
import type {
|
|
ICredentialTestRequest,
|
|
ICredentialType,
|
|
INodeProperties,
|
|
IAuthenticateGeneric,
|
|
} from 'n8n-workflow';
|
|
|
|
export class OllamaApi implements ICredentialType {
|
|
name = 'ollamaApi';
|
|
|
|
displayName = 'Ollama';
|
|
|
|
documentationUrl = 'ollama';
|
|
|
|
properties: INodeProperties[] = [
|
|
{
|
|
displayName: 'Base URL',
|
|
name: 'baseUrl',
|
|
required: true,
|
|
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: '/api/tags',
|
|
method: 'GET',
|
|
},
|
|
};
|
|
}
|