- Skip websearch provider when ProxyID is set but proxy not found (prevent silent direct connection bypass) - Fix sortByStableRandomWeight: pair factors with items so sort.Slice swap keeps weights aligned - Allow empty platform in account_stats_pricing_rules (wildcard matching), only force anthropic default for main model_pricing - Add channel_account_stats_pricing_intervals table and repo layer support for interval-based pricing in account stats rules - calculateTokenStatsCost now uses interval pricing when available - Replace smtp.SendMail/tls.Dial with net.Dialer timeout (10s dial, 20s IO) to prevent goroutine leak on SMTP hang - Fix gofmt formatting issues - Web Search label: black text with red warning hint
20 lines
953 B
SQL
20 lines
953 B
SQL
-- Add intervals table for account stats pricing rules (mirrors channel_pricing_intervals).
|
|
CREATE TABLE IF NOT EXISTS channel_account_stats_pricing_intervals (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
pricing_id BIGINT NOT NULL REFERENCES channel_account_stats_model_pricing(id) ON DELETE CASCADE,
|
|
min_tokens INT NOT NULL DEFAULT 0,
|
|
max_tokens INT,
|
|
tier_label VARCHAR(50),
|
|
input_price NUMERIC(20,12),
|
|
output_price NUMERIC(20,12),
|
|
cache_write_price NUMERIC(20,12),
|
|
cache_read_price NUMERIC(20,12),
|
|
per_request_price NUMERIC(20,12),
|
|
sort_order INT NOT NULL DEFAULT 0,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_account_stats_pricing_intervals_pricing_id
|
|
ON channel_account_stats_pricing_intervals (pricing_id);
|