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.
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import { type streamText } from "ai";
|
|
/**
|
|
* Result of processing a full LLM stream.
|
|
*/
|
|
export interface StreamResult {
|
|
fullText: string;
|
|
fullReasoning: string;
|
|
allToolCalls: Array<{
|
|
toolName: string;
|
|
toolCallId: string;
|
|
input: unknown;
|
|
}>;
|
|
allToolResults: Array<{
|
|
toolName: string;
|
|
toolCallId: string;
|
|
output: unknown;
|
|
}>;
|
|
allSources: Array<unknown>;
|
|
allFiles: Array<unknown>;
|
|
}
|
|
export interface StreamProcessorCallbacks {
|
|
/** Called when a text delta arrives (for streaming speech, etc.) */
|
|
onTextDelta?: (text: string) => void;
|
|
/** Called when a text-end part arrives (flush speech, etc.) */
|
|
onTextEnd?: () => void;
|
|
/** Send a WebSocket message */
|
|
sendMessage: (message: Record<string, unknown>) => void;
|
|
/** Emit an event on the agent */
|
|
emitEvent: (event: string, data?: unknown) => void;
|
|
}
|
|
/**
|
|
* Processes the fullStream from an AI SDK `streamText` call,
|
|
* forwarding events to WebSocket clients and collecting the complete response.
|
|
*
|
|
* This is a standalone function (not a class) because it has no persistent state.
|
|
*/
|
|
export declare function processFullStream(result: ReturnType<typeof streamText>, callbacks: StreamProcessorCallbacks, extraResponseFields?: Record<string, unknown>): Promise<StreamResult>;
|
|
/**
|
|
* Handle onChunk callback events and emit them.
|
|
*/
|
|
export declare function handleStreamChunk(chunk: any, emitEvent: (event: string, data?: unknown) => void): void;
|
|
//# sourceMappingURL=StreamProcessor.d.ts.map
|