Coco-AI 接入自定义数据源

Coco-AI 接入自定义数据源

之前使用 Hugo Connector 接入和 hexo 和任意 Markdown,后来官方也支持了对于任意数据源的支持,主要是开放了这个接口:

image-20250417194847718

具体操作如下:

设置 - conntor - 新增,让输入名称和描述等信息,新建出来 conntor

image-20250417194910829

然后我们就能在数据源上的页面上看到刚刚添加的了 Customize Connector 了

image-20250417195015291

点开提示,给了一个 API

image-20250417194847718

然后我们去创建 token,如图

image-20250417195602722

我这边使用 Postman 进行设置

如果你的请求没有带 token,就是这样的。

image-20250417195729078

转成代码的是这样的,当然也可以开发自己的 agent。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import requests
import json

url = "http://localhost:9000/datasource/d00eeolvf2xxx/_doc"

payload = json.dumps({
"title": "I am just a Coco doc that you can search",
"summary": "Nothing but great start",
"content": "Coco is a unified private search engien that you can trust.",
"url": "http://coco.rs/",
"icon": "default"
})
headers = {
'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Coco-AI 接入自定义数据源

https://airag.click/posts/271ab503/

作者

Xu

发布于

2025-04-17

更新于

2026-02-27

许可协议

评论

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×