mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-05-13 07:46:47 +00:00
🧭 fix: Preserve Resend Files for Subagents (#13030)
This commit is contained in:
parent
a107520109
commit
22890771cf
2 changed files with 26 additions and 21 deletions
|
|
@ -579,24 +579,19 @@ const initializeClient = async ({ req, res, signal, endpointOption }) => {
|
|||
defaultActiveOnShare,
|
||||
},
|
||||
{
|
||||
getAgent: db.getAgent,
|
||||
checkPermission,
|
||||
logViolation,
|
||||
db: {
|
||||
getFiles: db.getFiles,
|
||||
getUserKey: db.getUserKey,
|
||||
getMessages: db.getMessages,
|
||||
getConvoFiles: db.getConvoFiles,
|
||||
updateFilesUsage: db.updateFilesUsage,
|
||||
getUserKeyValues: db.getUserKeyValues,
|
||||
getUserCodeFiles: db.getUserCodeFiles,
|
||||
getToolFilesByIds: db.getToolFilesByIds,
|
||||
getCodeGeneratedFiles: db.getCodeGeneratedFiles,
|
||||
filterFilesByAgentAccess,
|
||||
listSkillsByAccess: db.listSkillsByAccess,
|
||||
listAlwaysApplySkills: db.listAlwaysApplySkills,
|
||||
getSkillByName: db.getSkillByName,
|
||||
},
|
||||
getFiles: db.getFiles,
|
||||
getUserKey: db.getUserKey,
|
||||
getMessages: db.getMessages,
|
||||
getConvoFiles: db.getConvoFiles,
|
||||
updateFilesUsage: db.updateFilesUsage,
|
||||
getUserKeyValues: db.getUserKeyValues,
|
||||
getUserCodeFiles: db.getUserCodeFiles,
|
||||
getToolFilesByIds: db.getToolFilesByIds,
|
||||
getCodeGeneratedFiles: db.getCodeGeneratedFiles,
|
||||
filterFilesByAgentAccess,
|
||||
listSkillsByAccess: db.listSkillsByAccess,
|
||||
listAlwaysApplySkills: db.listAlwaysApplySkills,
|
||||
getSkillByName: db.getSkillByName,
|
||||
},
|
||||
);
|
||||
agentConfigs.set(agentId, config);
|
||||
|
|
|
|||
|
|
@ -328,9 +328,15 @@ describe('initializeClient — subagent loading', () => {
|
|||
const subagentConfig = makeSubagentConfig(SUBAGENT_ID);
|
||||
|
||||
let call = 0;
|
||||
mockInitializeAgent.mockImplementation(() =>
|
||||
Promise.resolve(++call === 1 ? primaryConfig : subagentConfig),
|
||||
);
|
||||
let subagentConvoFileIds;
|
||||
mockInitializeAgent.mockImplementation(async (params, dbDeps) => {
|
||||
call += 1;
|
||||
if (call === 1) {
|
||||
return primaryConfig;
|
||||
}
|
||||
subagentConvoFileIds = await dbDeps.getConvoFiles(params.conversationId);
|
||||
return subagentConfig;
|
||||
});
|
||||
|
||||
await initializeClient({
|
||||
req: makeSubagentReq(),
|
||||
|
|
@ -340,6 +346,10 @@ describe('initializeClient — subagent loading', () => {
|
|||
});
|
||||
|
||||
expect(mockInitializeAgent).toHaveBeenCalledTimes(2);
|
||||
const subagentDbDeps = mockInitializeAgent.mock.calls[1][1];
|
||||
expect(subagentDbDeps.getConvoFiles).toBeInstanceOf(Function);
|
||||
expect(subagentDbDeps.db).toBeUndefined();
|
||||
expect(subagentConvoFileIds).toEqual([]);
|
||||
|
||||
/** The subagent's AgentConfig is attached to the primary for run.ts to
|
||||
* turn into `SubagentConfig[]` on the parent's `AgentInputs`. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue