diff --git a/.gitignore b/.gitignore index 5f70432..db1557f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ __pycache__/ *.pyc +*.swp .env session/audio/ llm.log +config.json diff --git a/session/config.json b/session/config.json deleted file mode 100644 index b095244..0000000 --- a/session/config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "llm": { - "model": "openai/deepseek-r1", - "api_key": null, - "api_base": "http://localhost:8080/v1", - "temperature": 0.7 - } -} diff --git a/session/config.json.template b/session/config.json.template new file mode 100644 index 0000000..030c495 --- /dev/null +++ b/session/config.json.template @@ -0,0 +1,8 @@ +{ + "llm": { + "model": "openrouter/free", + "api_key": "YOUR_API_KEY", + "api_base": "https://openrouter.ai/api/v1", + "temperature": 0.8 + } +} diff --git a/tools/engine.py b/tools/engine.py index a735024..a7bf1fd 100644 --- a/tools/engine.py +++ b/tools/engine.py @@ -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: