All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
- 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>
130 lines
3.7 KiB
C#
130 lines
3.7 KiB
C#
namespace GermanApp.Infrastructure.Configuration;
|
|
|
|
/// <summary>
|
|
/// Configuration settings for Coqui TTS service.
|
|
/// This is part of the Infrastructure layer.
|
|
/// </summary>
|
|
public class CoquiConfig
|
|
{
|
|
/// <summary>
|
|
/// Path to the Python executable.
|
|
/// Default: python3
|
|
/// </summary>
|
|
public string PythonPath { get; set; } = "python3";
|
|
|
|
/// <summary>
|
|
/// Name of the Coqui TTS model to use.
|
|
/// Example: tts_models/de/deu/fairseq/vits
|
|
/// </summary>
|
|
public string ModelName { get; set; } = "tts_models/de/deu/fairseq/vits";
|
|
|
|
/// <summary>
|
|
/// Path to the TTS Python package/module.
|
|
/// Default: TTS
|
|
/// </summary>
|
|
public string ModulePath { get; set; } = "TTS";
|
|
|
|
/// <summary>
|
|
/// Output audio format.
|
|
/// Supported: wav, mp3, ogg, flac
|
|
/// Default: wav
|
|
/// </summary>
|
|
public string OutputFormat { get; set; } = "wav";
|
|
|
|
/// <summary>
|
|
/// Output audio sample rate in Hz.
|
|
/// Default: 22050
|
|
/// </summary>
|
|
public int SampleRate { get; set; } = 22050;
|
|
|
|
/// <summary>
|
|
/// Voice speaker ID for the model.
|
|
/// Default: (empty - uses model default)
|
|
/// </summary>
|
|
public string Speaker { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Language code for TTS.
|
|
/// Default: de
|
|
/// </summary>
|
|
public string Language { get; set; } = "de";
|
|
|
|
/// <summary>
|
|
/// Maximum text length in characters for a single TTS request.
|
|
/// Longer texts will be split.
|
|
/// Default: 500 characters
|
|
/// </summary>
|
|
public int MaxTextLength { get; set; } = 500;
|
|
|
|
/// <summary>
|
|
/// Timeout in seconds for TTS processing.
|
|
/// Default: 60 seconds
|
|
/// </summary>
|
|
public int TimeoutSeconds { get; set; } = 60;
|
|
|
|
/// <summary>
|
|
/// Path to store generated audio files.
|
|
/// Default: /var/audio/tts
|
|
/// </summary>
|
|
public string AudioStoragePath { get; set; } = "/var/audio/tts";
|
|
|
|
/// <summary>
|
|
/// Whether to use GPU acceleration if available.
|
|
/// Default: false
|
|
/// </summary>
|
|
public bool UseGPU { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Validates the configuration.
|
|
/// </summary>
|
|
/// <exception cref="ArgumentException">Thrown when configuration is invalid</exception>
|
|
public void Validate()
|
|
{
|
|
if (string.IsNullOrWhiteSpace(PythonPath))
|
|
{
|
|
throw new ArgumentException("Coqui PythonPath is required");
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(ModelName))
|
|
{
|
|
throw new ArgumentException("Coqui ModelName is required");
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(ModulePath))
|
|
{
|
|
throw new ArgumentException("Coqui ModulePath is required");
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(OutputFormat))
|
|
{
|
|
throw new ArgumentException("Coqui OutputFormat is required");
|
|
}
|
|
|
|
var validFormats = new[] { "wav", "mp3", "ogg", "flac" };
|
|
if (!validFormats.Contains(OutputFormat.ToLower()))
|
|
{
|
|
throw new ArgumentException(
|
|
$"Invalid OutputFormat '{OutputFormat}'. Valid formats: {string.Join(", ", validFormats)}");
|
|
}
|
|
|
|
if (SampleRate <= 0)
|
|
{
|
|
throw new ArgumentException("SampleRate must be greater than 0");
|
|
}
|
|
|
|
if (MaxTextLength <= 0)
|
|
{
|
|
throw new ArgumentException("MaxTextLength must be greater than 0");
|
|
}
|
|
|
|
if (TimeoutSeconds <= 0)
|
|
{
|
|
throw new ArgumentException("TimeoutSeconds must be greater than 0");
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(AudioStoragePath))
|
|
{
|
|
throw new ArgumentException("AudioStoragePath is required");
|
|
}
|
|
}
|
|
}
|