跳到主要内容

Vercel 部署

本文档介绍如何将 OpenHuman 部署到 Vercel。

前置要求​

  • Vercel 账号
  • GitHub 仓库

部署步骤​

1. 导入项目​

  1. 登录 Vercel
  2. 点击 Add New → Project
  3. 选择要部署的仓库

2. 配置构建​

设置值
Framework PresetNext.js
Build Commandnpm run build
Output Directoryout

3. 环境变量​

添加以下环境变量:

OPENHUMAN_API_KEY=sk_xxx
NEXT_PUBLIC_API_URL=https://api.tinyhumans.ai

4. 部署​

点击 Deploy 开始部署。

vercel.json 配置​

{
"buildCommand": "npm run build",
"outputDirectory": "out",
"framework": "nextjs",
"rewrites": [
{
"source": "/api/:path*",
"destination": "https://api.tinyhumans.ai/:path*"
}
]
}

持续部署​

推送到 main 分支自动触发部署。

自定义域名​

  1. 进入项目 Settings → Domains
  2. 添加您的域名
  3. 配置 DNS 记录

常见问题​

构建失败​

检查 package.json 中的构建脚本是否正确。

API 代理问题​

确保 vercel.json 中的 rewrites 配置正确。

下一步​