Skip to content

Commit

Permalink
Feature: now models are sorted correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Enrique Pedroza committed Nov 6, 2024
1 parent 73496d9 commit 650178e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
10 changes: 8 additions & 2 deletions api/server/controllers/ModelController.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { CacheKeys } = require('librechat-data-provider');
const { loadDefaultModels, loadConfigModels } = require('~/server/services/Config');
const { getLogStores } = require('~/cache');

const { parseModels} = require('~/utils')
/**
* @param {ServerRequest} req
*/
Expand Down Expand Up @@ -36,7 +36,13 @@ async function loadModels(req) {
}

async function modelController(req, res) {
const modelConfig = await loadModels(req);
var modelConfig = await loadModels(req);
/**
* Sort Model list
* @Author Enrique M Pedroza Castillo
* @Organization Intelequia
*/
modelConfig = await parseModels (modelConfig)
res.send(modelConfig);
}

Expand Down
12 changes: 12 additions & 0 deletions api/utils/intelequia/clientConfigurationRequests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
async function parseModels (models){
const {azureAssistants, azureOpenAI} = models
const assistantModelIndex = azureOpenAI.indexOf(azureAssistants[0])
const [model] = azureOpenAI.splice(assistantModelIndex,1)
azureOpenAI.unshift(model)
models.azureOpenAI = azureOpenAI;
return models
}

module.exports = {
parseModels
};
5 changes: 3 additions & 2 deletions api/utils/intelequia/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ const toolsConfigurations = require('./toolsConfigurations');
const pluginsAndTools = require('./pluginsAndTools');
const constants = require('./constants');
const dynamics = require('./dynamicsToken');

const clientConfigurationRequests = require('./clientConfigurationRequests')
module.exports = {
intelequiaCountTokens,
...dynamics,
...intelequiaConfigLoader,
...assistantPermission,
...toolsConfigurations,
...pluginsAndTools,
...constants
...constants,
...clientConfigurationRequests
}

0 comments on commit 650178e

Please sign in to comment.