refactor: modularize text injection with a factory and dedicated backend implementations, including a new Wayland clipboard option.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user