mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix(OpenAI Chat Model Node): Respect baseURL override for /models (#10076)
This commit is contained in:
@@ -90,7 +90,11 @@ export class LmChatOpenAi implements INodeType {
|
||||
{
|
||||
type: 'filter',
|
||||
properties: {
|
||||
pass: "={{ $responseItem.id.startsWith('gpt-') && !$responseItem.id.includes('instruct') }}",
|
||||
// If the baseURL is not set or is set to api.openai.com, include only chat models
|
||||
pass: `={{
|
||||
($parameter.options?.baseURL && !$parameter.options?.baseURL?.includes('api.openai.com')) ||
|
||||
($responseItem.id.startsWith('gpt-') && !$responseItem.id.includes('instruct'))
|
||||
}}`,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -119,6 +123,18 @@ export class LmChatOpenAi implements INodeType {
|
||||
},
|
||||
default: 'gpt-3.5-turbo',
|
||||
},
|
||||
{
|
||||
displayName:
|
||||
'When using non-OpenAI models via "Base URL" override, not all models might be chat-compatible or support other features, like tools calling or JSON response format',
|
||||
name: 'notice',
|
||||
type: 'notice',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
'/options.baseURL': [{ _cnd: { exists: true } }],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
|
||||
@@ -97,6 +97,18 @@ export class LmOpenAi implements INodeType {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName:
|
||||
'When using non OpenAI models via Base URL override, not all models might be chat-compatible or support other features, like tools calling or JSON response format.',
|
||||
name: 'notice',
|
||||
type: 'notice',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
'/options.baseURL': [{ _cnd: { exists: true } }],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
@@ -198,7 +210,7 @@ export class LmOpenAi implements INodeType {
|
||||
})) as { data: Array<{ owned_by: string; id: string }> };
|
||||
|
||||
for (const model of data) {
|
||||
if (!model.owned_by?.startsWith('system')) continue;
|
||||
if (!options.baseURL && !model.owned_by?.startsWith('system')) continue;
|
||||
results.push({
|
||||
name: model.id,
|
||||
value: model.id,
|
||||
|
||||
Reference in New Issue
Block a user