From d4823afc8147b370365fe42884b7e18bf0eb637f Mon Sep 17 00:00:00 2001 From: hailin Date: Fri, 1 Aug 2025 09:52:03 +0800 Subject: [PATCH] . --- meta_ui.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta_ui.py b/meta_ui.py index 6da38ce..b4b8b87 100644 --- a/meta_ui.py +++ b/meta_ui.py @@ -86,6 +86,10 @@ def backend(text, sampling, api_suffix): msg = choice.get("message", {}) txt = msg.get("content", "").strip() + # 新增:从 usage 获取 completion_tokens + ctok = data.get("usage", {}).get("completion_tokens") + fr = choice.get("finish_reason") # 如果后续需要 finish reason + log(f"🟢 [{now()}] HTTP {r.status_code} tokens={ctok} finish={fr}\n" f"🟢 resp800={r.text[:800]!r}") if r.status_code != 200: