73 lines
1020 B
Markdown
73 lines
1020 B
Markdown
# API 文档
|
||
|
||
搜索入口: `http://localhost:8650`
|
||
|
||
## 搜索
|
||
|
||
```
|
||
POST /api/search
|
||
Content-Type: application/json
|
||
|
||
{
|
||
"query": "搜索词",
|
||
"source": "auto", // auto / tavily / baidu / searxng / tavily,baidu
|
||
"max_results": 10
|
||
}
|
||
```
|
||
|
||
## 搜索源列表
|
||
|
||
```
|
||
GET /api/sources
|
||
```
|
||
|
||
## 服务状态
|
||
|
||
```
|
||
GET /api/status
|
||
```
|
||
|
||
## AI 总结(流式 SSE)
|
||
|
||
```
|
||
POST /api/ai-summarize/stream
|
||
Content-Type: application/json
|
||
|
||
{
|
||
"query": "搜索词",
|
||
"results": [{"title": "...", "url": "...", "content": "..."}]
|
||
}
|
||
```
|
||
|
||
响应为 Server-Sent Events:
|
||
|
||
```
|
||
event: delta
|
||
data: {"content": "..."}
|
||
|
||
event: meta
|
||
data: {"model": "...", "elapsed": 1.23}
|
||
|
||
event: error
|
||
data: {"error": "..."}
|
||
```
|
||
|
||
## 管理 API
|
||
|
||
### 获取源配置
|
||
```
|
||
GET /api/admin/sources/{name}
|
||
```
|
||
|
||
### 更新源配置
|
||
```
|
||
POST /api/admin/sources/{name}
|
||
Content-Type: application/json
|
||
|
||
{"api_key": "sk-xxx", "base_url": "https://..."}
|
||
```
|
||
|
||
## 完整 API 列表
|
||
|
||
访问管理面板或 `GET /api/docs` 获取完整列表及 curl 示例。
|