feat(saas): 接通 embedding 模型管理全栈
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

数据库 migration 已有 is_embedding/model_type 列但全栈未使用。
打通 4 层: ModelRow → ModelInfo/CRUD → CachedModel → Admin 前端。
relay/models 端点也返回 is_embedding 字段,前端可按类型过滤。
This commit is contained in:
iven
2026-04-12 08:10:50 +08:00
parent b0a304ca82
commit 5599cefc41
7 changed files with 45 additions and 18 deletions

View File

@@ -67,6 +67,7 @@ function ProviderModelsTable({ providerId }: { providerId: string }) {
const columns: ProColumns<Model>[] = [
{ title: '模型 ID', dataIndex: 'model_id', width: 180, render: (_, r) => <Text code>{r.model_id}</Text> },
{ title: '别名', dataIndex: 'alias', width: 120 },
{ title: '类型', dataIndex: 'is_embedding', width: 80, render: (_, r) => r.is_embedding ? <Tag color="purple">Embedding</Tag> : <Tag>Chat</Tag> },
{ title: '上下文窗口', dataIndex: 'context_window', width: 100, render: (_, r) => r.context_window?.toLocaleString() },
{ title: '最大输出', dataIndex: 'max_output_tokens', width: 90, render: (_, r) => r.max_output_tokens?.toLocaleString() },
{ title: '流式', dataIndex: 'supports_streaming', width: 60, render: (_, r) => r.supports_streaming ? <Tag color="green"></Tag> : <Tag></Tag> },
@@ -128,6 +129,9 @@ function ProviderModelsTable({ providerId }: { providerId: string }) {
<Form.Item name="enabled" label="启用" valuePropName="checked" style={{ flex: 1 }}>
<Switch />
</Form.Item>
<Form.Item name="is_embedding" label="Embedding 模型" valuePropName="checked" style={{ flex: 1 }}>
<Switch />
</Form.Item>
<Form.Item name="supports_streaming" label="支持流式" valuePropName="checked" style={{ flex: 1 }}>
<Switch defaultChecked />
</Form.Item>

View File

@@ -70,6 +70,8 @@ export interface Model {
supports_streaming: boolean
supports_vision: boolean
enabled: boolean
is_embedding: boolean
model_type: string
pricing_input: number
pricing_output: number
}