From dc531460ea47fd9b027c51d73e7d50b856039309 Mon Sep 17 00:00:00 2001 From: Yuzhiran Dev Date: Sun, 17 May 2026 22:52:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B0=8F=E7=BA=A2=E4=B9=A6=E6=96=87?= =?UTF-8?q?=E7=AB=A0=E6=97=A0=E6=AD=A3=E5=B8=B8=E5=86=85=E5=AE=B9=EF=BC=88?= =?UTF-8?q?LLM=E6=8E=A8=E7=90=86=E6=96=87=E6=9C=AC=E6=B1=A1=E6=9F=93?= =?UTF-8?q?=EF=BC=89=E3=80=81=E6=A8=A1=E5=9D=97=E5=88=97=E8=A1=A8=E4=B8=8D?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E3=80=81=E8=84=9A=E6=9C=AC=E7=8B=AC=E7=AB=8B?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E7=BC=BAorg=5Fid=E5=88=97=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform/backend/app/api/system.py | 2 +- platform/backend/app/core/nvidia_client.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/platform/backend/app/api/system.py b/platform/backend/app/api/system.py index 5d2153c..4c4df96 100644 --- a/platform/backend/app/api/system.py +++ b/platform/backend/app/api/system.py @@ -193,7 +193,7 @@ def get_modules_status(): "scheduled_optimize_sources": {"name": "πŸ“‘ δΏ‘ζ―ζΊδΌ˜εŒ–", "log": LOGS_DIR / f"optimizer_sources_{today_str}.log"}, "scheduled_metrics_sync": {"name": "πŸ“Š ζŒ‡ζ ‡εŒζ­₯", "log": LOGS_DIR / f"metrics_sync_{today_str}.log"}, } - jobs = {j.id: j for j in scheduler.get_jobs()} + jobs = {j['id']: j for j in scheduler.get_jobs()} modules = [] for mod_id, cfg in log_based.items(): log_file = cfg["log"] diff --git a/platform/backend/app/core/nvidia_client.py b/platform/backend/app/core/nvidia_client.py index 03e7b45..72a9a11 100644 --- a/platform/backend/app/core/nvidia_client.py +++ b/platform/backend/app/core/nvidia_client.py @@ -110,7 +110,8 @@ def call_llm( if resp.status_code != 200: raise LLMError(f"HTTP {resp.status_code}: {resp.text[:200]}") if stream: - full = [] + content_parts = [] + reasoning_parts = [] for line in resp.iter_lines(): if not line: continue if line.startswith(b'data: '): @@ -119,12 +120,14 @@ def call_llm( try: chunk = json.loads(data) delta = chunk['choices'][0]['delta'] - if delta.get('reasoning_content'): - full.append(delta['reasoning_content']) if delta.get('content'): - full.append(delta['content']) + content_parts.append(delta['content']) + if delta.get('reasoning_content'): + reasoning_parts.append(delta['reasoning_content']) except Exception: continue - return "".join(full) + if content_parts: + return "".join(content_parts) + return "".join(reasoning_parts) else: data = resp.json() msg = data["choices"][0]["message"]