feat: add model catalog filters and channel configuration

This commit is contained in:
wlx committed 2026-08-31 13:41:40 +08:00
1 parent 547f7c0977
commit 2897354dd8
7 files changed
+173 -15

No files matched your search

+12 -2
View File
@@ -6,12 +6,19 @@ export interface CatalogProvider {
code: string
name: string
protocol: 'openai-compatible' | 'http' | 'sdk'
sourceType: 'official' | 'relay' | 'self-hosted' | 'custom'
baseUrl?: string
description?: string
credentialType?: 'none' | 'api-key' | 'bearer' | 'access-token'
credentialMasked?: string
status: 'active' | 'disabled'
}
export interface CatalogModel {
id: string
providerId: string
modelKey?: string
sourceLabel?: string
publicName: string
upstreamModel: string
type: CatalogModelType
@@ -20,6 +27,9 @@ export interface CatalogModel {
inputTypes: string[]
outputTypes: string[]
capabilities: Record<string, unknown>
pricing?: { input?: number; output?: number; unit?: string }
priority?: number
maxConcurrency?: number
status: 'active' | 'disabled'
}
@@ -214,11 +224,11 @@ class HttpCatalogClient {
return this.request<{ providers: CatalogProvider[] }>('/api/admin/providers')
}
async createAdminProvider(input: { code: string; name: string; protocol: CatalogProvider['protocol']; description?: string }) {
async createAdminProvider(input: { code: string; name: string; protocol: CatalogProvider['protocol']; sourceType?: CatalogProvider['sourceType']; baseUrl?: string; description?: string; credentialType?: CatalogProvider['credentialType']; credentialSecret?: string }) {
return this.request<{ provider: CatalogProvider }>('/api/admin/providers', { method: 'POST', body: JSON.stringify(input) })
}
async createAdminModel(input: { providerId: string; publicName: string; upstreamModel: string; type: CatalogModelType; mode: CatalogCallMode; description?: string }) {
async createAdminModel(input: { providerId: string; publicName: string; upstreamModel: string; modelKey?: string; sourceLabel?: string; type: CatalogModelType; mode: CatalogCallMode; description?: string; inputTypes?: string[]; outputTypes?: string[]; pricing?: { input?: number; output?: number; unit?: string }; priority?: number; maxConcurrency?: number }) {
return this.request<{ model: CatalogModel }>('/api/admin/models', { method: 'POST', body: JSON.stringify(input) })
}