Files
GovAI/apps/web/src/app/(admin)/models/page.tsx
T
2026-06-15 23:48:37 +08:00

128 lines
5.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client";
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import { Bot, Cpu, MessageSquare, FileText, Sparkles } from "lucide-react";
const modelGroups = [
{
title: "对话模型",
description: "用于智能对话、公文写作、政策分析等核心功能",
icon: MessageSquare,
models: [
{ name: "qwen-plus", displayName: "通义千问-Plus", provider: "阿里云百炼", type: "对话", status: "active", desc: "主力模型,适用于复杂推理和长文本生成" },
{ name: "qwen-turbo", displayName: "通义千问-Turbo", provider: "阿里云百炼", type: "对话", status: "active", desc: "快速响应模型,适用于简单对话和问答" },
{ name: "qwen-max", displayName: "通义千问-Max", provider: "阿里云百炼", type: "对话", status: "standby", desc: "旗舰模型,适用于高精度分析场景" },
{ name: "qwen-long", displayName: "通义千问-Long", provider: "阿里云百炼", type: "对话", status: "standby", desc: "长上下文模型,支持百万Token输入" },
],
},
{
title: "向量模型",
description: "用于知识库文档检索和语义搜索",
icon: Cpu,
models: [
{ name: "text-embedding-v3", displayName: "通义文本向量V3", provider: "阿里云百炼", type: "嵌入", status: "active", desc: "1024维向量,高精度语义匹配" },
],
},
{
title: "文档理解",
description: "用于长文档分析、政策解读等场景",
icon: FileText,
models: [
{ name: "qwen-plus", displayName: "通义千问-Plus", provider: "阿里云百炼", type: "文档", status: "active", desc: "支持文档理解和内容提取" },
],
},
];
const statusConfig: Record<string, { label: string; variant: "default" | "secondary" | "outline" }> = {
active: { label: "运行中", variant: "default" },
standby: { label: "待启用", variant: "secondary" },
inactive: { label: "未配置", variant: "outline" },
};
export default function ModelsPage() {
return (
<div>
<div className="flex items-center justify-between mb-6">
<div>
<h1 className="text-2xl font-bold"></h1>
<p className="text-sm text-muted-foreground mt-1">使DashScope</p>
</div>
<div className="flex items-center gap-2">
<Sparkles className="h-4 w-4 text-orange-500" />
<Badge variant="secondary" className="gap-1"></Badge>
</div>
</div>
<div className="space-y-4">
{modelGroups.map((group) => (
<Card key={group.title}>
<CardHeader className="pb-3">
<div className="flex items-center gap-2">
<group.icon className="h-4 w-4 text-muted-foreground" />
<CardTitle className="text-base">{group.title}</CardTitle>
</div>
<CardDescription>{group.description}</CardDescription>
</CardHeader>
<CardContent>
<div className="border rounded-lg overflow-hidden">
<table className="w-full text-sm">
<thead className="bg-muted/50">
<tr>
<th className="text-left p-3"></th>
<th className="text-left p-3"></th>
<th className="text-left p-3"></th>
<th className="text-left p-3"></th>
<th className="text-left p-3"></th>
</tr>
</thead>
<tbody>
{group.models.map((model) => {
const st = statusConfig[model.status] || statusConfig.inactive;
return (
<tr key={model.name + model.type} className="border-t">
<td className="p-3">
<div className="font-medium">{model.displayName}</div>
<div className="text-xs text-muted-foreground font-mono">{model.name}</div>
</td>
<td className="p-3 text-muted-foreground">{model.provider}</td>
<td className="p-3">
<Badge variant="outline">{model.type}</Badge>
</td>
<td className="p-3 text-muted-foreground text-xs max-w-xs">{model.desc}</td>
<td className="p-3">
<Badge variant={st.variant}>{st.label}</Badge>
</td>
</tr>
);
})}
</tbody>
</table>
</div>
</CardContent>
</Card>
))}
</div>
<Card className="mt-4">
<CardContent className="pt-6">
<div className="grid sm:grid-cols-3 gap-4 text-sm">
<div className="p-3 rounded-lg bg-muted/40">
<div className="text-muted-foreground">API </div>
<div className="font-mono text-xs mt-1">dashscope.aliyuncs.com</div>
</div>
<div className="p-3 rounded-lg bg-muted/40">
<div className="text-muted-foreground"></div>
<div className="font-mono text-xs mt-1">OpenAI Compatible</div>
</div>
<div className="p-3 rounded-lg bg-muted/40">
<div className="text-muted-foreground"></div>
<div className="text-xs mt-1 text-green-600 font-medium"></div>
</div>
</div>
</CardContent>
</Card>
</div>
);
}