feat: better onboarding
This commit is contained in:
@@ -165,85 +165,3 @@ func getTranscriptionModelOptions(provider string) []huh.Option[string] {
|
||||
return []huh.Option[string]{}
|
||||
}
|
||||
}
|
||||
|
||||
func configureTranscription(configuredProviders []string, cfg *config.Config) (string, string, string, error) {
|
||||
var transcriptionOptions []huh.Option[string]
|
||||
for _, name := range configuredProviders {
|
||||
p := provider.GetProvider(name)
|
||||
if p != nil && p.SupportsTranscription() {
|
||||
switch name {
|
||||
case "openai":
|
||||
transcriptionOptions = append(transcriptionOptions,
|
||||
huh.NewOption("OpenAI Whisper", "openai"))
|
||||
case "groq":
|
||||
transcriptionOptions = append(transcriptionOptions,
|
||||
huh.NewOption("Groq Whisper (transcription)", "groq-transcription"),
|
||||
huh.NewOption("Groq Whisper (translate to English)", "groq-translation"))
|
||||
case "mistral":
|
||||
transcriptionOptions = append(transcriptionOptions,
|
||||
huh.NewOption("Mistral Voxtral", "mistral-transcription"))
|
||||
case "elevenlabs":
|
||||
transcriptionOptions = append(transcriptionOptions,
|
||||
huh.NewOption("ElevenLabs Scribe", "elevenlabs"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(transcriptionOptions) == 0 {
|
||||
return "", "", "", fmt.Errorf("no transcription-capable providers configured")
|
||||
}
|
||||
|
||||
var selectedProvider string
|
||||
if cfg.Transcription.Provider != "" {
|
||||
selectedProvider = cfg.Transcription.Provider
|
||||
} else if len(transcriptionOptions) > 0 {
|
||||
selectedProvider = transcriptionOptions[0].Value
|
||||
}
|
||||
|
||||
providerForm := huh.NewForm(
|
||||
huh.NewGroup(
|
||||
huh.NewSelect[string]().
|
||||
Title("Transcription Provider").
|
||||
Description("Choose which service to use for speech-to-text").
|
||||
Options(transcriptionOptions...).
|
||||
Value(&selectedProvider),
|
||||
),
|
||||
).WithTheme(getTheme())
|
||||
|
||||
if err := providerForm.Run(); err != nil {
|
||||
return "", "", "", err
|
||||
}
|
||||
|
||||
modelOptions := getTranscriptionModelOptions(selectedProvider)
|
||||
var selectedModel string
|
||||
if cfg.Transcription.Model != "" {
|
||||
selectedModel = cfg.Transcription.Model
|
||||
} else if len(modelOptions) > 0 {
|
||||
selectedModel = modelOptions[0].Value
|
||||
}
|
||||
|
||||
var language string
|
||||
if cfg.Transcription.Language != "" {
|
||||
language = cfg.Transcription.Language
|
||||
}
|
||||
|
||||
modelForm := huh.NewForm(
|
||||
huh.NewGroup(
|
||||
huh.NewSelect[string]().
|
||||
Title("Transcription Model").
|
||||
Options(modelOptions...).
|
||||
Value(&selectedModel),
|
||||
huh.NewInput().
|
||||
Title("Language").
|
||||
Description("ISO-639-1 code (e.g., 'en', 'es', 'fr') or empty for auto-detect").
|
||||
Placeholder("auto-detect").
|
||||
Value(&language),
|
||||
),
|
||||
).WithTheme(getTheme())
|
||||
|
||||
if err := modelForm.Run(); err != nil {
|
||||
return "", "", "", err
|
||||
}
|
||||
|
||||
return selectedProvider, selectedModel, language, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user