多轮 ReAct Agent · 联网搜索 · 网页精读 · LLM 合成

诺贝尔奖 量子计算 AI 进展 经济数据
就绪,等待输入问题
研究结果
开发者接口文档 (API Reference)

基础信息

所有接口基于 http://localhost:8800,支持 CORS 跨域访问。

GET /api/health

健康检查,返回服务状态、模型配置和工具配置状态。

curl http://localhost:8800/api/health

POST /api/research

同步深度研究。返回完整答案、引用列表,以及段落到引用 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"]
    }
  ]
}

POST /api/research/stream

流式深度研究。SSE 会持续返回 startlogheartbeat,完成时返回 result。其中 result 与同步接口一样包含 referencesparagraph_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 可用于渲染引用。

Python 调用示例

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"])

Node.js 调用示例

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);
  })