feat: Introduce Summary and Professional skills, replacing the old style mode and text structuring configuration options.
This commit is contained in:
@@ -17,10 +17,6 @@ public static class ConfigUpdaterCommand
|
|||||||
{
|
{
|
||||||
case "llm": config.LlmModel = val; break;
|
case "llm": config.LlmModel = val; break;
|
||||||
case "whisper": config.WhisperModel = 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 "language":
|
||||||
case "lang": config.WhisperLanguage = val; break;
|
case "lang": config.WhisperLanguage = val; break;
|
||||||
case "backend": config.TypingBackend = 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; }
|
if (bool.TryParse(val, out var t)) { config.ModuleTechnicalSanitization = t; }
|
||||||
else { AnsiConsole.MarkupLine("[red]Invalid value. Use true or false.[/]"); return; }
|
else { AnsiConsole.MarkupLine("[red]Invalid value. Use true or false.[/]"); return; }
|
||||||
break;
|
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:
|
default:
|
||||||
AnsiConsole.MarkupLine($"[red]Unknown config key: {key}[/]");
|
AnsiConsole.MarkupLine($"[red]Unknown config key: {key}[/]");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -21,11 +21,9 @@ public static class ShowCommand
|
|||||||
table.AddRow("Spoken Language", $"[yellow]{(string.IsNullOrEmpty(config.WhisperLanguage) ? "Auto" : config.WhisperLanguage)}[/]");
|
table.AddRow("Spoken Language", $"[yellow]{(string.IsNullOrEmpty(config.WhisperLanguage) ? "Auto" : config.WhisperLanguage)}[/]");
|
||||||
table.AddRow("Typing Backend", config.TypingBackend);
|
table.AddRow("Typing Backend", config.TypingBackend);
|
||||||
table.AddRow("Active Skills", string.Join(", ", config.ActiveSkills));
|
table.AddRow("Active Skills", string.Join(", ", config.ActiveSkills));
|
||||||
table.AddRow("Style Mode", config.StyleMode);
|
|
||||||
table.AddRow("Punctuation Module", config.ModulePunctuation.ToString());
|
table.AddRow("Punctuation Module", config.ModulePunctuation.ToString());
|
||||||
table.AddRow("Technical Sanitization", config.ModuleTechnicalSanitization.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);
|
AnsiConsole.Write(table);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ public class ToakConfig
|
|||||||
public string TypingBackend { get; set; } = "xdotool"; // wtype or xdotool
|
public string TypingBackend { get; set; } = "xdotool"; // wtype or xdotool
|
||||||
public bool ModulePunctuation { get; set; } = true;
|
public bool ModulePunctuation { get; set; } = true;
|
||||||
public bool ModuleTechnicalSanitization { 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 WhisperLanguage { get; set; } = string.Empty;
|
||||||
public string LlmModel { get; set; } = "openai/gpt-oss-20b";
|
public string LlmModel { get; set; } = "openai/gpt-oss-20b";
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ public static class PromptBuilder
|
|||||||
if (config.ModulePunctuation)
|
if (config.ModulePunctuation)
|
||||||
{
|
{
|
||||||
sb.AppendLine("- Apply standard punctuation, grammar, and capitalization rules.");
|
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)
|
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').");
|
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();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
26
Core/Skills/ProfessionalSkill.cs
Normal file
26
Core/Skills/ProfessionalSkill.cs
Normal file
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,9 @@ public static class SkillRegistry
|
|||||||
public static readonly ISkill[] AllSkills = new ISkill[]
|
public static readonly ISkill[] AllSkills = new ISkill[]
|
||||||
{
|
{
|
||||||
new TerminalSkill(),
|
new TerminalSkill(),
|
||||||
new TranslateSkill()
|
new TranslateSkill(),
|
||||||
|
new ProfessionalSkill(),
|
||||||
|
new SummarySkill()
|
||||||
};
|
};
|
||||||
|
|
||||||
public static ISkill? DetectSkill(string transcript, IEnumerable<string> activeSkillNames)
|
public static ISkill? DetectSkill(string transcript, IEnumerable<string> activeSkillNames)
|
||||||
|
|||||||
25
Core/Skills/SummarySkill.cs
Normal file
25
Core/Skills/SummarySkill.cs
Normal file
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user