mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
🔧 fix: Agent Resource Form, Convo Menu Style, Ensure Draft Clears on Submission (#6925)
* ✨ style: Adjust z-index for popover UI and update className in ConvoOptions * ✨ feat: Add 'spec' field to conversation query selection * 🛠️ fix: add back conversationId to use Constants.PENDING_CONVO in useSSE hook on submission to allow text drafts to clear * ✨ chore: add .clineignore to .gitignore for Cline configuration * ✨ refactor: memoize FileSearchCheckbox component for performance optimization * fix: agent resource management by adding tool_resource to agent's tools if missing
This commit is contained in:
parent
6edd93f99e
commit
851938e7a6
9 changed files with 69 additions and 8 deletions
|
|
@ -33,6 +33,50 @@ describe('Agent Resource File Operations', () => {
|
|||
return agent;
|
||||
};
|
||||
|
||||
test('should add tool_resource to tools if missing', async () => {
|
||||
const agent = await createBasicAgent();
|
||||
const fileId = uuidv4();
|
||||
const toolResource = 'file_search';
|
||||
|
||||
const updatedAgent = await addAgentResourceFile({
|
||||
agent_id: agent.id,
|
||||
tool_resource: toolResource,
|
||||
file_id: fileId,
|
||||
});
|
||||
|
||||
expect(updatedAgent.tools).toContain(toolResource);
|
||||
expect(Array.isArray(updatedAgent.tools)).toBe(true);
|
||||
// Should not duplicate
|
||||
const count = updatedAgent.tools.filter((t) => t === toolResource).length;
|
||||
expect(count).toBe(1);
|
||||
});
|
||||
|
||||
test('should not duplicate tool_resource in tools if already present', async () => {
|
||||
const agent = await createBasicAgent();
|
||||
const fileId1 = uuidv4();
|
||||
const fileId2 = uuidv4();
|
||||
const toolResource = 'file_search';
|
||||
|
||||
// First add
|
||||
await addAgentResourceFile({
|
||||
agent_id: agent.id,
|
||||
tool_resource: toolResource,
|
||||
file_id: fileId1,
|
||||
});
|
||||
|
||||
// Second add (should not duplicate)
|
||||
const updatedAgent = await addAgentResourceFile({
|
||||
agent_id: agent.id,
|
||||
tool_resource: toolResource,
|
||||
file_id: fileId2,
|
||||
});
|
||||
|
||||
expect(updatedAgent.tools).toContain(toolResource);
|
||||
expect(Array.isArray(updatedAgent.tools)).toBe(true);
|
||||
const count = updatedAgent.tools.filter((t) => t === toolResource).length;
|
||||
expect(count).toBe(1);
|
||||
});
|
||||
|
||||
test('should handle concurrent file additions', async () => {
|
||||
const agent = await createBasicAgent();
|
||||
const fileIds = Array.from({ length: 10 }, () => uuidv4());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue