|
|
18 часов назад | |
|---|---|---|
| .. | ||
| README.md | 18 часов назад | |
| knowledge_manager.prompt | 18 часов назад | |
| knowledge_manager.py | 18 часов назад | |
| knowledge_manager_v2.py | 18 часов назад | |
| librarian.prompt | 18 часов назад | |
| run_knowledge_manager.py | 18 часов назад | |
知识库管理 Agent,负责知识库的查询、维护和更新。
帮助其他 Agent 了解知识库中已有的内容。
使用示例:
# 在调研前查询已有信息
result = agent("knowledge_manager",
"查询知识库中关于 ControlNet 的所有信息")
输出:
接收调研结果,智能去重并保存到知识库。
使用示例:
# 调研完成后保存结果
data = {
"tools": [...],
"resources": [...],
"knowledge": [...]
}
result = agent("knowledge_manager",
f"保存以下调研结果:{json.dumps(data, ensure_ascii=False)}")
{
"name": "ControlNet",
"slug": "controlnet",
"category": "plugin",
"version": "1.1",
"description": "SD 姿态控制插件",
"tutorial": "使用方法...",
"source_url": "https://..."
}
{
"title": "ControlNet 官方文档",
"body": "文档内容...",
"content_type": "documentation",
"source_url": "https://...",
"metadata": {}
}
{
"task": "在生成人物图像时,需要控制姿态",
"content": "使用 ControlNet 插件...",
"types": ["tool"],
"tags": {"tool": "controlnet"},
"score": 4
}
需要设置以下环境变量:
export DATABASE_URL="postgresql://user:pass@localhost:5432/knowhub"
export KNOWHUB_API="http://localhost:8000"
在 presets.json 中注册:
{
"knowledge_manager": {
"prompt_file": "knowhub/agents/knowledge_manager.prompt",
"model": "qwen3.5-plus",
"temperature": 0.2
}
}
在主 Agent 中调用:
# 通过 agent 工具调用
result = agent("knowledge_manager", "查询 ControlNet")