feat: 实现 Mini Game AI 工具平台

基于 Next.js 15、React 19 和 TypeScript 构建面向小游戏开发者的 AI 赋能工具平台。

主要功能:
- 首页:包含 Hero、功能展示、优势介绍、定价和 CTA 区域
- 三大核心工具:视频转序列帧、图片压缩、音频压缩
- 响应式布局:包含顶部导航、页脚和侧边栏
- 文件上传:支持拖拽上传,使用 react-dropzone
- 进度追踪:实时显示上传和处理进度
- 可配置工具:每个工具都支持自定义参数配置
- 结果预览:支持下载处理后的文件
- 4K 优化:针对大屏幕优化的响应式设计
- API 路由:文件上传和处理的模拟实现

技术栈:
- Next.js 15 (App Router)
- React 19
- TypeScript (严格模式)
- Tailwind CSS(自定义 4K 断点)
- shadcn/ui 组件库
- Framer Motion 动画
- Zustand 状态管理

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-20 22:26:55 +08:00
parent 9529a684a1
commit a7449bf49b
40 changed files with 10963 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
import { NextRequest, NextResponse } from "next/server";
import type { ImageCompressConfig } from "@/types";
export const runtime = "nodejs";
interface ProcessRequest {
fileId: string;
config: ImageCompressConfig;
}
export async function POST(request: NextRequest) {
try {
const body: ProcessRequest = await request.json();
const { fileId, config } = body;
if (!fileId) {
return NextResponse.json(
{ success: false, error: "No file ID provided" },
{ status: 400 }
);
}
// Validate config
if (!config.quality || config.quality < 1 || config.quality > 100) {
return NextResponse.json(
{ success: false, error: "Invalid quality value" },
{ status: 400 }
);
}
// In production, you would:
// 1. Retrieve the file from storage
// 2. Use Sharp to compress the image
// 3. Apply format conversion if needed
// 4. Upload to R2/S3
// 5. Return download URL
// Mock processing for now
const resultFileId = `processed-${Date.now()}`;
return NextResponse.json({
success: true,
fileUrl: `/api/download/${resultFileId}`,
filename: `compressed-${resultFileId}`,
metadata: {
format: config.format,
quality: config.quality,
compressionRatio: Math.floor(Math.random() * 30) + 40, // Mock 40-70%
},
});
} catch (error) {
console.error("Processing error:", error);
return NextResponse.json(
{ success: false, error: "Processing failed" },
{ status: 500 }
);
}
}