This commit is contained in:
parent
99a6957d04
commit
d4823afc81
|
|
@ -86,6 +86,10 @@ def backend(text, sampling, api_suffix):
|
||||||
msg = choice.get("message", {})
|
msg = choice.get("message", {})
|
||||||
txt = msg.get("content", "").strip()
|
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"
|
log(f"🟢 [{now()}] HTTP {r.status_code} tokens={ctok} finish={fr}\n"
|
||||||
f"🟢 resp800={r.text[:800]!r}")
|
f"🟢 resp800={r.text[:800]!r}")
|
||||||
if r.status_code != 200:
|
if r.status_code != 200:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue