mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-27 04:07:05 +00:00
☁️ fix: Enable Azure Agent Provider Uploads (#13045)
This commit is contained in:
parent
1e9d0cbd0d
commit
030dc98a1d
10 changed files with 176 additions and 12 deletions
|
|
@ -55,6 +55,10 @@ const systemTools = {
|
|||
|
||||
const MAX_SEARCH_LEN = 100;
|
||||
const escapeRegex = (str = '') => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
const getSafeModelParameters = (modelParameters) => {
|
||||
const { useResponsesApi } = modelParameters ?? {};
|
||||
return typeof useResponsesApi === 'boolean' ? { useResponsesApi } : {};
|
||||
};
|
||||
|
||||
/**
|
||||
* Looks up each referenced agent id in Mongo, splits them into three
|
||||
|
|
@ -458,6 +462,7 @@ const getAgentHandler = async (req, res, expandProperties = false) => {
|
|||
author: agent.author,
|
||||
provider: agent.provider,
|
||||
model: agent.model,
|
||||
model_parameters: getSafeModelParameters(agent.model_parameters),
|
||||
isPublic: agent.isPublic,
|
||||
version: agent.version,
|
||||
// Safe metadata
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ jest.mock('~/cache', () => ({
|
|||
|
||||
const {
|
||||
createAgent: createAgentHandler,
|
||||
getAgent: getAgentHandler,
|
||||
duplicateAgent: duplicateAgentHandler,
|
||||
revertAgentVersion: revertAgentVersionHandler,
|
||||
updateAgent: updateAgentHandler,
|
||||
|
|
@ -483,6 +484,34 @@ describe('Agent Controllers - Mass Assignment Protection', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('getAgentHandler', () => {
|
||||
test('should return the safe Responses API flag in the basic VIEW response', async () => {
|
||||
const agent = await Agent.create({
|
||||
id: `agent_${uuidv4()}`,
|
||||
name: 'Azure Agent',
|
||||
description: 'Uses Responses API',
|
||||
provider: 'azureOpenAI',
|
||||
model: 'gpt-5.5',
|
||||
author: mockReq.user.id,
|
||||
model_parameters: {
|
||||
useResponsesApi: true,
|
||||
temperature: 0.7,
|
||||
apiKey: 'secret-value',
|
||||
},
|
||||
});
|
||||
|
||||
mockReq.params = { id: agent.id };
|
||||
|
||||
await getAgentHandler(mockReq, mockRes);
|
||||
|
||||
expect(mockRes.status).toHaveBeenCalledWith(200);
|
||||
const response = mockRes.json.mock.calls[0][0];
|
||||
expect(response.model_parameters).toEqual({ useResponsesApi: true });
|
||||
expect(response.model_parameters.temperature).toBeUndefined();
|
||||
expect(response.model_parameters.apiKey).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('updateAgentHandler', () => {
|
||||
let existingAgentId;
|
||||
let existingAgentAuthorId;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue