From d949e900513eb8b89fa67350c685cf290a1c0345 Mon Sep 17 00:00:00 2001 From: Xiaoxia Agent Date: Mon, 5 Oct 2026 21:29:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(style):=20E741=20=E6=A8=A1=E7=B3=8A?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E5=90=8D=20l=20->=20lpos=EF=BC=88vision=20JS?= =?UTF-8?q?ON=E5=AE=9A=E4=BD=8D=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/worker/worker_app/tasks/vision/vlm_fallback.py | 6 +++--- apps/worker/worker_app/tasks/vision/vlm_fast_json.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/worker/worker_app/tasks/vision/vlm_fallback.py b/apps/worker/worker_app/tasks/vision/vlm_fallback.py index c9b9e1d61..eef12b395 100644 --- a/apps/worker/worker_app/tasks/vision/vlm_fallback.py +++ b/apps/worker/worker_app/tasks/vision/vlm_fallback.py @@ -140,11 +140,11 @@ def call_pro_vlm( usage.get("completion_tokens", 0), ) text = _strip_code_fence(raw) - l, r_pos = text.find("{"), text.rfind("}") - if l < 0 or r_pos <= l: + lpos, r_pos = text.find("{"), text.rfind("}") + if lpos < 0 or r_pos <= lpos: logger.warning("[vision.v2] pro 无JSON elapsed=%.1fs head=%s", elapsed, raw[:200]) return None - obj = json.loads(text[l : r_pos + 1]) + obj = json.loads(text[lpos : r_pos + 1]) if not isinstance(obj, dict): return None scene = obj.get("scene") or "通用" diff --git a/apps/worker/worker_app/tasks/vision/vlm_fast_json.py b/apps/worker/worker_app/tasks/vision/vlm_fast_json.py index 3de9bba1b..48af71262 100644 --- a/apps/worker/worker_app/tasks/vision/vlm_fast_json.py +++ b/apps/worker/worker_app/tasks/vision/vlm_fast_json.py @@ -152,9 +152,9 @@ def call_fast_json( reasoning_tokens, ) text = _strip_code_fence(raw) - l, r = text.find("{"), text.rfind("}") - if l >= 0 and r > l: - text = text[l : r + 1] + lpos, r = text.find("{"), text.rfind("}") + if lpos >= 0 and r > lpos: + text = text[lpos : r + 1] try: obj = json.loads(text) except json.JSONDecodeError: