mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
feat: Introduce Redis-backed stream services for enhanced job management
- Added createStreamServices function to configure job store and event transport, supporting both Redis and in-memory options. - Updated GenerationJobManager to allow configuration with custom job stores and event transports, improving flexibility for different deployment scenarios. - Refactored IJobStore interface to support asynchronous content retrieval, ensuring compatibility with Redis implementations. - Implemented RedisEventTransport for real-time event delivery across instances, enhancing scalability and responsiveness. - Updated InMemoryJobStore to align with new async patterns for content and run step retrieval, ensuring consistent behavior across storage options.
This commit is contained in:
parent
e51c8870e6
commit
78848c4af9
9 changed files with 835 additions and 49 deletions
|
|
@ -159,7 +159,7 @@ export interface IJobStore {
|
|||
* @param streamId - The stream identifier
|
||||
* @returns Content parts or null if not available
|
||||
*/
|
||||
getContentParts(streamId: string): Agents.MessageContentComplex[] | null;
|
||||
getContentParts(streamId: string): Promise<Agents.MessageContentComplex[] | null>;
|
||||
|
||||
/**
|
||||
* Get run steps for a job (for resume state).
|
||||
|
|
@ -170,7 +170,7 @@ export interface IJobStore {
|
|||
* @param streamId - The stream identifier
|
||||
* @returns Run steps or empty array
|
||||
*/
|
||||
getRunSteps(streamId: string): Agents.RunStep[];
|
||||
getRunSteps(streamId: string): Promise<Agents.RunStep[]>;
|
||||
|
||||
/**
|
||||
* Append a streaming chunk for later reconstruction.
|
||||
|
|
@ -190,6 +190,16 @@ export interface IJobStore {
|
|||
* @param streamId - The stream identifier
|
||||
*/
|
||||
clearContentState(streamId: string): void;
|
||||
|
||||
/**
|
||||
* Save run steps to persistent storage.
|
||||
* In-memory: No-op (run steps accessed via graph reference)
|
||||
* Redis: Persists for resume across instances
|
||||
*
|
||||
* @param streamId - The stream identifier
|
||||
* @param runSteps - Run steps to save
|
||||
*/
|
||||
saveRunSteps?(streamId: string, runSteps: Agents.RunStep[]): Promise<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue