feat: fanalize straeming adapters

This commit is contained in:
leonardotrapani
2026-02-01 17:53:48 +01:00
parent 8df3021a9d
commit 0025bf97b6
23 changed files with 489 additions and 644 deletions
+8 -13
View File
@@ -8,10 +8,8 @@ import (
"github.com/leonardotrapani/hyprvoice/internal/provider"
)
// getLanguageOptions returns language options for the dropdown
// if currentModel is provided, languages unsupported by that model will be marked
// currentLang is the currently selected language code (empty string for auto-detect)
func getLanguageOptions(currentModel *provider.Model, currentLang string) []huh.Option[string] {
// getModelLanguageOptions returns language options supported by the given model
func getModelLanguageOptions(model *provider.Model, currentLang string) []huh.Option[string] {
var options []huh.Option[string]
// auto-detect is always first
@@ -21,18 +19,15 @@ func getLanguageOptions(currentModel *provider.Model, currentLang string) []huh.
}
options = append(options, huh.NewOption(autoLabel, ""))
// add all languages
// only show languages supported by the model
for _, lang := range language.List() {
label := formatLanguageLabel(lang)
// mark current selection
if lang.Code == currentLang {
label += " (current)"
if model != nil && !model.SupportsLanguage(lang.Code) {
continue
}
// add warning if model doesn't support this language
if currentModel != nil && !currentModel.SupportsLanguage(lang.Code) {
label += " (not supported by current model)"
label := formatLanguageLabel(lang)
if lang.Code == currentLang {
label += " (current)"
}
options = append(options, huh.NewOption(label, lang.Code))