summaryrefslogtreecommitdiff
path: root/internal/processor/image_downloader.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-10 23:11:30 +0300
committerPaul Buetow <paul@buetow.org>2026-04-10 23:11:30 +0300
commit65430e9876a32988839deb7a70dc1e42da21cf64 (patch)
treee0de040cb53d5b90587908f2d55e86e49664fc35 /internal/processor/image_downloader.go
parent4b4b3665230faafbd994f09894cb07c8f9d4b359 (diff)
Release 0.28.2v0.28.2
Diffstat (limited to 'internal/processor/image_downloader.go')
-rw-r--r--internal/processor/image_downloader.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/processor/image_downloader.go b/internal/processor/image_downloader.go
index 1d6c002..fa0f6cf 100644
--- a/internal/processor/image_downloader.go
+++ b/internal/processor/image_downloader.go
@@ -24,6 +24,13 @@ import (
// AI image providers can generate more contextually accurate images.
// ctx is passed to the image downloader so the caller's deadline applies.
func (p *Processor) downloadImagesWithTranslation(ctx context.Context, word, translationText string) error {
+ return p.downloadImagesWithPrompt(ctx, word, translationText, "")
+}
+
+// downloadImagesWithPrompt downloads images for a word and optionally reuses a
+// previously-saved prompt. When customPrompt is empty the provider generates a
+// fresh prompt as usual.
+func (p *Processor) downloadImagesWithPrompt(ctx context.Context, word, translationText, customPrompt string) error {
searcher, err := p.newImageSearcher()
if err != nil {
return err
@@ -43,6 +50,9 @@ func (p *Processor) downloadImagesWithTranslation(ctx context.Context, word, tra
if translationText != "" {
searchOpts.Translation = translationText
}
+ if strings.TrimSpace(customPrompt) != "" {
+ searchOpts.CustomPrompt = strings.TrimSpace(customPrompt)
+ }
// Register a prompt callback so the AI-generated prompt is persisted
// to disk before the download completes (used by the GUI and for debugging).