mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
feat: Add HTTP proxy support for OpenAI Embeddings node (#17173)
This commit is contained in:
@@ -10,6 +10,8 @@ import {
|
||||
import type { ClientOptions } from 'openai';
|
||||
|
||||
import { logWrapper } from '@utils/logWrapper';
|
||||
|
||||
import { getProxyAgent } from '@utils/httpProxyAgent';
|
||||
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||
|
||||
const modelParameter: INodeProperties = {
|
||||
@@ -227,6 +229,12 @@ export class EmbeddingsOpenAi implements INodeType {
|
||||
configuration.baseURL = credentials.url as string;
|
||||
}
|
||||
|
||||
if (configuration.baseURL) {
|
||||
configuration.fetchOptions = {
|
||||
dispatcher: getProxyAgent(configuration.baseURL ?? 'https://api.openai.com/v1'),
|
||||
};
|
||||
}
|
||||
|
||||
const embeddings = new OpenAIEmbeddings({
|
||||
modelName: this.getNodeParameter('model', itemIndex, 'text-embedding-3-small') as string,
|
||||
openAIApiKey: credentials.apiKey as string,
|
||||
|
||||
Reference in New Issue
Block a user