DeutschLernen/GermanApp/Domain/Interfaces/IVoskService.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

57 lines
2.1 KiB
C#

namespace GermanApp.Domain.Interfaces;
/// <summary>
/// Domain interface for Vosk speech recognition service.
/// This is part of the Domain layer.
/// </summary>
public interface IVoskService
{
/// <summary>
/// Recognizes speech from audio bytes.
/// </summary>
/// <param name="audioBytes">Audio data in bytes (WAV format)</param>
/// <param name="sampleRate">Sample rate of the audio in Hz</param>
/// <param name="hint">Optional hint/phrase to improve recognition accuracy</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <returns>Recognized text</returns>
Task<string> RecognizeSpeechAsync(
byte[] audioBytes,
int sampleRate = 16000,
string? hint = null,
CancellationToken cancellationToken = default);
/// <summary>
/// Recognizes speech from an audio file path.
/// </summary>
/// <param name="audioFilePath">Path to the audio file</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <returns>Recognized text</returns>
Task<string> RecognizeSpeechFromFileAsync(
string audioFilePath,
CancellationToken cancellationToken = default);
/// <summary>
/// Recognizes speech from a stream.
/// </summary>
/// <param name="audioStream">Audio stream</param>
/// <param name="sampleRate">Sample rate of the audio in Hz</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <returns>Recognized text</returns>
Task<string> RecognizeSpeechFromStreamAsync(
System.IO.Stream audioStream,
int sampleRate = 16000,
CancellationToken cancellationToken = default);
/// <summary>
/// Tests the Vosk 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 Vosk model information.
/// </summary>
/// <returns>Model name and path</returns>
Task<(string ModelName, string ModelPath)> GetModelInfoAsync();
}