summaryrefslogtreecommitdiff
path: root/internal/config
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-21 23:12:52 +0300
committerPaul Buetow <paul@buetow.org>2026-04-21 23:12:52 +0300
commit3e99f5a75e14455aa75ca3a1dc7d08bd3e6f55fd (patch)
tree568bb781c0d71bdea58f5dc7192e6c5edec94c27 /internal/config
parentd15846a2784d15c5043833874b6539b727555cb0 (diff)
u7: wire documented config knobs into runtime
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/config.go8
-rw-r--r--internal/config/config_test.go37
2 files changed, 45 insertions, 0 deletions
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)
}