mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
refactor: Unify streamId and conversationId handling for improved job management
- Updated ResumableAgentController and AgentController to generate conversationId upfront, ensuring it matches streamId for consistency. - Simplified job creation and metadata management by removing redundant conversationId updates from callbacks. - Refactored abortMiddleware and related methods to utilize the unified streamId/conversationId approach, enhancing clarity in job handling. - Removed deprecated methods from GenerationJobManager and InMemoryJobStore, streamlining the codebase and improving maintainability.
This commit is contained in:
parent
3a23badf5f
commit
8d34291f6a
6 changed files with 33 additions and 104 deletions
|
|
@ -17,6 +17,7 @@ const { abortRun } = require('./abortRun');
|
|||
/**
|
||||
* Abort an active message generation.
|
||||
* Uses GenerationJobManager for all agent requests.
|
||||
* Since streamId === conversationId, we can directly abort by conversationId.
|
||||
*/
|
||||
async function abortMessage(req, res) {
|
||||
const { abortKey, endpoint } = req.body;
|
||||
|
|
@ -28,8 +29,8 @@ async function abortMessage(req, res) {
|
|||
const conversationId = abortKey?.split(':')?.[0] ?? req.user.id;
|
||||
const userId = req.user.id;
|
||||
|
||||
// Use GenerationJobManager to abort the job
|
||||
const abortResult = await GenerationJobManager.abortByConversation(conversationId);
|
||||
// Use GenerationJobManager to abort the job (streamId === conversationId)
|
||||
const abortResult = await GenerationJobManager.abortJob(conversationId);
|
||||
|
||||
if (!abortResult.success) {
|
||||
if (!res.headersSent) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue