From 813b3d975ea37da75ea84355718b4b0fe549f3ff Mon Sep 17 00:00:00 2001 From: Claude Dev Date: Sat, 28 Mar 2026 00:11:01 +0100 Subject: [PATCH] fix: Markdown-Code-Block-Wrapper vor JSON-Parse entfernen Claude CLI gibt bei tools=None oft Antworten in Markdown-Code-Blocks zurueck (dreifache Backticks json...Backticks). Diese werden jetzt vor dem JSON-Parse per Regex entfernt. --- src/routers/incidents.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/routers/incidents.py b/src/routers/incidents.py index d69663d..b2f03c1 100644 --- a/src/routers/incidents.py +++ b/src/routers/incidents.py @@ -232,6 +232,11 @@ async def enhance_description( # call_claude erzwingt bei tools=None JSON-Output — # Haiku wrapped den Text dann in ein JSON-Objekt (oft verschachtelt) text = result.strip() + # Markdown-Code-Block-Wrapper entfernen + import re as _re + _md = _re.search(r'`{3}(?:json)?\s*\n?(.*?)\n?\s*`{3}', text, _re.DOTALL) + if _md: + text = _md.group(1).strip() try: import json as _json parsed = _json.loads(text)