From b38ae9e1b1018b32641c953859d9db4421a12935 Mon Sep 17 00:00:00 2001 From: Claude Dev Date: Mon, 16 Mar 2026 11:00:00 +0100 Subject: [PATCH] fix: Quellenlinks bei String-Nr repariert (574, 610, 611, 617 etc.) Ursache: Claude liefert teilweise Quellennummern als String statt Integer. Der Frontend-Vergleich (===) schlug dann fehl: "574" !== 574. Fixes: - 95 String-Nummern in Irankonflikt sources_json zu Integer konvertiert - 5 Duplikate entfernt - Frontend: Number() statt parseInt/=== fuer robusten Vergleich - Orchestrator: Automatische Konvertierung von String-Nr zu Integer vor DB-Speicherung - Cache-Buster aktualisiert Co-Authored-By: Claude Opus 4.6 (1M context) --- src/agents/orchestrator.py | 9 +++++++++ src/static/dashboard.html | 2 +- src/static/js/components.js | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/agents/orchestrator.py b/src/agents/orchestrator.py index d3731f2..6445510 100644 --- a/src/agents/orchestrator.py +++ b/src/agents/orchestrator.py @@ -999,6 +999,15 @@ class AgentOrchestrator: logger.info("Platzhalter fuer fehlende Quelle [%d] eingefuegt", nr) sources.sort(key=lambda s: int(s.get("nr", 0)) if isinstance(s.get("nr"), int) or (isinstance(s.get("nr"), str) and str(s.get("nr", "")).isdigit()) else 9999) + # Sicherstellen dass alle nr-Werte Integer sind (Claude liefert manchmal Strings) + if sources: + for s in sources: + nr = s.get("nr") + if isinstance(nr, str): + try: + s["nr"] = int(nr) + except ValueError: + pass sources_json = json.dumps(sources, ensure_ascii=False) if sources else previous_sources_json await db.execute( diff --git a/src/static/dashboard.html b/src/static/dashboard.html index 4c7cc20..e51cbe9 100644 --- a/src/static/dashboard.html +++ b/src/static/dashboard.html @@ -751,7 +751,7 @@ - + diff --git a/src/static/js/components.js b/src/static/js/components.js index cf9acbd..b17851b 100644 --- a/src/static/js/components.js +++ b/src/static/js/components.js @@ -447,7 +447,7 @@ const UI = { // Inline-Zitate [1], [2] etc. als klickbare Links rendern if (sources.length > 0) { html = html.replace(/\[(\d+)\]/g, (match, num) => { - const src = sources.find(s => s.nr === parseInt(num)); + const src = sources.find(s => Number(s.nr) === Number(num)); if (src && src.url) { return `[${num}]`; }