mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-14 03:30:19 +00:00
251e2ede5e
* ✨ feat(sandbox): sync user-uploaded files into the cloud sandbox Pre-load the files a user attached in a conversation (topic message files + session files) into the cloud sandbox the first time it is used, and tell the agent they are available. - FileModel.findFilesToInitInSandbox: merge messages_files (by topic) and files_to_sessions (by the topic's session), de-duped by file id - SandboxMiddlewareService.ensureFilesInitialized: on first tool call, presign download URLs and run an idempotent curl bootstrap into /mnt/data; guarded by an in-sandbox marker and a short-lived Redis hint, best-effort so it never blocks the actual tool call (caps: 50 files / 100MB / 120s) - Agent awareness via {{sandbox_uploaded_files}} in the cloud-sandbox systemRole, populated by both the server (RuntimeExecutors) and client (contextEngineering) placeholder generators Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * 🐛 fix(sandbox): make file sync work on all server runtimes & keep prompt consistent Address review feedback on the uploaded-files sync: 1. (high) The sync was a no-op on the cloudSandbox server runtime and the skills runtime because createSandboxService() was called without serverDB, so ensureFilesInitialized() returned early. Thread serverDB through both. (heterogeneous sandboxRunner is intentionally left out: it runs a coding agent in /workspace and does not use the cloud-sandbox systemRole.) 2. (medium) Drop the Redis "already initialized" hint. The in-sandbox marker is now the single source of truth for idempotency, so a recycled sandbox always re-syncs instead of being skipped by a stale 5-min Redis key. 3. (medium) Apply the 50-file / 100MB caps inside formatUploadedFilesPrompt (via the shared selectSandboxInitFiles), so the files the prompt advertises match exactly what the bootstrap downloads. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>