v4.3.19-6: Google 일일 사용량 표시 + 한도 도달시 자동 폴백
- google-usage.ts: Gemini 무료티어 RPD(하루 500회 추정치) 대비 요청 카운트를 날짜별로 추적(.smallclaw/google-usage.json, 자정 자동 리셋) - openai-compat-adapter.ts: google provider일 때 post() 호출마다 카운트 - factory.ts: getProvider()/getModelForRole() 둘 다 getEffectiveProviderConfig() 경유하도록 통일 — 카운트가 480(여유분 20 적용) 넘으면 자동으로 ollama+deepseek-v4-flash:cloud로 전환(429 맞고 반응하는 게 아니라 사전 차단). provider/model 선택이 별도 함수라 따로 고치면 불일치 날 수 있어서 공유 헬퍼로 묶음 - 메인 채팅 사이드바 모델 pill에 "N/500" 뱃지 추가(Google일 때만 표시, 70%↑ 노랑/90%↑ 빨강), 기존 10초 폴링(checkStatus)에 얹어서 실시간 반영 - 실사용 확인: 배포 직후 실제 채팅으로 카운트 0→1 증가 확인, 480 시뮬레이션 으로 폴백 전환/복귀 양쪽 다 확인 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2985,6 +2985,7 @@ app.get('/api/status', async (_req, res) => {
|
||||
currentModel: activeModel,
|
||||
workspace: (config as any).workspace?.path || '',
|
||||
search: rawCfg.search?.google_api_key ? 'google' : (rawCfg.search?.tavily_api_key ? 'tavily' : (rawCfg.search?.searxng_url ? 'searxng' : 'none')),
|
||||
googleUsage: provider === 'google' ? getGoogleUsageToday() : null,
|
||||
orchestration: orchCfg ? {
|
||||
enabled: orchCfg.enabled,
|
||||
secondary: orchCfg.secondary,
|
||||
@@ -3869,6 +3870,7 @@ app.post('/api/open-path', requireGatewayAuth, async (req, res) => {
|
||||
// trigger the OpenAI OAuth flow.
|
||||
|
||||
import { getProvider, resetProvider, buildProviderForLLM, getModelForRole } from '../providers/factory';
|
||||
import { getGoogleUsageToday } from '../providers/google-usage';
|
||||
import { buildWebhookRouter, resolveHookConfig } from './channels/webhook-handler';
|
||||
import { getMCPManager } from './infra/mcp-manager';
|
||||
import { startOAuthFlow, isConnected, clearTokens, loadTokens, exchangeManualCodeFromPending } from '../auth/openai-oauth';
|
||||
|
||||
Reference in New Issue
Block a user