DeutschLernen/GermanApp/Infrastructure/Configuration/VoskConfig.cs
Lasse Rune Hansen 769c63b005
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
feat(backend/ai-services): Complete AI Services Phase 0-4 implementation
- Add Domain interfaces: IMistralService, IVoskService, ITtsService
- Add Configuration classes: VoskConfig, CoquiConfig
- Add Application service: MistralService (text generation with Mistral)
- Add Infrastructure services: VoskService (speech recognition), TtsService (TTS)
- Add Presentation controllers: MistralController, SpeechController, TtsController
- Fix MistralService to use correct IMistralConnector methods (CompleteAsync, ChatAsync)
- Fix TtsController to use record constructor syntax
- Fix TtsService Task.FromResult type specification
- Fix Program.cs service registration and remove merge conflict markers
- Update docs/features/ai-services.md with progress (Phases 0-4 complete)
- Update docs/ROADMAP.md with AI Services status and test metrics (296 tests)

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-06-13 10:09:19 +02:00

94 lines
2.6 KiB
C#

namespace GermanApp.Infrastructure.Configuration;
/// <summary>
/// Configuration settings for Vosk speech recognition service.
/// This is part of the Infrastructure layer.
/// </summary>
public class VoskConfig
{
/// <summary>
/// Path to the Python executable.
/// Default: python3
/// </summary>
public string PythonPath { get; set; } = "python3";
/// <summary>
/// Path to the Vosk model directory.
/// Example: /models/vosk-model-de-0.22
/// </summary>
public string ModelPath { get; set; } = string.Empty;
/// <summary>
/// Expected audio sample rate in Hz.
/// Vosk models typically use 16000 Hz.
/// Default: 16000
/// </summary>
public int SampleRate { get; set; } = 16000;
/// <summary>
/// Maximum audio duration in seconds for speech recognition.
/// Default: 60 seconds
/// </summary>
public int MaxAudioDurationSeconds { get; set; } = 60;
/// <summary>
/// Timeout in seconds for Vosk processing.
/// Default: 30 seconds
/// </summary>
public int TimeoutSeconds { get; set; } = 30;
/// <summary>
/// Whether to enable beam width adjustment for accuracy vs speed tradeoff.
/// Higher values = more accurate but slower.
/// Default: 16
/// </summary>
public int BeamWidth { get; set; } = 16;
/// <summary>
/// Path to the Vosk Python package/module.
/// Default: vosk
/// </summary>
public string ModulePath { get; set; } = "vosk";
/// <summary>
/// Validates the configuration.
/// </summary>
/// <exception cref="ArgumentException">Thrown when configuration is invalid</exception>
public void Validate()
{
if (string.IsNullOrWhiteSpace(PythonPath))
{
throw new ArgumentException("Vosk PythonPath is required");
}
if (string.IsNullOrWhiteSpace(ModelPath))
{
throw new ArgumentException("Vosk ModelPath is required");
}
if (SampleRate <= 0)
{
throw new ArgumentException("SampleRate must be greater than 0");
}
if (MaxAudioDurationSeconds <= 0)
{
throw new ArgumentException("MaxAudioDurationSeconds must be greater than 0");
}
if (TimeoutSeconds <= 0)
{
throw new ArgumentException("TimeoutSeconds must be greater than 0");
}
if (BeamWidth <= 0)
{
throw new ArgumentException("BeamWidth must be greater than 0");
}
if (string.IsNullOrWhiteSpace(ModulePath))
{
throw new ArgumentException("Vosk ModulePath is required");
}
}
}