Tweaks of gitignore, LLM block strip, config template
This commit is contained in:
+7
-1
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user