77 lines
1.8 KiB
Markdown
77 lines
1.8 KiB
Markdown
|
|
# Feature: Voice Message Control
|
||
|
|
|
||
|
|
**Phase**: 4
|
||
|
|
|
||
|
|
## Overview
|
||
|
|
|
||
|
|
Users can send voice messages on any channel to control AI agents. Voice is transcribed to text (speech-to-text) and sent as a regular prompt to the agent.
|
||
|
|
|
||
|
|
## Flow
|
||
|
|
|
||
|
|
```
|
||
|
|
User sends voice message in session topic
|
||
|
|
โ ChannelAdapter receives audio file
|
||
|
|
โ STT (Speech-to-Text) service transcribes audio
|
||
|
|
โ Transcribed text shown in topic: "๐ค You said: ..."
|
||
|
|
โ Text forwarded as prompt to agent
|
||
|
|
โ Agent responds normally
|
||
|
|
```
|
||
|
|
|
||
|
|
## STT Options
|
||
|
|
|
||
|
|
Pluggable STT provider interface:
|
||
|
|
|
||
|
|
```typescript
|
||
|
|
interface STTProvider {
|
||
|
|
transcribe(audio: Buffer, format: string, language?: string): Promise<string>
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
Possible providers:
|
||
|
|
- **OpenAI Whisper API** โ high quality, paid
|
||
|
|
- **Local Whisper** โ self-hosted, free, requires GPU
|
||
|
|
- **Google Speech-to-Text** โ good quality, free tier available
|
||
|
|
- **Deepgram** โ fast, good quality
|
||
|
|
|
||
|
|
### Config
|
||
|
|
|
||
|
|
```json
|
||
|
|
{
|
||
|
|
"stt": {
|
||
|
|
"provider": "whisper",
|
||
|
|
"options": {
|
||
|
|
"apiKey": "...",
|
||
|
|
"model": "whisper-1",
|
||
|
|
"language": "en"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
## Channel Support
|
||
|
|
|
||
|
|
| Channel | Voice Support |
|
||
|
|
|---------|--------------|
|
||
|
|
| Telegram | Native voice messages (OGG/Opus format) |
|
||
|
|
| Discord | Voice messages in text channels |
|
||
|
|
| WhatsApp | Native voice messages |
|
||
|
|
|
||
|
|
## File Sharing (Related)
|
||
|
|
|
||
|
|
Same phase โ users can send files/images to the agent:
|
||
|
|
|
||
|
|
```
|
||
|
|
User sends image/file in session topic
|
||
|
|
โ ChannelAdapter downloads file
|
||
|
|
โ File saved to agent's working directory (or temp)
|
||
|
|
โ Agent notified of new file via prompt context
|
||
|
|
โ Agent can read/analyze the file
|
||
|
|
```
|
||
|
|
|
||
|
|
## Considerations
|
||
|
|
|
||
|
|
- Voice transcription adds latency โ show "๐ค Transcribing..." status
|
||
|
|
- Large audio files may take longer โ consider size limits
|
||
|
|
- Multi-language support depends on STT provider
|
||
|
|
- Privacy: audio is processed by STT provider โ document this for self-hosted users
|