一个基于 FastAPI 的 AI 数字人聊天项目。
QingZi/
├── .env.example # 环境变量示例
├── .gitignore
├── README.md
├── requirements.txt # 项目依赖
├── run_server.py # 服务器启动入口
├── run_client.py # 客户端启动入口
│
└── src/ # 源代码目录
├── config/ # 配置模块
│ └── settings.py
├── server/ # 服务器模块
│ ├── app.py
│ └── routes/
│ └── chat.py
├── services/ # 业务逻辑层
│ └── ai_service.py
└── client/ # 客户端模块
└── cli.py
pip install -r requirements.txt复制 .env.example 为 .env 并填写配置:
cp .env.example .env编辑 .env 文件:
API_KEY=your_api_key_here
BASE_URL=https://api.openai.com/v1
MODEL=gpt-3.5-turbo
SERVER_HOST=127.0.0.1
SERVER_PORT=8000
python run_server.pypython run_client.pyGET /
POST /chat
Content-Type: application/json
{
"user_input": "你好"
}
MIT