mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-18 14:08:21 +00:00
16 lines
653 B
JavaScript
16 lines
653 B
JavaScript
const { GenerationJobManager, withAssistantRun } = require('@librechat/api');
|
|
const db = require('~/models');
|
|
|
|
/**
|
|
* Registers an Assistants controller's runs with the account cleanup barrier, so account deletion
|
|
* refuses new runs, stops the running ones, and waits for their writes before erasing the data.
|
|
* @template {(req: ServerRequest, res: Express.Response) => Promise<unknown>} T
|
|
* @param {T} controller
|
|
*/
|
|
const enrollAssistantRun = (controller) =>
|
|
withAssistantRun(controller, {
|
|
manager: GenerationJobManager,
|
|
isPrincipalActive: (userId) => db.isAgentTriggerPrincipalActive(userId),
|
|
});
|
|
|
|
module.exports = enrollAssistantRun;
|