dd349b64cf
v2 的 stable_limit = usage + balance - BUFFER 依赖余额 API 随消耗实时递减, 实测滞后(08-12 快照 1,558,307 在 usage 涨 45 万期间不动)导致池膨胀、限额 虚高,放行到扣费区(当日超余额 13.8 万已扣费)。 扣费口径(用户确认):是否扣费只取决于当下免费额度,超出即扣费,采集量只 决定明日发放。v4:stable_limit = balance - BUFFER 冻结快照,本地 usage 实时 撞线即拦,等价于本地实时扣减余额;effective = min(2M 配额, stable_limit)。 新增 docs/volc-quota-notes.md 额度机制速查;merge-auto-consume.md 补 §4.5。
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
import json
|
|
import re
|
|
|
|
transcript_path = r"C:\Users\Kimber Xu\.gemini\antigravity-ide\brain\ef230fd3-39a1-47f8-aa16-4969fb505243\.system_generated\logs\transcript.jsonl"
|
|
file_path = r"d:\PyCharm_projects\litellm-config\volc_limit_sync.py"
|
|
|
|
lines_dict = {}
|
|
|
|
with open(transcript_path, "r", encoding="utf-8") as f:
|
|
for line in f:
|
|
try:
|
|
step = json.loads(line)
|
|
if step.get("type") == "SYSTEM_RESPONSE":
|
|
content = step.get("content", "")
|
|
if "File Path: `file:///d:/PyCharm_projects/litellm-config/volc_limit_sync.py`" in content:
|
|
# Extract lines
|
|
for match in re.finditer(r"^(\d+):\s(.*)$", content, re.MULTILINE):
|
|
line_num = int(match.group(1))
|
|
line_text = match.group(2)
|
|
lines_dict[line_num] = line_text
|
|
except Exception as e:
|
|
pass
|
|
|
|
if lines_dict:
|
|
max_line = max(lines_dict.keys())
|
|
with open(file_path, "w", encoding="utf-8") as f:
|
|
for i in range(1, max_line + 1):
|
|
if i in lines_dict:
|
|
f.write(lines_dict[i] + "\n")
|
|
else:
|
|
f.write("\n")
|
|
print(f"Recovered {max_line} lines to {file_path}")
|
|
else:
|
|
print("Failed to find lines in transcript.")
|