feat: enhance Whisper language selection in onboarding with auto-detect option and switch Wayland paste shortcut to Ctrl+V.
This commit is contained in:
@@ -120,18 +120,29 @@ public static class OnboardCommand
|
||||
.UseConverter(c => c == "whisper-large-v3" ? "whisper-large-v3 (Accurate)" : "whisper-large-v3-turbo (Fast)"));
|
||||
}
|
||||
|
||||
config.WhisperLanguage = AnsiConsole.Prompt(
|
||||
new TextPrompt<string>("Microphone Spoken Language (e.g. en, es, zh):")
|
||||
.DefaultValue(string.IsNullOrWhiteSpace(config.WhisperLanguage) ? "en" : config.WhisperLanguage)
|
||||
.AllowEmpty()
|
||||
.Validate(lang =>
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(lang)) return ValidationResult.Success();
|
||||
if (lang.Contains(",") || lang.Contains(" "))
|
||||
return ValidationResult.Error("[red]Please provide only one language code (e.g., 'en' not 'en, es')[/]");
|
||||
var langChoice = AnsiConsole.Prompt(
|
||||
new SelectionPrompt<string>()
|
||||
.Title("Select [green]Spoken Language[/] for Whisper:")
|
||||
.AddChoices(new[] { "Auto-detect (multilingual)", "Specify language code" })
|
||||
.UseConverter(c => c));
|
||||
|
||||
if (langChoice == "Specify language code")
|
||||
{
|
||||
config.WhisperLanguage = AnsiConsole.Prompt(
|
||||
new TextPrompt<string>("Language code (e.g. en, es, zh, de):")
|
||||
.DefaultValue(string.IsNullOrWhiteSpace(config.WhisperLanguage) ? "en" : config.WhisperLanguage)
|
||||
.Validate(lang =>
|
||||
{
|
||||
if (lang.Contains(",") || lang.Contains(" "))
|
||||
return ValidationResult.Error("[red]Please provide only one language code (e.g., 'en' not 'en, es')[/]");
|
||||
return ValidationResult.Success();
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
config.WhisperLanguage = string.Empty;
|
||||
}
|
||||
|
||||
return ValidationResult.Success();
|
||||
}));
|
||||
|
||||
var sessionType = Environment.GetEnvironmentVariable("XDG_SESSION_TYPE")?.ToLowerInvariant();
|
||||
var typingBackends = sessionType == "wayland" ? new[] { "wtype", "wl-clipboard", "ydotool" } : new[] { "xdotool", "ydotool" };
|
||||
|
||||
Reference in New Issue
Block a user