mirror of
https://github.com/Bijit-Mondal/VoiceAgent.git
synced 2026-03-02 18:36:39 +00:00
- Added ConversationManager for managing conversation history with configurable limits. - Implemented InputQueue for serial processing of input items. - Created SpeechManager for handling text-to-speech generation and streaming. - Developed StreamProcessor for processing LLM streams and forwarding events. - Added TranscriptionManager for audio transcription using AI SDK. - Introduced WebSocketManager for managing WebSocket connections and messaging. - Updated VoiceAgent to support new architecture and improved socket handling. - Refactored index files to export new core components.
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import { EventEmitter } from "events";
|
|
import { type ModelMessage } from "ai";
|
|
import { type HistoryConfig } from "../types";
|
|
export interface ConversationManagerOptions {
|
|
history?: Partial<HistoryConfig>;
|
|
}
|
|
/**
|
|
* Manages conversation history (ModelMessage[]) with configurable
|
|
* limits on message count and total character size.
|
|
*/
|
|
export declare class ConversationManager extends EventEmitter {
|
|
private conversationHistory;
|
|
private historyConfig;
|
|
constructor(options?: ConversationManagerOptions);
|
|
/**
|
|
* Add a message to history and trim if needed.
|
|
*/
|
|
addMessage(message: ModelMessage): void;
|
|
/**
|
|
* Get a copy of the current history.
|
|
*/
|
|
getHistory(): ModelMessage[];
|
|
/**
|
|
* Get a direct reference to the history array.
|
|
* Use with caution — prefer getHistory() for safety.
|
|
*/
|
|
getHistoryRef(): ModelMessage[];
|
|
/**
|
|
* Replace the entire conversation history.
|
|
*/
|
|
setHistory(history: ModelMessage[]): void;
|
|
/**
|
|
* Clear all conversation history.
|
|
*/
|
|
clearHistory(): void;
|
|
/**
|
|
* Get the number of messages in history.
|
|
*/
|
|
get length(): number;
|
|
/**
|
|
* Trim conversation history to stay within configured limits.
|
|
* Removes oldest messages (always in pairs to preserve user/assistant turns).
|
|
*/
|
|
private trimHistory;
|
|
}
|
|
//# sourceMappingURL=ConversationManager.d.ts.map
|