Bild-Weiche v2: stummen Fallback-except durch Logging ersetzen (Diagnose :9010)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from fastapi import APIRouter, Request
|
from fastapi import APIRouter, Request
|
||||||
@@ -8,6 +9,8 @@ from services.gateway_stream import record_stream_chunk, record_usage, warn_trun
|
|||||||
from services.router_logic import IMAGE_PART_TYPES, VISION_CAPABLE, choose_for_lane, has_image
|
from services.router_logic import IMAGE_PART_TYPES, VISION_CAPABLE, choose_for_lane, has_image
|
||||||
from services.routing_policy import load_policy
|
from services.routing_policy import load_policy
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
router = APIRouter(prefix="/v1")
|
router = APIRouter(prefix="/v1")
|
||||||
|
|
||||||
# Antwortsprache für IDE-/Lane-Traffic: die Coding-Modelle antworten sonst englisch
|
# Antwortsprache für IDE-/Lane-Traffic: die Coding-Modelle antworten sonst englisch
|
||||||
@@ -65,8 +68,11 @@ async def _bilder_fuer_coder_beschreiben(body: dict, client, vision_alias: str)
|
|||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
text = ((r.json().get("choices") or [{}])[0].get("message") or {}).get("content") or ""
|
text = ((r.json().get("choices") or [{}])[0].get("message") or {}).get("content") or ""
|
||||||
if not text.strip():
|
if not text.strip():
|
||||||
|
log.warning("Bild-Weiche v2: Beschreibung leer/fehlgeschlagen (HTTP %s) — Fallback Umleitung. Body: %.200s",
|
||||||
|
r.status_code, r.text)
|
||||||
return False
|
return False
|
||||||
except Exception:
|
except Exception:
|
||||||
|
log.warning("Bild-Weiche v2: Vision-Aufruf scheiterte — Fallback Umleitung", exc_info=True)
|
||||||
return False
|
return False
|
||||||
msg["content"][idx] = {"type": "text", "text": (
|
msg["content"][idx] = {"type": "text", "text": (
|
||||||
f"[Bild {nr}: dem Request lag ein Bild bei — {vision_alias} beschreibt es so:\n"
|
f"[Bild {nr}: dem Request lag ein Bild bei — {vision_alias} beschreibt es so:\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user