diff --git a/Commands/ConfigUpdaterCommand.cs b/Commands/ConfigUpdaterCommand.cs index b128ded..3a386e5 100644 --- a/Commands/ConfigUpdaterCommand.cs +++ b/Commands/ConfigUpdaterCommand.cs @@ -17,10 +17,6 @@ public static class ConfigUpdaterCommand { case "llm": config.LlmModel = val; break; case "whisper": config.WhisperModel = val; break; - case "style": - if (val == "professional" || val == "concise" || val == "casual") { config.StyleMode = val; } - else { AnsiConsole.MarkupLine("[red]Invalid style.[/] Use: professional, concise, casual"); return; } - break; case "language": case "lang": config.WhisperLanguage = val; break; case "backend": config.TypingBackend = val; break; @@ -32,14 +28,6 @@ public static class ConfigUpdaterCommand if (bool.TryParse(val, out var t)) { config.ModuleTechnicalSanitization = t; } else { AnsiConsole.MarkupLine("[red]Invalid value. Use true or false.[/]"); return; } break; - case "bullets": - if (bool.TryParse(val, out var b)) { config.StructureBulletPoints = b; } - else { AnsiConsole.MarkupLine("[red]Invalid value. Use true or false.[/]"); return; } - break; - case "paragraphs": - if (bool.TryParse(val, out var sp)) { config.StructureSmartParagraphing = sp; } - else { AnsiConsole.MarkupLine("[red]Invalid value. Use true or false.[/]"); return; } - break; default: AnsiConsole.MarkupLine($"[red]Unknown config key: {key}[/]"); return; diff --git a/Commands/ShowCommand.cs b/Commands/ShowCommand.cs index 2621372..84c8412 100644 --- a/Commands/ShowCommand.cs +++ b/Commands/ShowCommand.cs @@ -21,11 +21,9 @@ public static class ShowCommand table.AddRow("Spoken Language", $"[yellow]{(string.IsNullOrEmpty(config.WhisperLanguage) ? "Auto" : config.WhisperLanguage)}[/]"); table.AddRow("Typing Backend", config.TypingBackend); table.AddRow("Active Skills", string.Join(", ", config.ActiveSkills)); - table.AddRow("Style Mode", config.StyleMode); + table.AddRow("Punctuation Module", config.ModulePunctuation.ToString()); table.AddRow("Technical Sanitization", config.ModuleTechnicalSanitization.ToString()); - table.AddRow("Bullet Points", config.StructureBulletPoints.ToString()); - table.AddRow("Smart Paragraphing", config.StructureSmartParagraphing.ToString()); AnsiConsole.Write(table); } diff --git a/Configuration/ToakConfig.cs b/Configuration/ToakConfig.cs index 108009e..6b1982d 100644 --- a/Configuration/ToakConfig.cs +++ b/Configuration/ToakConfig.cs @@ -6,9 +6,6 @@ public class ToakConfig public string TypingBackend { get; set; } = "xdotool"; // wtype or xdotool public bool ModulePunctuation { get; set; } = true; public bool ModuleTechnicalSanitization { get; set; } = true; - public string StyleMode { get; set; } = "Professional"; - public bool StructureBulletPoints { get; set; } = false; - public bool StructureSmartParagraphing { get; set; } = true; public string WhisperLanguage { get; set; } = string.Empty; public string LlmModel { get; set; } = "openai/gpt-oss-20b"; diff --git a/Core/PromptBuilder.cs b/Core/PromptBuilder.cs index f4366ec..7a3f721 100644 --- a/Core/PromptBuilder.cs +++ b/Core/PromptBuilder.cs @@ -30,6 +30,9 @@ public static class PromptBuilder if (config.ModulePunctuation) { sb.AppendLine("- Apply standard punctuation, grammar, and capitalization rules."); + sb.AppendLine("- Preserve the exact original tone, rhythm, and word choice of the speaker."); + sb.AppendLine("- ONLY fix obvious grammatical errors, spelling mistakes, and bad punctuation."); + sb.AppendLine("- Do not attempt to formalize the language or alter the speaker's personal voice and cadence."); } if (config.ModuleTechnicalSanitization) @@ -37,29 +40,6 @@ public static class PromptBuilder sb.AppendLine("- Ensure technical terms are properly formatted (e.g., 'C#' instead of 'c sharp', 'HANA' instead of 'hana', 'SAP' instead of 'sap', 'API', 'SQL')."); } - switch (config.StyleMode.ToLowerInvariant()) - { - case "professional": - sb.AppendLine("- Rewrite the text into formal prose suitable for emails or professional documents."); - break; - case "concise": - sb.AppendLine("- Summarize the text, removing fluff and filler for quick notes."); - break; - case "casual": - sb.AppendLine("- Maintain the original rhythm and tone but fix spelling and grammar."); - break; - } - - if (config.StructureBulletPoints) - { - sb.AppendLine("- Format the output as a bulleted list where appropriate."); - } - - if (config.StructureSmartParagraphing) - { - sb.AppendLine("- Break the text logically into paragraphs based on context."); - } - return sb.ToString(); } } diff --git a/Core/Skills/ProfessionalSkill.cs b/Core/Skills/ProfessionalSkill.cs new file mode 100644 index 0000000..e0d9d91 --- /dev/null +++ b/Core/Skills/ProfessionalSkill.cs @@ -0,0 +1,26 @@ +namespace Toak.Core.Skills; + +public class ProfessionalSkill : ISkill +{ + public string Name => "Professional"; + public string Description => "Rewrites the spoken text to sound highly professional and articulate."; + public string[] Hotwords => new[] { "System professional", "System rewrite professionally", "System formalize" }; + + public bool HandlesExecution => false; + + public string GetSystemPrompt(string rawTranscript) + { + return @"You are an expert formal editor and corporate communicator. +The user wants to rewrite the following text professionally. The transcript might start with a hotword like 'System professional'. +- Enhance the text from the speaker to sound highly professional and articulate. +- Maintain the exact meaning and key information of the original transcription. +- Ensure paragraph breaks are added logically to prevent walls of text, improving readability. +- Avoid filler words, hesitations (umm, uh), or conversational redundancies. +- Output ONLY the final polished text. Do not include markdown, explanations, or quotes."; + } + + public void Execute(string llmResult) + { + // Not used since HandlesExecution is false + } +} diff --git a/Core/Skills/SkillRegistry.cs b/Core/Skills/SkillRegistry.cs index 3798946..a4baf05 100644 --- a/Core/Skills/SkillRegistry.cs +++ b/Core/Skills/SkillRegistry.cs @@ -5,7 +5,9 @@ public static class SkillRegistry public static readonly ISkill[] AllSkills = new ISkill[] { new TerminalSkill(), - new TranslateSkill() + new TranslateSkill(), + new ProfessionalSkill(), + new SummarySkill() }; public static ISkill? DetectSkill(string transcript, IEnumerable activeSkillNames) diff --git a/Core/Skills/SummarySkill.cs b/Core/Skills/SummarySkill.cs new file mode 100644 index 0000000..9840a81 --- /dev/null +++ b/Core/Skills/SummarySkill.cs @@ -0,0 +1,25 @@ +namespace Toak.Core.Skills; + +public class SummarySkill : ISkill +{ + public string Name => "Summary"; + public string Description => "Summarizes the spoken text securely and concisely, removing fluff."; + public string[] Hotwords => new[] { "System summary", "System summarize", "System concise" }; + + public bool HandlesExecution => false; + + public string GetSystemPrompt(string rawTranscript) + { + return @"You are an expert editor who strips all fluff and makes text as concise as possible. +The user wants to summarize the following text. The transcript might start with a hotword like 'System summary'. +- Strip all fluff, filler, and unnecessary conversational words. +- Make the output as direct and brief as possible without losing the core information. +- Use clear, crisp phrasing. If the text lists items or instructions, format them logically. +- Output ONLY the final summarized text. Do not include markdown, explanations, or quotes."; + } + + public void Execute(string llmResult) + { + // Not used since HandlesExecution is false + } +}