Tweaks of gitignore, LLM block strip, config template

This commit is contained in:
Dejvino
2026-06-25 23:07:19 +02:00
parent 52f590d432
commit 18ae3be428
4 changed files with 17 additions and 9 deletions
+7 -1
View File
@@ -1076,8 +1076,14 @@ class GameEngine:
if matches:
json_str = matches[-1].strip()
# Remove the JSON block from narrative
narrative = text[: text.rfind("```json")]
narrative = narrative.strip()
# Also strip any stray "book_log:" lines that may appear before the JSON block
narrative_lines = []
for line in narrative.splitlines():
if not line.lstrip().startswith('book_log:'):
narrative_lines.append(line)
narrative = "\n".join(narrative_lines).strip()
try:
data = json.loads(json_str)
except json.JSONDecodeError: