From 642373f59b2bf4c650267eacba8043464f77397e Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 3 Apr 2026 10:55:52 +0300 Subject: fix: disable Gemini thinking for phonetic IPA lookup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gemini 2.5 Flash runs internal reasoning by default. Those thinking tokens count against MaxOutputTokens, leaving almost no budget for the actual IPA output — hence the truncated [ˈɡlɛdɐm with no closing bracket. Set ThinkingBudget=0 in ThinkingConfig so all 200 output tokens are reserved for the IPA transcription itself. A simple dictionary-style lookup needs no chain-of-thought reasoning. Also included: audio_player layout fix (NewBorder center + TextWrapWord) so long IPA strings are not clipped in the GUI bar. Co-Authored-By: Claude Sonnet 4.6 --- internal/phonetic/fetcher.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'internal') diff --git a/internal/phonetic/fetcher.go b/internal/phonetic/fetcher.go index 04db171..7856ac7 100644 --- a/internal/phonetic/fetcher.go +++ b/internal/phonetic/fetcher.go @@ -91,6 +91,8 @@ var fetchOpenAIPhonetic = func(ctx context.Context, client *openai.Client, word var fetchGeminiPhonetic = func(ctx context.Context, client *genai.Client, word string) (string, error) { temp := float32(phoneticTemperature) + thinkingBudget := int32(0) // IPA lookup needs no reasoning; disable thinking so + // it doesn't consume MaxOutputTokens before any visible text is emitted. resp, err := client.Models.GenerateContent(ctx, defaultGeminiModel, []*genai.Content{ genai.NewContentFromText(buildGeminiPhoneticPrompt(word), genai.RoleUser), }, &genai.GenerateContentConfig{ @@ -99,6 +101,7 @@ var fetchGeminiPhonetic = func(ctx context.Context, client *genai.Client, word s }, Temperature: &temp, MaxOutputTokens: phoneticMaxTokens, + ThinkingConfig: &genai.ThinkingConfig{ThinkingBudget: &thinkingBudget}, }) if err != nil { return "", fmt.Errorf("gemini API error: %w", err) -- cgit v1.2.3