Jack 1 month ago
parent 23585e1a10
commit 9bf2a97d00
  1. 16
      SKILL.md

@ -36,21 +36,21 @@ description: Generate images via AI text-to-image API (GPT Image / Grok). Use wh
先启动 FastAPI 服务:
```bash
uvicorn agent-image-t2i:app --host 0.0.0.0 --port 8000
uvicorn agent-image-t2i:app --host 0.0.0.0 --port 8765
```
默认服务地址为 `http://localhost:8000`
默认服务地址为 `http://localhost:8765`
健康检查:
```bash
curl http://localhost:8000/health
curl http://localhost:8765/health
```
使用 Grok 绘图:
```bash
curl -X POST http://localhost:8000/images/generations \
curl -X POST http://localhost:8765/images/generations \
-H "Content-Type: application/json" \
-d '{
"prompt": "a cute cat",
@ -63,7 +63,7 @@ curl -X POST http://localhost:8000/images/generations \
使用 GPT 绘图:
```bash
curl -X POST http://localhost:8000/images/generations \
curl -X POST http://localhost:8765/images/generations \
-H "Content-Type: application/json" \
-d '{
"prompt": "a cute cat",
@ -74,7 +74,7 @@ curl -X POST http://localhost:8000/images/generations \
}'
```
生成结果中的 `url` 为图片访问地址,例如 `http://localhost:8000/output/{filename}`
生成结果中的 `url` 为图片访问地址,例如 `http://localhost:8765/output/{filename}`
## 调用建议
@ -99,7 +99,7 @@ curl -X POST http://localhost:8000/images/generations \
- 图片默认保存在服务端 `output/` 目录
- 响应返回 `filename`、`url` 和文件大小 `bytes`
- 图片通过 `GET /output/{filename}` 访问
- 服务启动后,响应中的相对路径 `url` 需要拼接服务地址,例如 `http://localhost:8000/output/{filename}`
- 服务启动后,响应中的相对路径 `url` 需要拼接服务地址,例如 `http://localhost:8765/output/{filename}`
## Prompt 技巧
@ -112,4 +112,4 @@ curl -X POST http://localhost:8000/images/generations \
- 单次上游请求超时为 120 秒
- 上游请求遇到网络错误或 408/429/500/502/503/504 时,最多自动重试 3 次,并使用指数退避
- FastAPI 自动文档地址:`http://localhost:8000/docs`
- FastAPI 自动文档地址:`http://localhost:8765/docs`

Loading…
Cancel
Save