Problem
The /llm_log debug endpoint reconstructs multi-line JSON objects using manual {/} counting (novelforge/__init__.py lines 250-261). This breaks on:
- Strings containing brace characters:
{"key": "value with { brace"}
- Escaped quotes within JSON strings
- Single-line complete JSON objects with balanced braces
Why It Matters
Developers debugging LLM issues see truncated or garbled log entries.
Recommended Fix
Option A: Change the logger to write one JSON object per line (no indent), then read with [json.loads(line) for line in content.splitlines() if line.strip()].
Option B: Use regex splitting on top-level objects:
raw_objects = re.split(r'\n(?=\{)', content)
entries = [json.loads(raw) for raw in raw_objects if raw.strip()]
Problem
The
/llm_logdebug endpoint reconstructs multi-line JSON objects using manual{/}counting (novelforge/__init__.pylines 250-261). This breaks on:{"key": "value with { brace"}Why It Matters
Developers debugging LLM issues see truncated or garbled log entries.
Recommended Fix
Option A: Change the logger to write one JSON object per line (no indent), then read with
[json.loads(line) for line in content.splitlines() if line.strip()].Option B: Use regex splitting on top-level objects: