集成

Flowise

把 Thunderbit 包成 Flowise 自定义 Tool,给 chain 和 agent 用

Flowise 是基于 LangChain 的拖拽式构建器。用 Custom Tool 节点把 /distill 暴露给画布上任意 chain 或 agent。

创建自定义 Tool

Tools → Custom Tool → Add new

  • Tool name: read_url
  • Tool description: Fetch a URL and return clean Markdown for the agent to read.
  • Input schema (JSON):
{
  "type": "object",
  "required": ["url"],
  "properties": {
    "url":        { "type": "string" },
    "renderMode": { "type": "string", "enum": ["basic", "advanced"], "default": "basic" }
  }
}
  • JavaScript function:
const res = await fetch('https://openapi.thunderbit.com/openapi/v1/distill', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${$vars.THUNDERBIT_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ url: $url, renderMode: $renderMode || 'basic' }),
});
const json = await res.json();
return json.data.markdown;

API Key 存到 Variables 里,命名 THUNDERBIT_API_KEY,别写死在代码里。

接入 chain

read_url Tool 拖到 AgentTool Agent 节点旁边,配上你的 LLM(OpenAI、Anthropic、Ollama)。Agent 会自动识别。

小贴士

  • RAG 入库时,搭配 Document Loader 系列 —— 在自定义节点里调 read_url,把 Markdown 喂给 Recursive Character Text Splitter,再写入 vector store
  • 长页面会撑爆 agent 的 context —— 在 Custom Tool 里截到 ~8k 字符再返回

相关链接