mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-15 00:17:27 +00:00
Part A — Channel quota limiter (managed mode): - DB-backed per-user/group request quotas with in-memory 60s TTL cache - Config merge priority: Groups > Channels > Providers > Default - Per-group quota override via channels.telegram.groups[chatID].quota - Migration 000009: index on channel_requests for quota queries - Hot-reload quota config via pub/sub (TopicConfigChanged) Part B — Per-run tool call budget: - Soft stop at configurable limit (default 25, per-agent override) - MaxToolCalls field on AgentDefaults + AgentSpec + LoopConfig - LLM gets one final call to summarize when budget exceeded Part C — Web UI + config page refactor: - QuotaSection with provider/channel dropdowns (useProviders, useChannelInstances) - Config page refactored to vertical sidebar tabs layout - Categories: General, Quota, Agents, Tools, Connections, Advanced, Raw Editor - Fixed config.patch RPC to serialize raw JSON + baseHash correctly - Config change pub/sub broadcast from handleApply/handlePatch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6 lines
328 B
SQL
6 lines
328 B
SQL
-- Partial index for quota checker: efficiently counts top-level traces per user in time windows.
|
|
-- Eliminates parent_trace_id IS NULL post-filter (89% of traces are top-level).
|
|
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_traces_quota
|
|
ON traces (user_id, created_at DESC)
|
|
WHERE parent_trace_id IS NULL AND user_id IS NOT NULL;
|