diff options
| author | Paul Buetow <paul@buetow.org> | 2025-07-17 15:35:03 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-07-17 15:35:03 +0300 |
| commit | f6477f82dc79d17e9ee3193c81dca2db884a7119 (patch) | |
| tree | 3424d2342ba976791dc3bb8b108dfdd290018175 /internal/image/openai.go | |
| parent | 094447b570c5c5a7c751e0e60279cfa08e945755 (diff) | |
add phoenetic alphabet
Diffstat (limited to 'internal/image/openai.go')
| -rw-r--r-- | internal/image/openai.go | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/internal/image/openai.go b/internal/image/openai.go index ac66a45..c00ae5a 100644 --- a/internal/image/openai.go +++ b/internal/image/openai.go @@ -115,12 +115,21 @@ func (c *OpenAIClient) Search(ctx context.Context, opts *SearchOptions) ([]Searc } } - // Translate Bulgarian word to English for better results - translatedWord, err := c.translateBulgarianToEnglish(ctx, opts.Query) - if err != nil { - // If translation fails, fall back to using the original word - fmt.Printf("Translation failed: %v, using original word\n", err) - translatedWord = opts.Query + // Use provided translation if available, otherwise translate Bulgarian word to English + var translatedWord string + if opts.Translation != "" { + // Use the translation that was already provided (from UI or user input) + translatedWord = opts.Translation + fmt.Printf("Using provided translation: %s -> %s\n", opts.Query, translatedWord) + } else { + // Translate Bulgarian word to English for better results + var err error + translatedWord, err = c.translateBulgarianToEnglish(ctx, opts.Query) + if err != nil { + // If translation fails, fall back to using the original word + fmt.Printf("Translation failed: %v, using original word\n", err) + translatedWord = opts.Query + } } // Create prompt - use custom if provided, otherwise generate educational prompt |
