Version: 0.6.5.dev.260316

 feat(agent): 通用分流接入随口问图编排,修复任务查询条数与重复输出问题

- ♻️ 将 Agent 路由升级为通用 `action` 分流机制,统一支持 `chat` / `quick_note_create` / `task_query`
- 🧩 新增 `taskquery` 子模块并落地图编排链路:`plan -> quadrant -> time_anchor -> tool_query -> reflect`
- 🔧 在图内接入 `query_tasks` 工具调用,支持自动放宽检索条件与反思重试,最多重试 2 次
- 🚪 保持 `/agent/chat` 作为多合一入口,不额外新增任务查询 HTTP 接口
- 🪄 修复“随口问”场景下的双重列表输出问题:LLM 仅保留简短前缀,任务列表统一由后端进行确定性渲染
- 🎯 修复显式数量约束失效问题:支持提取“来一个”“前 3 个”“top5”等数量表达,并将其锁定为 `limit`
- 🛡️ 防止在重试或放宽检索阶段改写用户显式指定的数量约束
-  补充并更新测试,覆盖路由解析、数量提取、`limit` 生效及重复输出等关键场景

📝 docs: 更新随口问链路文档与决策记录

- 📚 更新 README 5.4,新增/修订随口问链路 Mermaid 图
- 🧭 新增随口问功能决策记录 FDR
This commit is contained in:
Losita
2026-03-16 22:30:45 +08:00
parent 84371e2ff8
commit 09dca9f772
16 changed files with 2371 additions and 105 deletions

View File

@@ -0,0 +1,37 @@
package taskquery
import (
"fmt"
"strings"
"github.com/cloudwego/eino/components/tool"
)
// buildInvokableToolMap 把工具包转换成“工具名 -> 可执行工具”映射。
//
// 职责边界:
// 1. 只做工具元数据到执行器的映射,不做业务逻辑;
// 2. 若工具包结构异常(数量不一致/信息缺失)直接返回 error
// 3. 供图节点在运行时快速按工具名取执行器。
func buildInvokableToolMap(bundle *TaskQueryToolBundle) (map[string]tool.InvokableTool, error) {
if bundle == nil || len(bundle.Tools) == 0 || len(bundle.ToolInfos) == 0 {
return nil, fmt.Errorf("task query tool bundle is empty")
}
if len(bundle.Tools) != len(bundle.ToolInfos) {
return nil, fmt.Errorf("task query tool bundle mismatch")
}
result := make(map[string]tool.InvokableTool, len(bundle.Tools))
for idx, baseTool := range bundle.Tools {
info := bundle.ToolInfos[idx]
if info == nil || strings.TrimSpace(info.Name) == "" {
return nil, fmt.Errorf("task query tool info is invalid")
}
invokableTool, ok := baseTool.(tool.InvokableTool)
if !ok {
return nil, fmt.Errorf("task query tool %s is not invokable", info.Name)
}
result[info.Name] = invokableTool
}
return result, nil
}