summaryrefslogtreecommitdiff
path: root/internal/gui/queue.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-07-16 20:38:22 +0300
committerPaul Buetow <paul@buetow.org>2025-07-16 20:38:22 +0300
commitd46669426aa6b0ece71d0d05d0b6f2966686b17a (patch)
tree9f927c3a8bc763943764ad63e3badafe8a9a7f62 /internal/gui/queue.go
parente49ecfe601c924fa68671477331a860acf8a62f7 (diff)
feat: add custom image prompt support and keyboard shortcuts
- Add text area next to image display for custom image generation prompts - Users can specify their own prompts or leave empty for auto-generation - Display the used prompt in the text area after generation - Load prompts from attribution files when navigating to existing cards - Add keyboard shortcuts for all GUI buttons: - G: Generate, N: New Word, I: Regenerate Image, A: Regenerate Audio - R: Regenerate All, D: Delete, P: Play audio - Left/Right arrows: Navigate between words - Y/N: Confirm/cancel delete dialog - Update UI layout with equal 50/50 split between image and prompt - Enable text wrapping in prompt text area - Add 25% chance to ask OpenAI for creative photo style suggestions - Fix concurrent processing to properly use custom prompts 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'internal/gui/queue.go')
-rw-r--r--internal/gui/queue.go31
1 files changed, 19 insertions, 12 deletions
diff --git a/internal/gui/queue.go b/internal/gui/queue.go
index 7b1c5de..aaa0c55 100644
--- a/internal/gui/queue.go
+++ b/internal/gui/queue.go
@@ -9,15 +9,16 @@ import (
// WordJob represents a single word processing job
type WordJob struct {
- ID int
- Word string
- Translation string
- AudioFile string
- ImageFiles []string
- Status JobStatus
- Error error
- StartedAt time.Time
- CompletedAt time.Time
+ ID int
+ Word string
+ Translation string
+ AudioFile string
+ ImageFiles []string
+ Status JobStatus
+ Error error
+ StartedAt time.Time
+ CompletedAt time.Time
+ CustomPrompt string // Custom prompt for image generation
}
// JobStatus represents the current state of a job
@@ -93,11 +94,17 @@ func (q *WordQueue) SetCallbacks(onStatusUpdate func(*WordJob), onJobComplete fu
// AddWord adds a word to the processing queue
func (q *WordQueue) AddWord(word string) *WordJob {
+ return q.AddWordWithPrompt(word, "")
+}
+
+// AddWordWithPrompt adds a word to the processing queue with a custom prompt
+func (q *WordQueue) AddWordWithPrompt(word, customPrompt string) *WordJob {
q.mu.Lock()
job := &WordJob{
- ID: q.nextID,
- Word: word,
- Status: StatusQueued,
+ ID: q.nextID,
+ Word: word,
+ Status: StatusQueued,
+ CustomPrompt: customPrompt,
}
q.nextID++
q.results[job.ID] = job