feat: add AI学习助手 agent (KG+RAG ideal) and renshenguo feishu bot

- Add AI学习助手 agent creation script with all 39 tools, 3-layer KG+RAG memory
- Add renshenguo (人参果) feishu bot integration (app_service + ws_handler)
- Register renshenguo WS client in main.py startup
- Add RENSHENGUO_APP_ID / RENSHENGUO_APP_SECRET / RENSHENGUO_AGENT_ID config
- Reorganize docs from root into docs/ subdirectories
- Move startup scripts to scripts/startup/
- Various backend optimizations and tool improvements

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
renjianbo
2026-05-06 01:37:13 +08:00
parent f33bc461ff
commit eabf90c496
171 changed files with 4906 additions and 445 deletions

View File

@@ -14,6 +14,7 @@ from app.agent_runtime.schemas import (
AgentLLMConfig,
AgentToolConfig,
AgentBudgetConfig,
AgentMemoryConfig,
)
logger = logging.getLogger(__name__)
@@ -83,20 +84,35 @@ async def run_agent_node(
if "max_tool_calls" in budget_limits:
budget.max_tool_calls = max(1, int(budget_limits["max_tool_calls"]))
# 构建记忆配置(从 node_data 读取完整字段,兼容简化配置)
mem_enabled = bool(node_data.get("memory", True))
memory_config = AgentMemoryConfig(
enabled=mem_enabled,
max_history_messages=int(node_data.get("memory_max_history", 20)),
persist_to_db=bool(node_data.get("memory_persist", mem_enabled)),
vector_memory_enabled=bool(node_data.get("memory_vector_enabled", True)),
vector_memory_top_k=int(node_data.get("memory_vector_top_k", 5)),
learning_enabled=bool(node_data.get("memory_learning", True)),
)
# 构建工具审批配置
tool_config = AgentToolConfig(
include_tools=node_data.get("tools") or [],
exclude_tools=node_data.get("exclude_tools") or [],
require_approval=node_data.get("require_approval") or [],
approval_timeout_ms=int(node_data.get("approval_timeout_ms", 60000)),
approval_default=node_data.get("approval_default", "deny"),
)
agent_config = AgentConfig(
name=node_data.get("label", "agent_node"),
system_prompt=formatted_prompt,
llm=llm_config,
tools=AgentToolConfig(
include_tools=node_data.get("tools", []),
exclude_tools=node_data.get("exclude_tools", []),
),
memory={
"enabled": node_data.get("memory", True),
"persist_to_db": node_data.get("memory", True),
},
tools=tool_config,
memory=memory_config,
budget=budget,
user_id=user_id,
memory_scope_id=node_data.get("memory_scope_id") or node_data.get("agent_id", ""),
self_review_enabled=node_data.get("self_review_enabled", False),
)