Codex Claude Opus 4.8 commited on
Commit
3625c13
·
1 Parent(s): b483ca7

Fix card truncation: lead JSON with effects+name, request concise flavor/art, bump card tokens

Browse files

Root cause of pool-name + junk-effect cards: the model wrote name/flavor/long
art_prompt first and effects last, so max_tokens cut the JSON before it closed
-> parse failed -> whole card discarded (pool name, salvaged stray words like
'energy'). Now the requested JSON leads with effects then name (they survive a
cutoff), flavor/art_prompt are capped short, and card tokens raised to 320.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Files changed (2) hide show
  1. clients.py +1 -1
  2. generator.py +6 -2
clients.py CHANGED
@@ -51,7 +51,7 @@ def configure_mode() -> str:
51
  os.environ.setdefault("TABRAS_ART_MODEL", DEFAULT_ART_MODEL)
52
  os.environ.setdefault("TABRAS_AI_BOSS", "1")
53
  os.environ.setdefault("TABRAS_CARD_TEMPERATURE", "0.7")
54
- os.environ.setdefault("TABRAS_CARD_MAX_TOKENS", "256")
55
  os.environ.setdefault("TABRAS_BOSS_MAX_TOKENS", "96")
56
  os.environ.setdefault("TABRAS_ART_STEPS", "4")
57
  return mode
 
51
  os.environ.setdefault("TABRAS_ART_MODEL", DEFAULT_ART_MODEL)
52
  os.environ.setdefault("TABRAS_AI_BOSS", "1")
53
  os.environ.setdefault("TABRAS_CARD_TEMPERATURE", "0.7")
54
+ os.environ.setdefault("TABRAS_CARD_MAX_TOKENS", "320")
55
  os.environ.setdefault("TABRAS_BOSS_MAX_TOKENS", "96")
56
  os.environ.setdefault("TABRAS_ART_STEPS", "4")
57
  return mode
generator.py CHANGED
@@ -369,8 +369,11 @@ def llamacpp_card_prompt(payload: dict[str, Any], pack_cards: Sequence[dict[str,
369
  return "\n".join(
370
  (
371
  "Create exactly one Tabras card as JSON.",
372
- "Shape: {\"name\": string, \"flavor\": string, \"art_prompt\": string, \"effects\": [{\"primitive_id\": string, \"weight\": 1}]}",
 
 
373
  "Use one or two effects. Do not write numeric damage, block, heal, or rules numbers.",
 
374
  "Fit the school identity, but invent the card's fantasy and tactical purpose freely.",
375
  "Do not describe Fire as a people or species; use fast damage plan or pressure plan.",
376
  "Prefer a new tactical purpose over repeating the current deck or pack.",
@@ -426,7 +429,8 @@ def llamacpp_retry_prompt(payload: dict[str, Any], need: str) -> str:
426
  return "\n".join(
427
  (
428
  "Create exactly one corrected Tabras card as JSON.",
429
- "Shape: {\"name\": string, \"flavor\": string, \"art_prompt\": string, \"effects\": [{\"primitive_id\": string, \"weight\": 1}]}",
 
430
  "Make flavor and art_prompt describe the same concrete scene.",
431
  "The art_prompt must describe an image scene only; no cards, text, frames, UI, or rules.",
432
  *naming_rules(),
 
369
  return "\n".join(
370
  (
371
  "Create exactly one Tabras card as JSON.",
372
+ # effects + name come first so the card survives if the model is cut off
373
+ # mid-output; keep flavor and art_prompt short so the JSON always closes.
374
+ "Shape: {\"effects\": [{\"primitive_id\": string, \"weight\": 1}], \"name\": string, \"flavor\": string, \"art_prompt\": string}",
375
  "Use one or two effects. Do not write numeric damage, block, heal, or rules numbers.",
376
+ "Keep flavor under 12 words. Keep art_prompt under 18 words. Output only one compact JSON object.",
377
  "Fit the school identity, but invent the card's fantasy and tactical purpose freely.",
378
  "Do not describe Fire as a people or species; use fast damage plan or pressure plan.",
379
  "Prefer a new tactical purpose over repeating the current deck or pack.",
 
429
  return "\n".join(
430
  (
431
  "Create exactly one corrected Tabras card as JSON.",
432
+ "Shape: {\"effects\": [{\"primitive_id\": string, \"weight\": 1}], \"name\": string, \"flavor\": string, \"art_prompt\": string}",
433
+ "Keep flavor under 12 words and art_prompt under 18 words; output one compact JSON object.",
434
  "Make flavor and art_prompt describe the same concrete scene.",
435
  "The art_prompt must describe an image scene only; no cards, text, frames, UI, or rules.",
436
  *naming_rules(),