refactor: enhance session management and LLM processing
- Introduce a new `currentStreamPromise` to track ongoing LLM processing, allowing for better handling of stream interruptions and cleanup. - Update message handling to utilize `ModelMessage` for improved type safety and structure. - Refactor `processWithLLM` to integrate new streaming capabilities with tool execution and error handling. - Enhance logging for better traceability during audio playback and message processing. - Remove deprecated `streamLLM` function and replace it with a more modular approach using `getAllTools`. These changes improve the robustness of the voice assistant's session management and streamline the integration of LLM processing.
This commit is contained in:
@@ -50,14 +50,18 @@ export class TTSManager {
|
||||
});
|
||||
|
||||
console.log(
|
||||
`[TTS-Manager ${this.sessionId}] ${new Date().toISOString()} Sent audio ${audioId}, waiting for playback...`
|
||||
`[TTS-Manager ${
|
||||
this.sessionId
|
||||
}] ${new Date().toISOString()} Sent audio ${audioId}, waiting for playback...`
|
||||
);
|
||||
|
||||
// Wait for playback confirmation
|
||||
await playbackPromise;
|
||||
|
||||
console.log(
|
||||
`[TTS-Manager ${this.sessionId}] ${new Date().toISOString()} Audio ${audioId} playback confirmed`
|
||||
`[TTS-Manager ${
|
||||
this.sessionId
|
||||
}] ${new Date().toISOString()} Audio ${audioId} playback confirmed`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user