Tweaks of gitignore, LLM block strip, config template
This commit is contained in:
parent
52f590d432
commit
18ae3be428
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,7 @@
|
||||
__pycache__/
|
||||
*.pyc
|
||||
*.swp
|
||||
.env
|
||||
session/audio/
|
||||
llm.log
|
||||
config.json
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
{
|
||||
"llm": {
|
||||
"model": "openai/deepseek-r1",
|
||||
"api_key": null,
|
||||
"api_base": "http://localhost:8080/v1",
|
||||
"temperature": 0.7
|
||||
}
|
||||
}
|
||||
8
session/config.json.template
Normal file
8
session/config.json.template
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"llm": {
|
||||
"model": "openrouter/free",
|
||||
"api_key": "YOUR_API_KEY",
|
||||
"api_base": "https://openrouter.ai/api/v1",
|
||||
"temperature": 0.8
|
||||
}
|
||||
}
|
||||
@ -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:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user