-
-
响应结果
-
-
- {statusCode === 200 ? '成功' : '失败'}
-
- {responseTime}ms
-
+
+
+
-
-
-
- {JSON.stringify(response, null, 2)}
-
-
-
+
+
+
+
+
+
+ {/* Response Panel */}
+
+
+
+
+ {statusCode && (
+
+
+ {statusCode === 200 ? (
+ <>{statusCode}>
+ ) : (
+ <>{statusCode}>
+ )}
+
+
+
+ {responseTime}ms
+
+
+
+ )}
- )}
-
-
+
+ {response ? (
+
+ {JSON.stringify(response, null, 2)}
+
+ ) : (
+
+ )}
+
+
+
)
}
diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx
index a424349..a1b97c4 100644
--- a/frontend/src/pages/Dashboard.tsx
+++ b/frontend/src/pages/Dashboard.tsx
@@ -1,6 +1,5 @@
-import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
-import { Globe, Gauge, BarChart3, Shield, Zap, ArrowRight } from 'lucide-react'
-import { PageContainer } from '@/components/ui/page-container'
+import { Card, CardContent } from '@/components/ui/card'
+import { Globe, Gauge, BarChart3, Shield, Zap, ArrowRight, Sparkles } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { useAuthStore } from '@/store/auth'
import { Link } from 'react-router-dom'
@@ -9,100 +8,122 @@ const features = [
{
icon: Globe,
title: '多提供商支持',
- description: '支持 OpenAI、Azure OpenAI 和 Claude API,轻松切换不同的 AI 服务。',
- color: 'from-blue-500 to-blue-600',
+ description: '支持 OpenAI、Azure OpenAI、Claude 等多种 AI 服务提供商。',
+ gradient: 'from-blue-500/10 to-cyan-500/10',
+ iconBg: 'from-blue-500 to-cyan-500',
+ delay: '0ms',
},
{
icon: Gauge,
title: '负载均衡',
- description: '自动在多个频道间分配请求,确保服务稳定性和高可用性。',
- color: 'from-emerald-500 to-emerald-600',
+ description: '自动在多个频道间分配请求,确保高可用性。',
+ gradient: 'from-emerald-500/10 to-teal-500/10',
+ iconBg: 'from-emerald-500 to-teal-500',
+ delay: '50ms',
},
{
icon: BarChart3,
title: '用量追踪',
- description: '实时监控 token 使用情况,精确计算成本,防止超出配额。',
- color: 'from-amber-500 to-amber-600',
+ description: '实时监控 token 使用情况,精确成本核算。',
+ gradient: 'from-amber-500/10 to-orange-500/10',
+ iconBg: 'from-amber-500 to-orange-500',
+ delay: '100ms',
},
{
icon: Shield,
title: '安全管理',
- description: '基于令牌的访问控制,为不同用户分配独立的 API 密钥。',
- color: 'from-purple-500 to-purple-600',
+ description: '基于令牌的访问控制与独立 API 密钥分配。',
+ gradient: 'from-violet-500/10 to-purple-500/10',
+ iconBg: 'from-violet-500 to-purple-500',
+ delay: '150ms',
},
]
const steps = [
- { num: '01', title: '管理员登录', desc: '使用管理员令牌登录系统' },
- { num: '02', title: '配置频道', desc: '添加 OpenAI、Azure 或 Claude API 频道' },
- { num: '03', title: '创建令牌', desc: '为您的应用创建 API 令牌' },
- { num: '04', title: '开始使用', desc: '使用生成的令牌调用 API' },
+ { num: '01', title: '管理员登录', desc: '使用管理员令牌登录系统', color: 'text-blue-500' },
+ { num: '02', title: '配置频道', desc: '添加 AI 服务提供商频道', color: 'text-emerald-500' },
+ { num: '03', title: '创建令牌', desc: '为应用创建 API 令牌', color: 'text-amber-500' },
+ { num: '04', title: '开始使用', desc: '使用令牌调用 API', color: 'text-violet-500' },
]
export function Dashboard() {
const { isAuthenticated, openAuthModal } = useAuthStore()
return (
-
-
- {/* Hero Section */}
-
-
-
-
-
- 统一 AI 接口网关
+
+ {/* Hero Section */}
+
+
+
+
+
+
+ Unified AI Gateway
-
- 欢迎使用 Awsl One API
+
+
+ Awsl One API
+
-
- 一个强大的 API 代理和管理平台,为您提供统一的 AI 模型接口管理服务。
- 支持多种 AI 服务提供商,实现智能负载均衡和精确用量追踪。
+
+ 统一的 AI 模型接口网关。支持多服务商接入、智能负载均衡与精确用量追踪。
{isAuthenticated ? (
<>
-
-
-
+
+
+ {/* Decorative elements */}
+
+
+
+
+
{/* Features Grid */}
-
核心特性
-
+
+
{features.map((feature) => (
-
-
-
-
+
+
+
+
+
+
+
+
{feature.title}
+
+ {feature.description}
+
- {feature.title}
-
- {feature.description}
-
))}
@@ -110,25 +131,24 @@ export function Dashboard() {
{/* Quick Start */}
-
-
- 快速开始
- 按照以下步骤开始使用
-
-
-
- {steps.map((step, index) => (
-
- {index < steps.length - 1 && (
-
- )}
+
+
+
+
快速开始
+
四步完成配置,开始使用统一接口
+
+
+ {steps.map((step) => (
+
-
-
{step.num}
+
+
+ {step.num}
+
-
{step.title}
-
{step.desc}
+
{step.title}
+
{step.desc}
@@ -136,6 +156,19 @@ export function Dashboard() {
+
+ {/* Supported Providers */}
+
+
支持的服务提供商
+
+ {['OpenAI', 'Azure OpenAI', 'Claude', 'OpenAI Responses'].map((name) => (
+
+
+ {name}
+
+ ))}
+
+
)
diff --git a/frontend/src/pages/Database.tsx b/frontend/src/pages/Database.tsx
index 30de3b6..08e1898 100644
--- a/frontend/src/pages/Database.tsx
+++ b/frontend/src/pages/Database.tsx
@@ -1,10 +1,11 @@
import { useState } from 'react'
import { useMutation } from '@tanstack/react-query'
import { apiClient } from '@/api/client'
-import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
+import { Card, CardContent } from '@/components/ui/card'
import { Button } from '@/components/ui/button'
import { useToast } from '@/components/ui/use-toast'
-import { Database as DatabaseIcon, Info } from 'lucide-react'
+import { Database as DatabaseIcon, Info, CheckCircle, AlertTriangle, RefreshCw } from 'lucide-react'
+import { PageContainer } from '@/components/ui/page-container'
export function Database() {
const [result, setResult] = useState
(null)
@@ -31,40 +32,74 @@ export function Database() {
}
return (
-
-
-
数据库管理
-
-
-
-
-
- 数据库初始化
-
-
- {initMutation.isPending ? '初始化中...' : '初始化数据库'}
-
-
-
-
-
-
- 初始化数据库将创建必要的表结构。如果表已存在,操作将被忽略。
-
-
- {result && (
-
-
-
-
- {JSON.stringify(result, null, 2)}
-
-
-
+
+
+ {/* Init Card */}
+
+
+
+
+
+
+
+
+
数据库初始化
+
+ 创建必要的表结构。如果表已存在,操作将被忽略。
+
+
+
+
+ {initMutation.isPending ? (
+ <>
+
+ 初始化中...
+ >
+ ) : (
+ <>
+
+ 初始化数据库
+ >
+ )}
+
- )}
-
-
-
+
+
+
+ {/* Info */}
+
+
+ 数据库使用 Cloudflare D1,初始化操作幂等安全,可重复执行。
+
+
+ {/* Result */}
+ {result && (
+
+
+
+ {result.error ? (
+
+ ) : (
+
+ )}
+
+ {result.error ? '执行出错' : '执行结果'}
+
+
+
+ {JSON.stringify(result, null, 2)}
+
+
+
+ )}
+
+
)
}
diff --git a/frontend/src/pages/NotFound.tsx b/frontend/src/pages/NotFound.tsx
new file mode 100644
index 0000000..6cd55ea
--- /dev/null
+++ b/frontend/src/pages/NotFound.tsx
@@ -0,0 +1,26 @@
+import { Button } from '@/components/ui/button'
+import { Link } from 'react-router-dom'
+import { ArrowLeft, Zap } from 'lucide-react'
+
+export function NotFound() {
+ return (
+
+
+
404
+
+ 页面不存在
+
+
+
+
+ 返回首页
+
+
+
+ )
+}