Repository navigation
refactor(voice): Refactor voice service implementations and enhance UI volume visualization - #693
Conversation
haiphucnguyen
commented
Sep 3, 2026
- Specialized service implementations (Local Whisper, Piper, OpenAI) are introduced for decoupled voice functionality.
- Refactor TTS and STT services into dedicated, specialized classes.
- Apply perceptual volume boosting to voice waveform samples in the UI for better visual fidelity.
…I volume visualization - Specialized service implementations (Local Whisper, Piper, OpenAI) are introduced for decoupled voice functionality. - Refactor TTS and STT services into dedicated, specialized classes. - Apply perceptual volume boosting to voice waveform samples in the UI for better visual fidelity.
There was a problem hiding this comment.
🟡 Changes recommended
The new/updated STT implementations appear to misuse LangChain4j’s HTTP client builder API and hard-code WAV MIME type, which is likely to cause compilation/runtime issues.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR refactors the desktop voice layer by splitting OpenAI STT/TTS into dedicated service classes, updating local OpenAI-compatible (Piper/Whisper) services to use the shared JDK HTTP client configuration, and improving the live mic waveform visualization by applying a perceptual gain curve.
Changes:
- Extract OpenAI TTS/STT implementations into
OpenAiTextToSpeechServiceandOpenAiSpeechToTextService. - Update local Piper TTS and local Whisper STT to use
createJdkHttpClientBuilder(...)when constructing LangChain4j OpenAI-compatible models. - Boost UI waveform sample levels using a sqrt curve + gain for more visible speech activity.
File summaries
| File | Description |
|---|---|
| desktop-shared/src/main/kotlin/io/askimo/ui/voice/impl/PiperTextToSpeechService.kt | Removes embedded OpenAI TTS implementation and configures Piper model with shared JDK HTTP client builder. |
| desktop-shared/src/main/kotlin/io/askimo/ui/voice/impl/OpenAiTextToSpeechService.kt | New OpenAI TTS service + factory, wired through shared JDK HTTP client builder. |
| desktop-shared/src/main/kotlin/io/askimo/ui/voice/impl/OpenAiSpeechToTextService.kt | New OpenAI STT service + factory; currently has builder wiring and MIME-type handling issues. |
| desktop-shared/src/main/kotlin/io/askimo/ui/voice/impl/LocalWhisperSpeechToTextService.kt | Updates local Whisper STT to use shared JDK HTTP client builder; currently uses a likely-wrong builder API. |
| desktop-shared/src/main/kotlin/io/askimo/ui/chat/ChatInputField.kt | Improves waveform visualization by applying perceptual boosting to RMS levels before rendering. |
Review details
Suppressed comments (1)
desktop-shared/src/main/kotlin/io/askimo/ui/voice/impl/LocalWhisperSpeechToTextService.kt:41
createJdkHttpClientBuilder(baseUrl)returns aJdkHttpClientBuilder, but it’s being passed toOpenAiAudioTranscriptionModel.builder().httpClientProvider(...). This is inconsistent with other model builders in the codebase and is likely a type/compilation error; usehttpClientBuilder(...)so proxy/timeout settings are applied correctly.
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| val model = OpenAiAudioTranscriptionModel.builder() | ||
| .httpClientProvider(createJdkHttpClientBuilder()) | ||
| .apiKey(apiKey) |
| .modelName(config.sttModel.ifBlank { "whisper-1" }) | ||
| .build() | ||
|
|
||
| model.transcribeToText(Audio.builder().base64Data(Base64.getEncoder().encodeToString(audio)).mimeType("audio/wav").build()) |