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}]`; }