Files

23 lines
1.5 KiB
SQL

-- Netlify AI Gateway channel (shim on 127.0.0.1:8833)
DELETE FROM abilities WHERE channel_id IN (SELECT id FROM channels WHERE name = 'nfgw-pool');
DELETE FROM channels WHERE name = 'nfgw-pool';
INSERT INTO channels (type, key, status, name, base_url, models, "group", priority, weight, auto_ban, tag,
setting, other_info, created_time, test_time)
VALUES (1, 'nfgw-local-shim', 1, 'nfgw-pool', 'http://127.0.0.1:8833',
'claude-opus-5-5,claude-sonnet-5-5,claude-haiku-5-5,claude-fable-5-2,gpt-6.1-sol,gpt-6-astra,gpt-6-luna,gpt-5.5,gpt-5.4-mini,gemini-4-argon,gemini-3.8-flash,x-ai/grok-4.7,moonshotai/kimi-k3,deepseek/deepseek-v4.1-flash-1017,z-ai/glm-5.3',
'default,premium,t1,t2,t3,t4', 700, 0, 0, 'nfgw',
'{"force_format":false,"thinking_to_content":false,"proxy":"","pass_through_body_enabled":false,"system_prompt":""}',
'{}', 1794423600, 0);
INSERT INTO abilities ("group", model, channel_id, enabled, priority, weight, tag)
SELECT g.grp, trim(m.model), c.id, true, c.priority, 0, c.tag
FROM channels c
CROSS JOIN LATERAL unnest(string_to_array(c."group", ',')) g(grp)
CROSS JOIN LATERAL unnest(string_to_array(c.models, ',')) m(model)
WHERE c.name = 'nfgw-pool' AND trim(m.model) <> ''
ON CONFLICT ("group", model, channel_id) DO UPDATE SET enabled = true;
SELECT id, name, base_url, priority, status, length(models) AS models_len FROM channels WHERE name = 'nfgw-pool';
SELECT count(*) AS abilities FROM abilities WHERE channel_id = (SELECT id FROM channels WHERE name='nfgw-pool');