fix(llm-parse): tolerate non-strict JSON from Gemini and similar models

Gemini reached through the OpenAI-compatible endpoint returns
JavaScript-object-literal output — single-quoted strings, unquoted keys,
trailing commas — which strict JSON.parse rejects. The reservation list
then came back empty and the booking-import UI showed nothing (#1638).

Add a shared parseLenientJson() that tries strict JSON first and falls
back to JSON5 (which accepts exactly that relaxed superset), and route
both the OpenAI-compatible and Ollama-native parse paths through it,
replacing the two identical strict parsers.
This commit is contained in:
fbnlrz
2026-07-21 22:44:39 +02:00
committed by Maurice
parent 791468e5b3
commit 9ad3507e57
7 changed files with 105 additions and 26 deletions
+1
View File
@@ -40,6 +40,7 @@
"fast-xml-parser": "^5.5.10",
"helmet": "^8.1.0",
"jimp": "^1.6.1",
"json5": "^2.2.3",
"jsonwebtoken": "^9.0.2",
"node-cron": "^4.2.1",
"nodemailer": "^9.0.1",