"use client"; import { useState } from "react"; import { motion } from "motion/react"; import { Card, CardContent, CardHeader, CardTitle, } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Badge } from "@/components/ui/badge"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { Settings, User, Building2, Key, Bell, Palette, Save, CheckCircle, } from "lucide-react"; const settingsTabs = [ { key: "profile", label: "个人资料", icon: User }, { key: "company", label: "企业信息", icon: Building2 }, { key: "ai", label: "AI 配置", icon: Key }, { key: "notifications", label: "通知设置", icon: Bell }, { key: "appearance", label: "外观偏好", icon: Palette }, ]; export default function SettingsPage() { const [activeTab, setActiveTab] = useState("profile"); const [saving, setSaving] = useState(false); const [saved, setSaved] = useState(false); const [profile, setProfile] = useState({ name: "", email: "", phone: "", }); const [company, setCompany] = useState({ name: "", tax_id: "", contact: "", plan: "standard", }); const [aiConfig, setAiConfig] = useState({ provider: "zhipu", model: "glm-4", temperature: "0.3", max_tokens: "2000", }); const [notifications, setNotifications] = useState({ email_alert: true, exception_alert: true, weekly_report: false, cost_threshold: "10000", }); const [appearance, setAppearance] = useState({ theme: "system", density: "comfortable", language: "zh-CN", }); function handleSave() { setSaving(true); setTimeout(() => { setSaving(false); setSaved(true); setTimeout(() => setSaved(false), 2000); }, 800); } return (

系统设置

管理个人资料、企业信息和系统配置

{/* Settings Nav */} {/* Settings Content */}
{settingsTabs.find((t) => t.key === activeTab)?.label}
{activeTab === "profile" && (
setProfile({ ...profile, name: e.target.value })} placeholder="请输入姓名" />
setProfile({ ...profile, email: e.target.value })} placeholder="user@example.com" />
setProfile({ ...profile, phone: e.target.value })} placeholder="138****1234" />
)} {activeTab === "company" && (
setCompany({ ...company, name: e.target.value })} placeholder="请输入企业名称" />
setCompany({ ...company, tax_id: e.target.value })} placeholder="请输入统一社会信用代码" />
setCompany({ ...company, contact: e.target.value })} placeholder="请输入联系人姓名" />
)} {activeTab === "ai" && (
setAiConfig({ ...aiConfig, model: e.target.value })} placeholder="glm-4 / gpt-4-turbo-preview" />
setAiConfig({ ...aiConfig, temperature: e.target.value })} placeholder="0.3" />
setAiConfig({ ...aiConfig, max_tokens: e.target.value })} placeholder="2000" />

API Key 在 .env 文件中配置,不建议在此页面修改。

)} {activeTab === "notifications" && (

邮件通知

接收任务完成、异常提醒等邮件

异常提醒

检测到异常时发送通知

周报

每周一发送成本分析周报

setNotifications({ ...notifications, cost_threshold: e.target.value })} placeholder="10000" />

当月成本超过此值时发送预警

)} {activeTab === "appearance" && (
)}
); }