跳到主要内容

基础操作

这一页展示当前真实服务 API 的最小操作流。

登录

TOKEN=$(curl -s -X POST http://127.0.0.1:3000/v1/dashboard/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"admin"}' | jq -r '.token')

创建 Stream

STREAM_ID=$(uuidgen | tr '[:upper:]' '[:lower:]')

摄入文本事件

curl -s -X POST "http://127.0.0.1:3000/v1/users/user_123/streams/$STREAM_ID/events" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"org_id": "default",
"content": "User writes Rust code with async patterns",
"content_type": "text"
}'

检索

curl -s -X POST "http://127.0.0.1:3000/v1/users/user_123/streams/$STREAM_ID/retrieve" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"org_id": "default",
"query": "What language and style does the user prefer?",
"limit": 5,
"graph_depth": 1
}'

手动添加图谱边

curl -s -X POST "http://127.0.0.1:3000/v1/users/user_123/graph/edges" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"source_id": "11111111-1111-1111-1111-111111111111",
"target_id": "22222222-2222-2222-2222-222222222222",
"relation": "Supports",
"weight": 0.8
}'

查看待处理队列

curl -s http://127.0.0.1:3000/v1/status/pending \
-H "Authorization: Bearer $TOKEN"

使用 Dashboard

  • UI:http://127.0.0.1:3100/dashboard
  • API 重定向:http://127.0.0.1:3000/dashboard

Dashboard 适合用来查看记忆、图谱、组织知识和集群状态。