mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +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 type { ClientOptions } from 'openai';
|
||||||
|
|
||||||
import { logWrapper } from '@utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
|
|
||||||
|
import { getProxyAgent } from '@utils/httpProxyAgent';
|
||||||
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
const modelParameter: INodeProperties = {
|
const modelParameter: INodeProperties = {
|
||||||
@@ -227,6 +229,12 @@ export class EmbeddingsOpenAi implements INodeType {
|
|||||||
configuration.baseURL = credentials.url as string;
|
configuration.baseURL = credentials.url as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (configuration.baseURL) {
|
||||||
|
configuration.fetchOptions = {
|
||||||
|
dispatcher: getProxyAgent(configuration.baseURL ?? 'https://api.openai.com/v1'),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const embeddings = new OpenAIEmbeddings({
|
const embeddings = new OpenAIEmbeddings({
|
||||||
modelName: this.getNodeParameter('model', itemIndex, 'text-embedding-3-small') as string,
|
modelName: this.getNodeParameter('model', itemIndex, 'text-embedding-3-small') as string,
|
||||||
openAIApiKey: credentials.apiKey as string,
|
openAIApiKey: credentials.apiKey as string,
|
||||||
|
|||||||
Reference in New Issue
Block a user