多轮 ReAct Agent · 联网搜索 · 网页精读 · LLM 合成
所有接口基于 http://localhost:8800,支持 CORS 跨域访问。
健康检查,返回服务状态、模型配置和工具配置状态。
curl http://localhost:8800/api/health
同步深度研究。返回完整答案、引用列表,以及段落到引用 ID 的映射。
curl -X POST http://localhost:8800/api/research \
-H "Content-Type: application/json" \
-d '{"question":"OpenAI 最新的模型进展?"}'
返回 JSON 字段:
{
"question": "OpenAI 最新的模型进展?",
"answer": "报告正文,段落旁可能包含 [ref_001] 这样的引用标记。",
"success": true,
"turns": 2,
"tokens_used": 1234,
"time_seconds": 12.3,
"timestamp": "2026-07-08T16:00:00",
"references": [
{
"id": "ref_001",
"title": "文档或网页标题",
"url": "https://example.com/article",
"source": "来源名称",
"snippet": "搜索结果摘要",
"summary": "网页精读摘要",
"evidence": "支持结论的原文证据片段",
"tool": "search|visit|scholar"
}
],
"paragraph_citations": [
{
"text": "报告中的某一段内容 [ref_001]",
"ref_ids": ["ref_001"]
}
]
}
流式深度研究。SSE 会持续返回 start、log、heartbeat,完成时返回 result。其中 result 与同步接口一样包含 references 和 paragraph_citations。
// JavaScript SSE
const response = await fetch('/api/research/stream', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({question: "你的问题"})
});
const reader = response.body.getReader();
// result.references / result.paragraph_citations 可用于渲染引用。
import requests
resp = requests.post(
"http://localhost:8800/api/research",
json={"question": "OpenAI 最新的模型进展?"}
)
result = resp.json()
print(result["answer"])
print(result["references"])
print(result["paragraph_citations"])
fetch("http://localhost:8800/api/research", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ question: "OpenAI latest news" })
})
.then(r => r.json())
.then(result => {
console.log(result.answer);
console.log(result.references);
console.log(result.paragraph_citations);
})