Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🔧 refactor: Revamp Model and Tool Filtering Logic (#5637)
Danny Avila0312d4f4f479
diff --git a/api/app/clients/OpenAIClient.js b/api/app/clients/OpenAIClient.jsindex 93fbe3c5bb..9334f1c28b 100644--- a/api/app/clients/OpenAIClient.js+++ b/api/app/clients/OpenAIClient.js@@ -1282,6 +1282,7 @@ ${convo}if (this.isOmni === true &&(this.azure || /o1(?!-(?:mini|preview)).*$/.test(modelOptions.model)) &&+ !/o3-.*$/.test(this.modelOptions.model) &&modelOptions.stream) {delete modelOptions.stream;diff --git a/api/server/services/ModelService.js b/api/server/services/ModelService.jsindex 0547d03187..1394a5d697 100644--- a/api/server/services/ModelService.js+++ b/api/server/services/ModelService.js@@ -159,8 +159,9 @@ const fetchOpenAIModels = async (opts, _models = []) => {}if (baseURL === openaiBaseURL) {- const regex = /(text-davinci-003|gpt-|o1-)/;- models = models.filter((model) => regex.test(model));+ const regex = /(text-davinci-003|gpt-|o\d+-)/;+ const excludeRegex = /audio|realtime/;+ models = models.filter((model) => regex.test(model) && !excludeRegex.test(model));const instructModels = models.filter((model) => model.includes('instruct'));const otherModels = models.filter((model) => !model.includes('instruct'));models = otherModels.concat(instructModels);diff --git a/api/server/services/ToolService.js b/api/server/services/ToolService.jsindex 08891c99b2..cf88c0b199 100644--- a/api/server/services/ToolService.js+++ b/api/server/services/ToolService.js@@ -101,6 +101,17 @@ function loadAndFormatTools({ directory, adminFilter = [], adminIncluded = [] })const basicToolInstances = [new Calculator(), ...createYouTubeTools({ override: true })];for (const toolInstance of basicToolInstances) {const formattedTool = formatToOpenAIAssistantTool(toolInstance);+ let toolName = formattedTool[Tools.function].name;+ toolName = toolkits.some((toolkit) => toolName.startsWith(toolkit.pluginKey))+ ? toolName.split('_')[0]+ : toolName;+ if (filter.has(toolName) && included.size === 0) {+ continue;+ }++ if (included.size > 0 && !included.has(toolName)) {+ continue;+ }tools.push(formattedTool);}diff --git a/api/strategies/openidStrategy.spec.js b/api/strategies/openidStrategy.spec.jsindex 7b8a3107a0..cea7c5e4a6 100644--- a/api/strategies/openidStrategy.spec.js+++ b/api/strategies/openidStrategy.spec.js@@ -245,15 +245,18 @@ describe('setupOpenId', () => {const userinfo = { ...baseUserinfo };// Act- const { user } = await validate(tokenset, userinfo);+ await validate(tokenset, userinfo);// Assert – updateUser should be called and the user object updated- expect(updateUser).toHaveBeenCalledWith(existingUser._id, expect.objectContaining({- provider: 'openid',- openidId: baseUserinfo.sub,- username: baseUserinfo.username,- name: `${baseUserinfo.given_name} ${baseUserinfo.family_name}`,- }));+ expect(updateUser).toHaveBeenCalledWith(+ existingUser._id,+ expect.objectContaining({+ provider: 'openid',+ openidId: baseUserinfo.sub,+ username: baseUserinfo.username,+ name: `${baseUserinfo.given_name} ${baseUserinfo.family_name}`,+ }),+ );});it('should enforce the required role and reject login if missing', async () => {@@ -268,9 +271,7 @@ describe('setupOpenId', () => {// Assert – verify that the strategy rejects loginexpect(user).toBe(false);- expect(details.message).toBe(- 'You must have the "requiredRole" role to log in.',- );+ expect(details.message).toBe('You must have the "requiredRole" role to log in.');});it('should attempt to download and save the avatar if picture is provided', async () => {@@ -292,10 +293,10 @@ describe('setupOpenId', () => {delete userinfo.picture;// Act- const { user } = await validate(tokenset, userinfo);+ await validate(tokenset, userinfo);// Assert – fetch should not be called and avatar should remain undefined or emptyexpect(fetch).not.toHaveBeenCalled();// Depending on your implementation, user.avatar may be undefined or an empty string.});-});\ No newline at end of file+});