init: Search Hub - 统一多搜索引擎聚合服务

This commit is contained in:
2026-05-09 18:46:05 +08:00
commit 81d726179c
27 changed files with 3179 additions and 0 deletions

72
docs/api.md Normal file
View File

@@ -0,0 +1,72 @@
# 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 示例。