diff --git a/api/app/clients/OpenAIClient.js b/api/app/clients/OpenAIClient.js index 4f5e29cac8..dce5ec54fa 100644 --- a/api/app/clients/OpenAIClient.js +++ b/api/app/clients/OpenAIClient.js @@ -199,8 +199,8 @@ class OpenAIClient extends BaseClient { model: this.modelOptions.model, endpoint: this.options.endpoint, endpointType: this.options.endpointType, - chatGptLabel: this.options.chatGptLabel, modelDisplayLabel: this.options.modelDisplayLabel, + chatGptLabel: this.options.chatGptLabel || this.options.modelLabel, }); this.userLabel = this.options.userLabel || 'User'; diff --git a/api/server/services/Endpoints/gptPlugins/buildOptions.js b/api/server/services/Endpoints/gptPlugins/buildOptions.js index 1a7f26beb6..0d1ec097ad 100644 --- a/api/server/services/Endpoints/gptPlugins/buildOptions.js +++ b/api/server/services/Endpoints/gptPlugins/buildOptions.js @@ -3,6 +3,7 @@ const generateArtifactsPrompt = require('~/app/clients/prompts/artifacts'); const buildOptions = (endpoint, parsedBody) => { const { + modelLabel, chatGptLabel, promptPrefix, agentOptions, @@ -16,10 +17,10 @@ const buildOptions = (endpoint, parsedBody) => { } = parsedBody; const endpointOption = removeNullishValues({ endpoint, - tools: - tools - .map((tool) => tool?.pluginKey ?? tool) - .filter((toolName) => typeof toolName === 'string'), + tools: tools + .map((tool) => tool?.pluginKey ?? tool) + .filter((toolName) => typeof toolName === 'string'), + modelLabel, chatGptLabel, promptPrefix, agentOptions, diff --git a/packages/data-provider/src/parsers.ts b/packages/data-provider/src/parsers.ts index 3230374735..f313aa9a3b 100644 --- a/packages/data-provider/src/parsers.ts +++ b/packages/data-provider/src/parsers.ts @@ -220,13 +220,16 @@ export const getResponseSender = (endpointOption: t.TEndpointOption): string => model: _m, endpoint, endpointType, - modelDisplayLabel, - chatGptLabel, - modelLabel, + modelDisplayLabel: _mdl, + chatGptLabel: _cgl, + modelLabel: _ml, jailbreak, } = endpointOption; const model = _m ?? ''; + const modelDisplayLabel = _mdl ?? ''; + const chatGptLabel = _cgl ?? ''; + const modelLabel = _ml ?? ''; if ( [ EModelEndpoint.openAI, @@ -238,6 +241,8 @@ export const getResponseSender = (endpointOption: t.TEndpointOption): string => ) { if (chatGptLabel) { return chatGptLabel; + } else if (modelLabel) { + return modelLabel; } else if (model && /\bo1\b/i.test(model)) { return 'o1'; } else if (model && model.includes('gpt-3')) { @@ -257,11 +262,11 @@ export const getResponseSender = (endpointOption: t.TEndpointOption): string => } if (endpoint === EModelEndpoint.anthropic) { - return modelLabel ?? 'Claude'; + return modelLabel || 'Claude'; } if (endpoint === EModelEndpoint.bedrock) { - return modelLabel ?? alternateName[endpoint]; + return modelLabel || alternateName[endpoint]; } if (endpoint === EModelEndpoint.google) { diff --git a/packages/data-provider/src/schemas.ts b/packages/data-provider/src/schemas.ts index 980cb3b2dd..1d9a03a67d 100644 --- a/packages/data-provider/src/schemas.ts +++ b/packages/data-provider/src/schemas.ts @@ -1018,6 +1018,7 @@ export const compactChatGPTSchema = tConversationSchema export const compactPluginsSchema = tConversationSchema .pick({ model: true, + modelLabel: true, chatGptLabel: true, promptPrefix: true, temperature: true, @@ -1033,6 +1034,9 @@ export const compactPluginsSchema = tConversationSchema }) .transform((obj) => { const newObj: Partial = { ...obj }; + if (newObj.modelLabel === null) { + delete newObj.modelLabel; + } if (newObj.chatGptLabel === null) { delete newObj.chatGptLabel; }