feat: add auto-language detection support to stt-ptt

- Add STT_LANGUAGE environment variable (default: auto)
- Modify whisper-cli call to use -l flag with language code
- Add language option to HM module (enum with 23 common languages + auto)
- Update help text to document STT_LANGUAGE variable
This commit is contained in:
m3tm3re
2026-01-10 09:36:21 +01:00
parent 3933e380c6
commit 9f284a8c21
3 changed files with 55 additions and 2 deletions

View File

@@ -77,6 +77,56 @@ in {
'';
example = 5000;
};
language = mkOption {
type = types.enum [
"auto"
"en"
"es"
"fr"
"de"
"it"
"pt"
"ru"
"zh"
"ja"
"ko"
"ar"
"hi"
"tr"
"pl"
"nl"
"sv"
"da"
"fi"
"no"
"vi"
"th"
"id"
"uk"
"cs"
];
default = "auto";
description = ''
Language for speech recognition. Use "auto" for automatic language detection,
or specify a language code (ISO 639-1 standard) for better accuracy.
Auto-detection analyzes the audio to determine the spoken language automatically.
Specifying a language can improve accuracy if you know the language in advance.
Common language codes:
- en: English
- es: Spanish
- fr: French
- de: German
- zh: Chinese
- ja: Japanese
- ko: Korean
whisper.cpp supports 100+ languages. See whisper.cpp documentation for the full list.
'';
example = "en";
};
};
config = mkIf cfg.enable {
@@ -84,6 +134,7 @@ in {
home.sessionVariables = {
STT_MODEL = modelPath;
STT_LANGUAGE = cfg.language;
STT_NOTIFY_TIMEOUT = toString cfg.notifyTimeout;
};