From 3e99f5a75e14455aa75ca3a1dc7d08bd3e6f55fd Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 21 Apr 2026 23:12:52 +0300 Subject: u7: wire documented config knobs into runtime --- internal/config/config.go | 8 ++++++++ internal/config/config_test.go | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) (limited to 'internal/config') diff --git a/internal/config/config.go b/internal/config/config.go index 5b4ab18..f778637 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -246,6 +246,14 @@ func (c *Config) ImageTextModel() string { return c.Models.ImageText } +// ComicAspectRatio returns the configured comic image aspect ratio. +func (c *Config) ComicAspectRatio() string { + if c == nil { + return "" + } + return c.Comic.AspectRatio +} + // TTSModel returns the configured text-to-speech model name. func (c *Config) TTSModel() string { if c == nil { diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 0a2734c..e27906d 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -36,6 +36,19 @@ prompts_dir: ./custom-prompts comic: story_pages: 7 panels_per_page: 2 + aspect_ratio: "1:1" + prompt_max_chars: 321 + page_max_retries: 2 + page_retry_base_seconds: 9 +story: + realistic_weight: 0.8 +styles: + comic: + - custom comic + realistic: + - custom realistic +narration: + chunk_words: 42 `)), 0o644); err != nil { t.Fatalf("write config: %v", err) } @@ -59,6 +72,30 @@ comic: if got, want := cfg.Comic.PanelsPerPage, 2; got != want { t.Fatalf("Comic.PanelsPerPage = %d, want %d", got, want) } + if got, want := cfg.Comic.AspectRatio, "1:1"; got != want { + t.Fatalf("Comic.AspectRatio = %q, want %q", got, want) + } + if got, want := cfg.Comic.PromptMaxChars, 321; got != want { + t.Fatalf("Comic.PromptMaxChars = %d, want %d", got, want) + } + if got, want := cfg.Comic.PageMaxRetries, 2; got != want { + t.Fatalf("Comic.PageMaxRetries = %d, want %d", got, want) + } + if got, want := cfg.Comic.PageRetryBaseSeconds, 9; got != want { + t.Fatalf("Comic.PageRetryBaseSeconds = %d, want %d", got, want) + } + if got, want := cfg.Story.RealisticWeight, 0.8; got != want { + t.Fatalf("Story.RealisticWeight = %v, want %v", got, want) + } + if got, want := len(cfg.Styles.Comic), 1; got != want || cfg.Styles.Comic[0] != "custom comic" { + t.Fatalf("Styles.Comic = %#v, want %q", cfg.Styles.Comic, "custom comic") + } + if got, want := len(cfg.Styles.Realistic), 1; got != want || cfg.Styles.Realistic[0] != "custom realistic" { + t.Fatalf("Styles.Realistic = %#v, want %q", cfg.Styles.Realistic, "custom realistic") + } + if got, want := cfg.Narration.ChunkWords, 42; got != want { + t.Fatalf("Narration.ChunkWords = %d, want %d", got, want) + } if got, want := cfg.PromptsDir, "./custom-prompts"; got != want { t.Fatalf("PromptsDir = %q, want %q", got, want) } -- cgit v1.2.3