Files
smartmate/backend/service/agentsvc/agent_route.go
Losita 09dca9f772 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
2026-03-16 22:30:45 +08:00

28 lines
1.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package agentsvc
import (
"context"
"github.com/LoveLosita/smartflow/backend/agent/route"
"github.com/cloudwego/eino-ext/components/model/ark"
)
// actionRoutingDecision 是 route 层分流结果在 agentsvc 的本地别名。
//
// 设计目的:
// 1. 让 AgentService 对 route 包保持“最小接触面”;
// 2. 后续若 route 包返回结构调整,只需改这个桥接文件。
type actionRoutingDecision = route.RoutingDecision
// decideActionRouting 决定当前请求走向哪条业务链路。
//
// 职责边界:
// 1. 只负责调用 route 包拿分流结论;
// 2. 不负责执行任何业务节点;
// 3. route 层失败时的兜底策略由 route 包内部统一处理(当前为回落 chat
func (s *AgentService) decideActionRouting(ctx context.Context, selectedModel *ark.ChatModel, userMessage string) actionRoutingDecision {
// 这里保留方法封装,是为了避免上层直接依赖 route 包,降低耦合。
_ = s
return route.DecideActionRouting(ctx, selectedModel, userMessage)
}