# 进入后端目录
cd server
# 安装依赖(首次运行)
npm install
# 复制环境配置
cp .env.example .env
# 启动开发服务器
npm run dev
看到以下输出表示成功:
✅ MongoDB 连接成功
🚀 服务启动成功:http://localhost:3000
# 进入前端目录
cd client
# 安装依赖(首次运行)
npm install
# 启动 H5 开发服务器
npm run dev:h5
看到以下输出表示成功:
VITE v5.x.x ready in xxx ms
➜ Local: http://localhost:8080/
➜ Network: use --host to expose
打开浏览器访问:http://localhost:8080
登录
123456(开发环境免密)生成音频
播放音频
查看历史
# 检查 MongoDB 是否运行
# Windows: 服务管理器查看 MongoDB 服务
# Mac: brew services list
# Linux: systemctl status mongod
确保后端在 http://localhost:3000 运行,前端代理会自动转发请求。
编辑 server/.env:
DASHSCOPE_API_KEY=your-api-key
编辑 server/.env:
IFLYTEK_APP_ID=your-app-id
IFLYTEK_API_KEY=your-api-key
IFLYTEK_API_SECRET=your-api-secret
cd client
npm run dev:h5
# 访问 http://localhost:8080
cd client
npm run dev:mp-weixin
# 用微信开发者工具打开 dist/dev/mp-weixin
现在你已经成功启动了 AI 有声书应用,开始享受文字转声音的魔法吧!✨