mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-20 22:22:57 +03:00
Add model-pattern → combo mapping feature that automatically routes requests to specific combos based on model name patterns (glob matching). Implementation: - New migration 010: model_combo_mappings table with pattern, combo_id, priority - DB module with CRUD + resolveComboForModel() using glob-to-regex matching - getComboForModel() in model.ts: augments getCombo() with pattern fallback - chat.ts: replaced getCombo() → getComboForModel() at routing decision point - API endpoints: GET/POST /api/model-combo-mappings, GET/PUT/DELETE by [id] - ModelRoutingSection.tsx: dashboard UI with inline add/edit/toggle/delete - Integrated into Combos page - 15 new unit tests (glob matching, priority ordering, disabled filtering) - Full test suite: 923/923 pass Examples: claude-sonnet* → code-combo claude-*-opus* → frontier-combo gpt-4o* → openai-combo gemini-* → google-combo Resolves: #563
20 lines
929 B
SQL
20 lines
929 B
SQL
-- Migration 010: Model-to-Combo mappings
|
|
-- Allows users to map model name patterns (globs) to specific combos.
|
|
-- When a request comes in for a model matching a pattern, the mapped combo
|
|
-- is used automatically instead of the global default.
|
|
|
|
CREATE TABLE IF NOT EXISTS model_combo_mappings (
|
|
id TEXT PRIMARY KEY,
|
|
pattern TEXT NOT NULL, -- glob pattern, e.g. 'claude-*-opus*'
|
|
combo_id TEXT NOT NULL, -- references combos.id
|
|
priority INTEGER DEFAULT 0, -- higher = checked first
|
|
enabled INTEGER DEFAULT 1, -- 0 = disabled, 1 = enabled
|
|
description TEXT DEFAULT '', -- optional human-readable label
|
|
created_at TEXT NOT NULL,
|
|
updated_at TEXT NOT NULL,
|
|
FOREIGN KEY (combo_id) REFERENCES combos(id) ON DELETE CASCADE
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_mcm_enabled ON model_combo_mappings(enabled);
|
|
CREATE INDEX IF NOT EXISTS idx_mcm_priority ON model_combo_mappings(priority DESC);
|