LibreChat/api/server/services/Endpoints/agents/linkedInstructions.js
Atef Bellaaj a2cd772d49
🏭 refactor: Centralize Source Prompt Imports in the Prompt Service (#17272)
PromptService gains importSourceGroup, which finds or creates a source
pointer group, grants the PUBLIC viewer role and rolls the group back if
the grant fails. The Langfuse catalog sync calls it instead of four
storage callbacks and two Mongo error predicates, and the prompt service
is composed once in api/server/services/Prompts.js and passed to the
prompt routes, linked instructions, instructions prompt access and the
Langfuse sync runner.

Co-authored-by: Rebase Probe <probe@example.com>
2026-10-24 13:51:31 +02:00

24 lines
958 B
JavaScript

const { logger } = require('@librechat/data-schemas');
const { CacheKeys } = require('librechat-data-provider');
const { createLinkedInstructionsResolver } = require('@librechat/api');
const { promptService } = require('~/server/services/Prompts');
const { getLogStores } = require('~/cache');
/**
* Shared resolver for an agent's `instructionsPrompt` link. Resolve and cache
* logic lives in `@librechat/api` (`createLinkedInstructionsResolver`); this
* module wires in the LibreChat prompt service and the
* `AGENT_LINKED_INSTRUCTIONS` cache namespace (`~/cache/getLogStores.js`).
*/
const linkedInstructionsResolver = createLinkedInstructionsResolver({
promptService,
cache: getLogStores(CacheKeys.AGENT_LINKED_INSTRUCTIONS),
logger,
});
/** @returns {import('@librechat/api').ResolveLinkedInstructions} */
function getLinkedInstructionsResolver() {
return linkedInstructionsResolver;
}
module.exports = { getLinkedInstructionsResolver };