mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-27 04:07:05 +00:00
fix: restore inherited Langfuse agent state
This commit is contained in:
parent
001c3b5401
commit
dc2fa2b40b
10 changed files with 170 additions and 9 deletions
|
|
@ -988,6 +988,36 @@ describe('Agent Controllers - Mass Assignment Protection', () => {
|
|||
expect(latestVersion.langfuse).toBeUndefined();
|
||||
});
|
||||
|
||||
test('should remove Langfuse config when update clears only enabled inheritance override', async () => {
|
||||
await Agent.updateOne(
|
||||
{ id: existingAgentId },
|
||||
{
|
||||
langfuse: {
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
mockReq.params.id = existingAgentId;
|
||||
mockReq.body = {
|
||||
langfuse: {
|
||||
enabled: null,
|
||||
publicKey: '',
|
||||
secretKey: '',
|
||||
baseUrl: '',
|
||||
},
|
||||
};
|
||||
|
||||
await updateAgentHandler(mockReq, mockRes);
|
||||
|
||||
expect(mockRes.json).toHaveBeenCalled();
|
||||
const updatedAgent = mockRes.json.mock.calls[0][0];
|
||||
expect(updatedAgent.langfuse).toBeUndefined();
|
||||
|
||||
const agentInDb = await Agent.findOne({ id: existingAgentId }).lean();
|
||||
expect(agentInDb.langfuse).toBeUndefined();
|
||||
});
|
||||
|
||||
test('uploadAgentAvatarHandler should redact Langfuse secret in response', async () => {
|
||||
await Agent.updateOne(
|
||||
{ id: existingAgentId },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue