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>
84 lines
3.2 KiB
C#
84 lines
3.2 KiB
C#
using System.IO;
|
|
|
|
namespace GermanApp.Domain.Interfaces;
|
|
|
|
/// <summary>
|
|
/// Domain interface for Coqui TTS text-to-speech service.
|
|
/// This is part of the Domain layer.
|
|
/// </summary>
|
|
public interface ITtsService
|
|
{
|
|
/// <summary>
|
|
/// Generates audio from text.
|
|
/// </summary>
|
|
/// <param name="text">Text to convert to speech</param>
|
|
/// <param name="speaker">Speaker ID/voice (optional)</param>
|
|
/// <param name="language">Language code (default: de)</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>Audio data as bytes</returns>
|
|
Task<byte[]> GenerateAudioAsync(
|
|
string text,
|
|
string? speaker = null,
|
|
string language = "de",
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Generates audio and saves to a file.
|
|
/// </summary>
|
|
/// <param name="text">Text to convert to speech</param>
|
|
/// <param name="outputPath">Path to save the audio file</param>
|
|
/// <param name="speaker">Speaker ID/voice (optional)</param>
|
|
/// <param name="language">Language code (default: de)</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>Path to the generated audio file</returns>
|
|
Task<string> GenerateAudioToFileAsync(
|
|
string text,
|
|
string outputPath,
|
|
string? speaker = null,
|
|
string language = "de",
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Generates audio as a stream.
|
|
/// </summary>
|
|
/// <param name="text">Text to convert to speech</param>
|
|
/// <param name="speaker">Speaker ID/voice (optional)</param>
|
|
/// <param name="language">Language code (default: de)</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>Audio stream</returns>
|
|
Task<Stream> GenerateAudioStreamAsync(
|
|
string text,
|
|
string? speaker = null,
|
|
string language = "de",
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Tests the Coqui TTS model and configuration.
|
|
/// </summary>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>True if model is loaded and working</returns>
|
|
Task<bool> TestModelAsync(CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Gets the current TTS model information.
|
|
/// </summary>
|
|
/// <returns>Model name and path</returns>
|
|
Task<(string ModelName, string? ModelPath)> GetModelInfoAsync();
|
|
|
|
/// <summary>
|
|
/// Gets list of available voices/speakers for the current model.
|
|
/// </summary>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>List of available speaker IDs</returns>
|
|
Task<IReadOnlyList<string>> GetAvailableSpeakersAsync(CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Cleans up old audio files from storage.
|
|
/// </summary>
|
|
/// <param name="olderThan">Delete files older than this timespan</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>Number of files deleted</returns>
|
|
Task<int> CleanupOldFilesAsync(
|
|
TimeSpan olderThan,
|
|
CancellationToken cancellationToken = default);
|
|
}
|