mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat: Add HTTP proxy for supported LLM nodes (#15449)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import type { ILoadOptionsFunctions, INodeListSearchResult } from 'n8n-workflow';
|
||||
import OpenAI from 'openai';
|
||||
|
||||
import { getHttpProxyAgent } from '@utils/httpProxyAgent';
|
||||
|
||||
export async function searchModels(
|
||||
this: ILoadOptionsFunctions,
|
||||
filter?: string,
|
||||
@@ -11,7 +13,11 @@ export async function searchModels(
|
||||
(credentials.url as string) ||
|
||||
'https://api.openai.com/v1';
|
||||
|
||||
const openai = new OpenAI({ baseURL, apiKey: credentials.apiKey as string });
|
||||
const openai = new OpenAI({
|
||||
baseURL,
|
||||
apiKey: credentials.apiKey as string,
|
||||
httpAgent: getHttpProxyAgent(),
|
||||
});
|
||||
const { data: models = [] } = await openai.models.list();
|
||||
|
||||
const filteredModels = models.filter((model: { id: string }) => {
|
||||
|
||||
Reference in New Issue
Block a user