后端: 1.彻底删除原agent文件夹,并将现agent2文件夹全量重命名为agent(包括全部涉及到的文件以及文档、注释),迁移工作完美结束 2.修复了重试消息的相关逻辑问题 前端: 1.改善了一些交互体验,修复了一些bug,现在只剩少的功能了,现存的bug基本都修复完毕 全仓库: 1.更新了决策记录和README文档
35 lines
956 B
Go
35 lines
956 B
Go
package agentrouter
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
// Resolver 定义一级路由器能力。
|
|
type Resolver interface {
|
|
Resolve(ctx context.Context, req *AgentRequest) (*RoutingDecision, error)
|
|
}
|
|
|
|
// SkillHandler 是某个 skill 的统一执行入口。
|
|
type SkillHandler func(ctx context.Context, req *AgentRequest) (*AgentResponse, error)
|
|
|
|
// AgentRequest 是 Agent 路由层可见的最小请求结构。
|
|
//
|
|
// 设计目的:
|
|
// 1. 让 router 层只依赖自己真正关心的字段;
|
|
// 2. 避免把整份 agentmodel 结构在迁移早期层层透传;
|
|
// 3. 后续若总入口还要追加别的字段,只需要在入口层做一次映射。
|
|
type AgentRequest struct {
|
|
UserID int
|
|
ConversationID string
|
|
UserMessage string
|
|
ModelName string
|
|
Extra map[string]any
|
|
}
|
|
|
|
// AgentResponse 是路由分发器对 skill handler 的统一响应外壳。
|
|
type AgentResponse struct {
|
|
Action Action
|
|
Reply string
|
|
Meta map[string]any
|
|
}
|