1
0

feat: Add Native AOT compilation and source-generated JSON serialization, streamline CLI arguments, and remove translation functionality.

This commit is contained in:
2026-02-26 21:40:17 +01:00
parent c2f4cbbfb2
commit fbff8c98ff
7 changed files with 43 additions and 33 deletions

View File

@@ -1,20 +1,13 @@
using System.Diagnostics;
using Toak;
bool pipeToStdout = args.Contains("--pipe") || Console.IsOutputRedirected;
bool rawOutput = args.Contains("--raw");
bool pipeToStdout = args.Contains("--pipe") || args.Contains("-p") || Console.IsOutputRedirected;
bool copyToClipboard = args.Contains("--copy");
string translateTo = "";
int translateIndex = Array.IndexOf(args, "--translate");
if (translateIndex >= 0 && translateIndex < args.Length - 1)
{
translateTo = args[translateIndex + 1];
}
string command = args.FirstOrDefault(a => !a.StartsWith("--")) ?? "";
string command = args.FirstOrDefault(a => !a.StartsWith("-")) ?? "";
if (string.IsNullOrEmpty(command) && args.Length == 0)
if (args.Contains("-h") || args.Contains("--help") || (string.IsNullOrEmpty(command) && args.Length == 0))
{
Console.WriteLine("Toak: High-speed Linux Dictation");
Console.WriteLine("Usage:");
@@ -25,10 +18,9 @@ if (string.IsNullOrEmpty(command) && args.Length == 0)
Console.WriteLine(" toak config <key> <value> - Update a specific configuration setting");
Console.WriteLine(" toak show - Show current configuration");
Console.WriteLine("Flags:");
Console.WriteLine(" --pipe - Output transcription to stdout instead of typing");
Console.WriteLine(" --raw - Skip LLM refinement, output raw transcript");
Console.WriteLine(" -h, --help - Show this help message");
Console.WriteLine(" -p, --pipe - Output transcription to stdout instead of typing");
Console.WriteLine(" --copy - Copy to clipboard instead of typing");
Console.WriteLine(" --translate <lang> - Translate output to the specified language");
return;
}
@@ -250,10 +242,6 @@ if (command == "toggle")
AudioRecorder.StopRecording();
var config = ConfigManager.LoadConfig();
if (!string.IsNullOrWhiteSpace(translateTo))
{
config.TargetLanguage = translateTo;
}
if (string.IsNullOrWhiteSpace(config.GroqApiKey))
{
@@ -285,11 +273,8 @@ if (command == "toggle")
string finalText = transcript;
// 2. LLM Refinement
if (!rawOutput)
{
var systemPrompt = PromptBuilder.BuildPrompt(config);
finalText = await groq.RefineTextAsync(transcript, systemPrompt, config.LlmModel);
}
var systemPrompt = PromptBuilder.BuildPrompt(config);
finalText = await groq.RefineTextAsync(transcript, systemPrompt, config.LlmModel);
// 3. Output
if (pipeToStdout)