docs(api): switch base url to agent.cyjai.com
This commit is contained in:
parent
6e0df78fef
commit
5f2a5af86e
@ -10,7 +10,8 @@
|
||||
## 基本信息
|
||||
|
||||
- API 版本:v1
|
||||
- 默认后端地址(本地):`http://localhost:8091`
|
||||
- 默认后端地址(生产示例):`https://agent.cyjai.com`
|
||||
(本地开发仍可用 `http://localhost:8091`,按需替换)
|
||||
- 鉴权方式:`Authorization: Bearer <token>`
|
||||
- API 前缀:`/api/v1`
|
||||
- 数据落盘:对话与文件落盘到 API 用户独立目录(见 `auth.md`)
|
||||
@ -47,7 +48,7 @@
|
||||
## 快速开始(curl)
|
||||
|
||||
> 将 `<TOKEN>` 替换为你的 Bearer Token。
|
||||
> 默认后端:`http://localhost:8091`,如不同请修改。
|
||||
> 默认后端:`https://agent.cyjai.com`,本地调试请改为 `http://localhost:8091`。
|
||||
|
||||
### 0)创建工作区
|
||||
|
||||
@ -56,7 +57,7 @@ curl -sS -X POST \
|
||||
-H "Authorization: Bearer <TOKEN>" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{ "workspace_id": "ws1" }' \
|
||||
http://localhost:8091/api/v1/workspaces
|
||||
https://agent.cyjai.com/api/v1/workspaces
|
||||
```
|
||||
|
||||
### 1)创建对话(指定工作区)
|
||||
@ -64,7 +65,7 @@ curl -sS -X POST \
|
||||
```bash
|
||||
curl -sS -X POST \
|
||||
-H "Authorization: Bearer <TOKEN>" \
|
||||
http://localhost:8091/api/v1/workspaces/ws1/conversations
|
||||
https://agent.cyjai.com/api/v1/workspaces/ws1/conversations
|
||||
```
|
||||
|
||||
返回示例:
|
||||
@ -86,7 +87,7 @@ curl -sS -X POST \
|
||||
"model_key": null,
|
||||
"max_iterations": 100 # 默认 100,示例显式填写便于对齐
|
||||
}' \
|
||||
http://localhost:8091/api/v1/workspaces/ws1/messages
|
||||
https://agent.cyjai.com/api/v1/workspaces/ws1/messages
|
||||
```
|
||||
|
||||
返回示例(202):
|
||||
@ -109,7 +110,7 @@ curl -sS -X POST \
|
||||
```bash
|
||||
curl -sS \
|
||||
-H "Authorization: Bearer <TOKEN>" \
|
||||
"http://localhost:8091/api/v1/tasks/60322db3-f884-4a1e-a9b3-6eeb07fbab47?from=0"
|
||||
"https://agent.cyjai.com/api/v1/tasks/60322db3-f884-4a1e-a9b3-6eeb07fbab47?from=0"
|
||||
```
|
||||
|
||||
### 3)停止任务(可选)
|
||||
@ -117,7 +118,7 @@ curl -sS \
|
||||
```bash
|
||||
curl -sS -X POST \
|
||||
-H "Authorization: Bearer <TOKEN>" \
|
||||
http://localhost:8091/api/v1/tasks/60322db3-f884-4a1e-a9b3-6eeb07fbab47/cancel
|
||||
https://agent.cyjai.com/api/v1/tasks/60322db3-f884-4a1e-a9b3-6eeb07fbab47/cancel
|
||||
```
|
||||
|
||||
## 统一约定:响应结构与错误处理
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# 示例(curl / Python / JS / Flutter)
|
||||
|
||||
默认服务端:`http://localhost:8091`
|
||||
默认服务端:`https://agent.cyjai.com`
|
||||
|
||||
通用 Header:
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
## 1) curl:完整流程(工作区 + 对话 + 发送 + 轮询)
|
||||
|
||||
```bash
|
||||
BASE_URL="http://localhost:8091"
|
||||
BASE_URL="https://agent.cyjai.com"
|
||||
TOKEN="<TOKEN>"
|
||||
WS="ws1"
|
||||
|
||||
@ -77,7 +77,7 @@ done
|
||||
import time
|
||||
import requests
|
||||
|
||||
BASE_URL = "http://localhost:8091"
|
||||
BASE_URL = "https://agent.cyjai.com"
|
||||
TOKEN = "<TOKEN>"
|
||||
WS = "ws1"
|
||||
|
||||
@ -129,7 +129,7 @@ while True:
|
||||
## 3) JS:fetch(浏览器/Node)
|
||||
|
||||
```js
|
||||
const BASE_URL = "http://localhost:8091";
|
||||
const BASE_URL = "https://agent.cyjai.com";
|
||||
const TOKEN = "<TOKEN>";
|
||||
const WS = "ws1";
|
||||
|
||||
@ -169,7 +169,7 @@ for (;;) {
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
const baseUrl = "http://localhost:8091";
|
||||
const baseUrl = "https://agent.cyjai.com";
|
||||
const token = "<TOKEN>";
|
||||
const ws = "ws1";
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ curl -sS -X POST \
|
||||
-H "Authorization: Bearer <TOKEN>" \
|
||||
-F "file=@hello.txt" \
|
||||
-F "dir=inputs" \
|
||||
http://localhost:8091/api/v1/workspaces/ws1/files/upload
|
||||
https://agent.cyjai.com/api/v1/workspaces/ws1/files/upload
|
||||
```
|
||||
|
||||
列出 `ws1/user_upload/inputs`:
|
||||
@ -101,7 +101,7 @@ curl -sS -X POST \
|
||||
```bash
|
||||
curl -sS \
|
||||
-H "Authorization: Bearer <TOKEN>" \
|
||||
"http://localhost:8091/api/v1/workspaces/ws1/files?path=inputs"
|
||||
"https://agent.cyjai.com/api/v1/workspaces/ws1/files?path=inputs"
|
||||
```
|
||||
|
||||
下载目录 `ws1/user_upload/inputs`:
|
||||
@ -109,6 +109,6 @@ curl -sS \
|
||||
```bash
|
||||
curl -L -o inputs.zip \
|
||||
-H "Authorization: Bearer <TOKEN>" \
|
||||
"http://localhost:8091/api/v1/workspaces/ws1/files/download?path=inputs"
|
||||
"https://agent.cyjai.com/api/v1/workspaces/ws1/files/download?path=inputs"
|
||||
```
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ info:
|
||||
- 事件流:与网页端 WebSocket 同粒度(text_chunk、tool_start 等)
|
||||
- 多工作区:所有对话/消息/文件都在指定 workspace 下进行
|
||||
servers:
|
||||
- url: http://localhost:8091
|
||||
- url: https://agent.cyjai.com
|
||||
|
||||
components:
|
||||
securitySchemes:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user