Skip to content

Commit 7e0b538

Browse files
authored
Merge pull request #139 from ThreeFish-AI/vk/71d6-
如图,启动时的日志中: (vibe-kanban)
2 parents 25bef20 + 78ea416 commit 7e0b538

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

‎src/coding/proxy/routing/quota_guard.py‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,22 @@ def notify_cap_error(self, retry_after_seconds: float | None = None) -> None:
129129
int(self._effective_probe_interval),
130130
)
131131

132-
def load_baseline(self, total_tokens: int) -> None:
132+
def load_baseline(self, total_tokens: int, vendor: str | None = None) -> None:
133133
"""从数据库加载窗口历史用量基线."""
134134
if not self._enabled or total_tokens <= 0:
135135
return
136136
with self._lock:
137137
midpoint = time.monotonic() - self._window / 2
138138
self._entries.append((midpoint, total_tokens))
139139
self._total += total_tokens
140-
logger.info("Quota guard: loaded baseline %d tokens", total_tokens)
140+
if vendor:
141+
logger.info(
142+
"Quota guard [%s]: loaded baseline %d tokens",
143+
vendor,
144+
total_tokens,
145+
)
146+
else:
147+
logger.info("Quota guard: loaded baseline %d tokens", total_tokens)
141148

142149
def reset(self) -> None:
143150
"""手动重置为 WITHIN_QUOTA 状态."""

‎src/coding/proxy/server/app.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,14 @@ async def lifespan(app: FastAPI):
6060
tier.quota_guard.window_hours,
6161
vendor=tier.name,
6262
)
63-
tier.quota_guard.load_baseline(total)
63+
tier.quota_guard.load_baseline(total, vendor=tier.name)
6464
if tier.weekly_quota_guard and tier.weekly_quota_guard.enabled:
6565
total = await token_logger.query_window_total(
6666
tier.weekly_quota_guard.window_hours,
6767
vendor=tier.name,
6868
)
69-
tier.weekly_quota_guard.load_baseline(total)
69+
tier.weekly_quota_guard.load_baseline(total, vendor=tier.name)
7070

71-
logger.info(
72-
"coding-proxy started: host=%s port=%d", config.server.host, config.server.port
73-
)
7471
yield
7572
await router.close()
7673
await compat_session_store.close()

0 commit comments

Comments
 (0)