docs: 更新网络接口文档

This commit is contained in:
2026-04-06 13:39:51 +08:00
parent 64b78ecce3
commit 408f0cb513
3 changed files with 169 additions and 1 deletions
+32
View File
@@ -85,6 +85,38 @@ python scripts/tools/train.py \
python scripts/tools/generate.py --param_path=/path/to/param_path
```
#### 启动 HTTP 服务
启动推理服务器,支持 OpenAI 兼容的 HTTP API
```bash
python -m scripts.tools.server --port 8000 --device cuda
```
发起请求:
```bash
# Chat APIOpenAI 兼容)
curl -X POST http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": "你好"}],
"max_tokens": 512
}'
# 流式响应
curl -X POST http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": "讲个故事"}],
"stream": true,
"max_tokens": 500
}'
# 健康检查
curl http://localhost:8000/health
```
#### 演示
查看 `scripts/demo/` 文件夹中的演示: