1
0

refactor: modularize text injection with a factory and dedicated backend implementations, including a new Wayland clipboard option.

This commit is contained in:
2026-03-03 12:15:52 +01:00
parent ffba480d28
commit 9bf72169db
13 changed files with 379 additions and 147 deletions

View File

@@ -42,6 +42,6 @@ public static class Constants
{
public const string LlmModel = "openai/gpt-oss-20b";
public const string WhisperModel = "whisper-large-v3-turbo";
public const int DefaultTypeDelayMs = 2;
public const int DefaultTypeDelayMs = 5;
}
}

View File

@@ -76,7 +76,7 @@ public static class DaemonService
configManager,
recorder,
notifications,
new TextInjector(notifications),
TextInjectorFactory.Create(config.TypingBackend, notifications),
new HistoryManager(),
new ClipboardManager(notifications),
stateTracker

View File

@@ -34,8 +34,8 @@ public interface INotifications
public interface ITextInjector
{
Task<string> InjectStreamAsync(IAsyncEnumerable<string> textStream, string backend = "xdotool");
Task InjectTextAsync(string text, string backend = "xdotool");
Task<string> InjectStreamAsync(IAsyncEnumerable<string> tokenStream);
Task InjectTextAsync(string text);
}
public interface IHistoryManager

View File

@@ -121,7 +121,7 @@ public class TranscriptionOrchestrator(
}
else
{
var fullText = await _textInjector.InjectStreamAsync(tokenStream, config.TypingBackend);
var fullText = await _textInjector.InjectStreamAsync(tokenStream);
stopWatch.Stop();
_historyManager.SaveEntry(transcript, fullText, detectedSkill?.Name, stopWatch.ElapsedMilliseconds);
_notifications.Notify("Toak", $"Done in {stopWatch.ElapsedMilliseconds}ms");