mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-27 04:07:05 +00:00
fix: pass entity_id=skillId on batch upload, eliminates per-user cache thrashing
primeSkillFiles now passes entity_id: skill._id.toString() to batchUploadCodeEnvFiles. This scopes the code env session to the skill, not the user. All users sharing a skill share the same uploaded files — no more cache thrashing from overwriting each other's codeEnvIdentifier. The stored codeEnvIdentifier now includes ?entity_id= suffix so freshness checks pass the entity_id through to the per-object stat endpoint. Both primeSkillFiles and primeInvokedSkills store consistent identifier formats.
This commit is contained in:
parent
e4bfa0a5be
commit
c2e24eaf26
1 changed files with 12 additions and 3 deletions
|
|
@ -145,7 +145,13 @@ export async function primeSkillFiles(
|
|||
}
|
||||
|
||||
try {
|
||||
const result = await batchUploadCodeEnvFiles({ req, files: filesToUpload, apiKey });
|
||||
const entityId = skill._id.toString();
|
||||
const result = await batchUploadCodeEnvFiles({
|
||||
req,
|
||||
files: filesToUpload,
|
||||
apiKey,
|
||||
entity_id: entityId,
|
||||
});
|
||||
const files = result.files.map((f) => ({
|
||||
id: f.fileId,
|
||||
session_id: result.session_id,
|
||||
|
|
@ -159,7 +165,7 @@ export async function primeSkillFiles(
|
|||
.map((f) => ({
|
||||
skillId: skill._id,
|
||||
relativePath: f.filename.slice(f.filename.indexOf('/') + 1),
|
||||
codeEnvIdentifier: `${result.session_id}/${f.fileId}`,
|
||||
codeEnvIdentifier: `${result.session_id}/${f.fileId}?entity_id=${entityId}`,
|
||||
}));
|
||||
if (updates.length > 0) {
|
||||
updateSkillFileCodeEnvIds(updates).catch((err: unknown) => {
|
||||
|
|
@ -393,10 +399,13 @@ export async function primeInvokedSkills(
|
|||
`[primeInvokedSkills] No skill record found for filename "${f.filename}"`,
|
||||
);
|
||||
}
|
||||
const entityId = record?.skill._id?.toString() ?? '';
|
||||
return {
|
||||
skillId: record?.skill._id ?? '',
|
||||
relativePath: relPath,
|
||||
codeEnvIdentifier: `${result.session_id}/${f.fileId}`,
|
||||
codeEnvIdentifier: entityId
|
||||
? `${result.session_id}/${f.fileId}?entity_id=${entityId}`
|
||||
: `${result.session_id}/${f.fileId}`,
|
||||
};
|
||||
})
|
||||
.filter((u) => u.skillId !== '');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue