feat: models test and fixes
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetTranscriptionModelOptions_ShowsCapabilities(t *testing.T) {
|
||||
// test elevenlabs - has batch-only and streaming-only models
|
||||
// test elevenlabs - includes batch+streaming and streaming-only models
|
||||
options := getTranscriptionModelOptions("elevenlabs")
|
||||
|
||||
// should have 3 models: scribe_v1, scribe_v2, scribe_v2_realtime
|
||||
@@ -23,12 +23,7 @@ func TestGetTranscriptionModelOptions_ShowsCapabilities(t *testing.T) {
|
||||
continue
|
||||
}
|
||||
|
||||
if model.SupportsStreaming && !model.SupportsBatch {
|
||||
// streaming-only should mention streaming
|
||||
if !strings.Contains(opt.Desc, "streaming") {
|
||||
t.Errorf("streaming-only model %s should mention streaming in desc: %s", opt.ID, opt.Desc)
|
||||
}
|
||||
} else if model.SupportsBothModes() {
|
||||
if model.SupportsBothModes() {
|
||||
// both modes should mention batch+streaming
|
||||
if !strings.Contains(opt.Desc, "batch+streaming") {
|
||||
t.Errorf("both-modes model %s should mention batch+streaming in desc: %s", opt.ID, opt.Desc)
|
||||
@@ -75,11 +70,12 @@ func TestGetTranscriptionModelOptions_OpenAI_ShowsCapabilities(t *testing.T) {
|
||||
func TestGetTranscriptionModelOptions_Deepgram_ShowsBothModes(t *testing.T) {
|
||||
options := getTranscriptionModelOptions("deepgram")
|
||||
|
||||
// Deepgram has 2 models: nova-3, nova-2 - both support batch+streaming
|
||||
// Deepgram has 2 models: nova-3, nova-2
|
||||
if len(options) != 2 {
|
||||
t.Errorf("expected 2 options for deepgram, got %d", len(options))
|
||||
}
|
||||
|
||||
// all deepgram models support both modes
|
||||
for _, opt := range options {
|
||||
if !strings.Contains(opt.Desc, "batch+streaming") {
|
||||
t.Errorf("deepgram model %s should mention batch+streaming: %s", opt.ID, opt.Desc)
|
||||
|
||||
+10
-4
@@ -66,13 +66,13 @@ func onboardingSummaryScreen(state *wizardState, onBack func() screen) screen {
|
||||
|
||||
func newMenuScreen(state *wizardState) screen {
|
||||
items := []optionItem{
|
||||
{title: formatProvidersLabel(state.cfg), desc: "Manage API keys for cloud providers.", value: menuProviders},
|
||||
{title: "Save & Exit", desc: "Write config changes to disk.", value: menuSave},
|
||||
{title: formatVoiceModelLabel(state.cfg), desc: "Pick the transcription provider, model, and language.", value: menuVoiceModel},
|
||||
{title: formatLLMLabel(state.cfg), desc: "Configure post-processing and custom prompts.", value: menuLLM},
|
||||
{title: formatKeywordsLabel(state.cfg), desc: "Words to preserve spelling and phrasing.", value: menuKeywords},
|
||||
{title: formatProvidersLabel(state.cfg), desc: "Manage API keys for cloud providers.", value: menuProviders},
|
||||
{title: formatNotificationsLabel(state.cfg), desc: "Notification type and message text.", value: menuNotifications},
|
||||
{title: "Advanced Settings", desc: "Recording, injection, and timeout settings.", value: menuAdvanced},
|
||||
{title: "Save & Exit", desc: "Write config changes to disk.", value: menuSave},
|
||||
{title: "Discard & Exit", desc: "Exit without saving changes.", value: menuDiscard},
|
||||
}
|
||||
|
||||
@@ -178,6 +178,9 @@ func newAPIKeyInputScreen(state *wizardState, providerName string, onContinue fu
|
||||
}
|
||||
}
|
||||
desc := []string{fmt.Sprintf("Enter your %s API key", displayName)}
|
||||
if url := getProviderKeyURL(providerName); url != "" {
|
||||
desc = append(desc, fmt.Sprintf("Get key: %s", url))
|
||||
}
|
||||
validate := func(s string) error {
|
||||
if s == "" {
|
||||
return fmt.Errorf("API key is required")
|
||||
@@ -354,8 +357,11 @@ func newLanguageScreen(state *wizardState, model *provider.Model, onBack func()
|
||||
|
||||
func applyStreamingSelection(state *wizardState, model *provider.Model, onBack func() screen, next func() screen) screen {
|
||||
if model.SupportsBothModes() {
|
||||
desc := []string{"This model supports both batch and streaming modes."}
|
||||
return newConfirmScreen(state, "Enable Streaming Mode?", desc, "Yes, streaming", "Lower latency, higher resource use.", "No, batch", "Wait for full transcription.", func() screen {
|
||||
desc := []string{
|
||||
"This model supports both batch and streaming modes.",
|
||||
"Streaming is quicker but more expensive.",
|
||||
}
|
||||
return newConfirmScreen(state, "Enable Streaming Mode?", desc, "Yes, streaming", "Quicker response, higher cost.", "No, batch", "Wait for full transcription (cheaper).", func() screen {
|
||||
state.cfg.Transcription.Streaming = true
|
||||
return next()
|
||||
}, func() screen {
|
||||
|
||||
@@ -33,6 +33,14 @@ func getProviderDisplayName(providerName string) string {
|
||||
return providerName
|
||||
}
|
||||
|
||||
func getProviderKeyURL(providerName string) string {
|
||||
p := provider.GetProvider(providerName)
|
||||
if p == nil {
|
||||
return ""
|
||||
}
|
||||
return p.APIKeyURL()
|
||||
}
|
||||
|
||||
func maskAPIKey(key string) string {
|
||||
if len(key) <= 8 {
|
||||
return "***"
|
||||
|
||||
@@ -15,6 +15,10 @@ func TestWizardMenuTransitionAppliesSize(t *testing.T) {
|
||||
updated, _ := model.Update(tea.WindowSizeMsg{Width: 120, Height: 40})
|
||||
model = updated.(wizardModel)
|
||||
|
||||
// move down to "Voice Model" item (index 1) which leads to a listScreen
|
||||
updated, _ = model.Update(tea.KeyMsg{Type: tea.KeyDown})
|
||||
model = updated.(wizardModel)
|
||||
|
||||
updated, _ = model.Update(tea.KeyMsg{Type: tea.KeyEnter})
|
||||
model = updated.(wizardModel)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user