feat: add provider and model routing tables, admin UI, and audit category for gateway
Implement the multi-provider routing system for the OpenAI gateway, including two new database tables (`gateway_providers`, `gateway_models`) ensured at init, a new admin page at `/admin/gateway` with full CRUD for providers and model routes, and a `"gateway"` audit category mapped to `"ai"`. The routing layer sits transparently on top of the existing single-provider default path: unmatched model names fall through unchanged, while matched routes forward to the configured provider with their own pricing economy, vision model, and context window. Cross-worker cache invalidation uses a shared `_ROUTING_CACHE` bumped via `"gateway_routing"` cache version.
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
/* retoor <retoor@molodetz.nl> */
|
||||
|
||||
.gw-intro {
|
||||
color: var(--text-muted);
|
||||
font-size: 0.875rem;
|
||||
margin-bottom: var(--space-lg);
|
||||
max-width: 760px;
|
||||
}
|
||||
|
||||
.gw-section {
|
||||
margin-bottom: var(--space-2xl);
|
||||
}
|
||||
|
||||
.gw-section-head {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: var(--space-sm);
|
||||
margin-bottom: var(--space-xs);
|
||||
}
|
||||
|
||||
.gw-section-head h3 {
|
||||
font-size: 1.0625rem;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.gw-section-hint {
|
||||
color: var(--text-muted);
|
||||
font-size: 0.8125rem;
|
||||
margin-bottom: var(--space-md);
|
||||
max-width: 760px;
|
||||
}
|
||||
|
||||
.gw-default {
|
||||
padding: 0.75rem 1rem;
|
||||
background: var(--bg-card-hover);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
font-size: 0.8125rem;
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: var(--space-md);
|
||||
}
|
||||
|
||||
.gw-default code,
|
||||
.admin-table .gw-code {
|
||||
font-family: var(--font-mono, monospace);
|
||||
font-size: 0.8125rem;
|
||||
color: var(--text-primary);
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.gw-default a {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.gw-muted {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.gw-actions {
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.gw-form {
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 1.25rem;
|
||||
margin-top: var(--space-md);
|
||||
max-width: 960px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
|
||||
gap: var(--space-md);
|
||||
}
|
||||
|
||||
.gw-form-title {
|
||||
grid-column: 1 / -1;
|
||||
margin: 0;
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.gw-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.3rem;
|
||||
}
|
||||
|
||||
.gw-field.gw-wide {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.gw-field label {
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.gw-field input,
|
||||
.gw-field select {
|
||||
width: 100%;
|
||||
padding: 0.5rem 0.65rem;
|
||||
background: var(--bg-input, var(--bg-card));
|
||||
color: var(--text-primary);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-input, var(--radius));
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.gw-field input:focus,
|
||||
.gw-field select:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.gw-form-actions {
|
||||
grid-column: 1 / -1;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.gw-form {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.gw-actions {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user