mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-16 13:00:55 +00:00
* 🔗 feat(agents): use LibreChat prompt groups as agent instructions
Agents can link a prompt group revision or Production as their instructions. The link resolves at the start of each turn through a cached resolver. The cache clears on promote and delete. Editors without VIEW on the group see a restricted placeholder.
* fix: remove duplicate logger import from agent initialization tests
* fix: honor prompt management capabilities for linked agent instructions
* test: seed prompt manager capabilities in authorization fixtures
* fix: clear acknowledged linked prompt edits before version restore
* test: adapt merged chain coverage to prompt-aware payload helper
---------
Co-authored-by: Lia <lia@librechat.ai>
25 lines
1 KiB
JavaScript
25 lines
1 KiB
JavaScript
const { logger } = require('@librechat/data-schemas');
|
|
const { CacheKeys } = require('librechat-data-provider');
|
|
const { createPromptService, createLinkedInstructionsResolver } = require('@librechat/api');
|
|
const { grantPermission } = require('~/server/services/PermissionService');
|
|
const { getLogStores } = require('~/cache');
|
|
const db = require('~/models');
|
|
|
|
/**
|
|
* 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: createPromptService({ db, grantPermission }),
|
|
cache: getLogStores(CacheKeys.AGENT_LINKED_INSTRUCTIONS),
|
|
logger,
|
|
});
|
|
|
|
/** @returns {import('@librechat/api').ResolveLinkedInstructions} */
|
|
function getLinkedInstructionsResolver() {
|
|
return linkedInstructionsResolver;
|
|
}
|
|
|
|
module.exports = { getLinkedInstructionsResolver };
|