LibreChat/api/cache
Atef Bellaaj d481b6b695
🏬 feat: Sync Langfuse Prompts into the Catalog (#17095)
* feat(prompts): sync Langfuse prompts into the catalog

* refactor(prompts): compose the Langfuse prompt sync runner outside the admin handler

Add createLangfusePromptSyncRunner, which binds the lock, the prompt-group
methods, the ACL grant and the Mongo error predicates once and returns a
runner that takes the per-request source, connection-bound listPrompts,
lock lease and page cap. The admin handler receives that runner as one
dependency instead of forwarding its parts, and its config method
signatures return a LangfuseAdminConfig interface in place of Mongoose
document types.

In api, api/cache/distributedLock.js creates the one DistributedLock for
the process and api/server/services/LangfusePromptSync.js composes the
runner once with it; the admin route imports the composed runner.

* fix(prompts): report incomplete Langfuse syncs and gate the sync action

- Refresh the prompt-group and effective-permission queries after a failed
  sync too, because earlier imports can already be committed.
- Return `complete: false` when the page limit stops a sync before the last
  upstream page, and show a warning instead of the success message.
- Show the Sync prompts action only to users with `manage:prompts`, the
  capability the sync route requires. Resolve the Langfuse startup-config
  capabilities in one batched lookup.
- Document that an interrupted import can leave a group without its initial
  PUBLIC grant, and that a page in progress can outlast an expired lease.

---------

Co-authored-by: Rebase Probe <probe@example.com>
2026-10-24 13:48:52 +02:00
..
banViolation.js 🪪 fix: Boot-Paint a Cached Theme Only for Its Signed-In Owner (#16926) 2026-10-14 11:08:53 +02:00
banViolation.spec.js 🛶 fix: Keep Trigger Bans Off Shared Loopback IPs (#16535) 2026-09-29 20:50:23 -04:00
clearPendingReq.js
distributedLock.js 🏬 feat: Sync Langfuse Prompts into the Catalog (#17095) 2026-10-24 13:48:52 +02:00
distributedLock.spec.js 🏬 feat: Sync Langfuse Prompts into the Catalog (#17095) 2026-10-24 13:48:52 +02:00
getLogStores.js 🧹 fix: Stop Cache Audit From Logging Cache Keys and Values (#16995) 2026-10-12 15:59:43 +02:00
getLogStores.spec.js 🧹 fix: Stop Cache Audit From Logging Cache Keys and Values (#16995) 2026-10-12 15:59:43 +02:00
index.js 🏬 feat: Sync Langfuse Prompts into the Catalog (#17095) 2026-10-24 13:48:52 +02:00
logViolation.js 🔑 fix: Stringify Ban Cache Keys When Redis Is Off (#16039) 2026-09-19 15:52:06 -04:00