feat: 新增火山引擎 chat 接口demo

This commit is contained in:
2026-04-15 17:38:01 +08:00
parent 2c1cd85e77
commit 8631a4c9a5
4 changed files with 212 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ cp .env.example .env
`.env` 中填入你的 `QWEN_API_KEY`DashScope API Key
如需调用 DeepSeek再填入 `DEEPSEEK_API_KEY`
如需调用火山引擎,再填入 `VOLCENGINE_API_KEY``VOLCENGINE_MODEL`(方舟 Endpoint ID
## 3. 启动服务
@@ -134,6 +135,44 @@ curl -N -X POST http://localhost:3000/api/deepseek/chat/stream \
└── platforms
├── deepseek
│ └── router.js
── qwen
── qwen
│ └── router.js
└── volcengine
└── router.js
```
## 8. 调用火山引擎 Chat 接口 demo
### 火山普通接口地址
`POST /api/volcengine/chat`
### 火山普通请求示例
```bash
curl -X POST http://localhost:3000/api/volcengine/chat \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role":"system","content":"你是一个简洁的助手"},
{"role":"user","content":"你好,请介绍一下你自己"}
]
}'
```
### 火山流式接口地址
`POST /api/volcengine/chat/stream`
### 火山流式请求示例
```bash
curl -N -X POST http://localhost:3000/api/volcengine/chat/stream \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role":"system","content":"你是一个简洁的助手"},
{"role":"user","content":"请用三句话介绍流式输出"}
]
}'
```