mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-27 12:13:30 +00:00
* feat: introduce optional content protection seam * feat: enforce source-aware content filters * feat: complete source-aware content enforcement * test: activate skill file-text fail-close fixtures * fix: harden source-aware content filters * fix: harden model-bound content filtering * fix: preserve legacy filters and generated files * fix: inspect shared scalar metadata * test: align mocks with current dev dependencies * feat: add persisted content filter safeguards * feat: complete source-aware content filter enforcement * fix: move resume content preflight into TypeScript * fix: close content inspection edge cases * fix: harden content protection boundaries * fix: complete content protection safeguards * test: align persisted memory filter coverage * fix: reconcile content protection with current dev * fix: reconcile content protection with latest dev * fix: close content protection review gaps * fix: enforce source-aware provider boundaries * fix: preserve legacy PII preflight semantics * test: stabilize stored branch preflight fixture * fix: defer agent writes until protected model admission * perf: harden source-aware model-bound filtering * fix: canonicalize provider lineage before validation * fix: satisfy model-bound callback type checks * perf: Bound content protection filtering work * fix: Bound submission array traversal * fix: Stabilize bounded content snapshots * fix: Scope model-bound traversal overflows * fix: Preserve scoped content inspection * fix: Accumulate aggregate traversal scopes * fix: centralize content policy boundaries * test: align deferred tool policy context * test: align controller policy mocks * style: normalize content protection imports * fix: close content policy review gaps * fix: narrow active skill policy config * fix: address content protection review boundaries * fix: retain exact provenance overflow sentinel * fix: preserve literal and scoped provenance updates * fix: narrow persisted edit provenance * fix: isolate exact overflow attribution * fix: centralize stored prompt protection * fix: fail closed on incomplete transcript evidence * fix: align canonical transcript routing * refactor: centralize content policy preflights * fix: isolate upload policy error typing * style: sort policy preflight imports * refactor: centralize content policy boundaries
91 lines
2.9 KiB
JavaScript
91 lines
2.9 KiB
JavaScript
const express = require('express');
|
|
const { createContentFilter, extractAssistantContent } = require('@librechat/api');
|
|
const { configMiddleware } = require('~/server/middleware');
|
|
const v1 = require('~/server/controllers/assistants/v1');
|
|
const v2 = require('~/server/controllers/assistants/v2');
|
|
const { getFiles } = require('~/models');
|
|
const documents = require('./documents');
|
|
const actions = require('./actions');
|
|
const tools = require('./tools');
|
|
|
|
const router = express.Router();
|
|
router.use(configMiddleware);
|
|
const filterAssistantContent = createContentFilter({
|
|
getFilters: (req) => req.config?.filters,
|
|
extract: (req) => extractAssistantContent(req.body),
|
|
getOpaqueFileInput: (req) => req.body,
|
|
getFiles,
|
|
});
|
|
|
|
/**
|
|
* Assistant actions route.
|
|
* @route GET|POST /assistants/actions
|
|
*/
|
|
router.use('/actions', actions);
|
|
|
|
/**
|
|
* Create an assistant.
|
|
* @route GET /assistants/tools
|
|
* @returns {TPlugin[]} 200 - application/json
|
|
*/
|
|
router.use('/tools', tools);
|
|
|
|
/**
|
|
* Create an assistant.
|
|
* @route GET /assistants/documents
|
|
* @returns {AssistantDocument[]} 200 - application/json
|
|
*/
|
|
router.use('/documents', documents);
|
|
|
|
/**
|
|
* Create an assistant.
|
|
* @route POST /assistants
|
|
* @param {AssistantCreateParams} req.body - The assistant creation parameters.
|
|
* @returns {Assistant} 201 - success response - application/json
|
|
*/
|
|
router.post('/', filterAssistantContent, v2.createAssistant);
|
|
|
|
/**
|
|
* Retrieves an assistant.
|
|
* @route GET /assistants/:id
|
|
* @param {string} req.params.id - Assistant identifier.
|
|
* @returns {Assistant} 200 - success response - application/json
|
|
*/
|
|
router.get('/:id', v1.retrieveAssistant);
|
|
|
|
/**
|
|
* Modifies an assistant.
|
|
* @route PATCH /assistants/:id
|
|
* @param {string} req.params.id - Assistant identifier.
|
|
* @param {AssistantUpdateParams} req.body - The assistant update parameters.
|
|
* @returns {Assistant} 200 - success response - application/json
|
|
*/
|
|
router.patch('/:id', filterAssistantContent, v2.patchAssistant);
|
|
|
|
/**
|
|
* Deletes an assistant.
|
|
* @route DELETE /assistants/:id
|
|
* @param {string} req.params.id - Assistant identifier.
|
|
* @returns {Assistant} 200 - success response - application/json
|
|
*/
|
|
router.delete('/:id', v1.deleteAssistant);
|
|
|
|
/**
|
|
* Returns a list of assistants.
|
|
* @route GET /assistants
|
|
* @param {AssistantListParams} req.query - The assistant list parameters for pagination and sorting.
|
|
* @returns {AssistantListResponse} 200 - success response - application/json
|
|
*/
|
|
router.get('/', v1.listAssistants);
|
|
|
|
/**
|
|
* Uploads and updates an avatar for a specific assistant.
|
|
* @route POST /avatar/:assistant_id
|
|
* @param {string} req.params.assistant_id - The ID of the assistant.
|
|
* @param {Express.Multer.File} req.file - The avatar image file.
|
|
* @param {string} [req.body.metadata] - Optional metadata for the assistant's avatar.
|
|
* @returns {Object} 200 - success response - application/json
|
|
*/
|
|
router.post('/avatar/:assistant_id', v1.uploadAssistantAvatar);
|
|
|
|
module.exports = router;
|