Version: 0.7.1.dev.260320

🧠 agent智能编排:删除了落库相关逻辑。再次重申:agent智能编排旨在为用户预览排程结果,实际的落库由用户决定,并通过按钮触发常规接口进行落库。目前仅保留 ReAct 精排循环链路(待改进)。
📄 修改了 ReAct 智能精排决策文档相关内容。
🔄 undo:当前 agent 智能排程逻辑待改进。
This commit is contained in:
LoveLosita
2026-03-20 19:40:11 +08:00
parent d3cec2a5b9
commit 059b25872a
12 changed files with 115 additions and 661 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"github.com/cloudwego/eino-ext/components/model/ark"
"github.com/cloudwego/eino/compose"
"github.com/cloudwego/eino/schema"
)
@@ -60,27 +59,6 @@ func (r *schedulePlanRunner) previewNode(ctx context.Context, st *SchedulePlanSt
return runPreviewNode(ctx, st, r.deps, r.emitStage)
}
func (r *schedulePlanRunner) materializeNode(ctx context.Context, st *SchedulePlanState) (*SchedulePlanState, error) {
return runMaterializeNode(ctx, st, r.chatModel, r.deps, r.emitStage)
}
func (r *schedulePlanRunner) applyNode(ctx context.Context, st *SchedulePlanState) (*SchedulePlanState, error) {
return runApplyNode(ctx, st, r.deps, r.emitStage)
}
func (r *schedulePlanRunner) reflectNode(ctx context.Context, st *SchedulePlanState) (*SchedulePlanState, error) {
return runReflectNode(ctx, st, r.chatModel, r.emitStage)
}
func (r *schedulePlanRunner) finalizeNode(ctx context.Context, st *SchedulePlanState) (*SchedulePlanState, error) {
return runFinalizeNode(ctx, st, r.chatModel, r.emitStage)
}
func (r *schedulePlanRunner) exitNode(_ context.Context, st *SchedulePlanState) (*SchedulePlanState, error) {
// exit 节点不做任何业务逻辑,仅把当前状态原样透传到 END。
return st, nil
}
// ── ReAct 精排节点适配层 ──
func (r *schedulePlanRunner) hybridBuildNode(ctx context.Context, st *SchedulePlanState) (*SchedulePlanState, error) {
@@ -95,42 +73,27 @@ func (r *schedulePlanRunner) returnPreviewNode(ctx context.Context, st *Schedule
return runReturnPreviewNode(ctx, st, r.emitStage)
}
func (r *schedulePlanRunner) exitNode(_ context.Context, st *SchedulePlanState) (*SchedulePlanState, error) {
// exit 节点不做任何业务逻辑,仅把当前状态原样透传到 END。
return st, nil
}
// ── 分支决策适配层 ──
func (r *schedulePlanRunner) nextAfterPlan(_ context.Context, st *SchedulePlanState) (string, error) {
return selectNextAfterPlan(st), nil
}
func (r *schedulePlanRunner) nextAfterMaterialize(_ context.Context, st *SchedulePlanState) (string, error) {
// materialize 后:有 ApplyRequest 则去 apply否则去 exit。
if st == nil || st.ApplyRequest == nil || len(st.ApplyRequest.Items) == 0 {
return schedulePlanGraphNodeExit, nil
}
return schedulePlanGraphNodeApply, nil
}
func (r *schedulePlanRunner) nextAfterApply(_ context.Context, st *SchedulePlanState) (string, error) {
return selectNextAfterApply(st), nil
}
func (r *schedulePlanRunner) nextAfterReflect(_ context.Context, st *SchedulePlanState) (string, error) {
return selectNextAfterReflect(st), nil
}
// nextAfterPreview 根据 preview 结果决定下一步。
//
// 分支规则:
// 1) preview 失败(无候选方案)-> exit
// 2) HybridScheduleWithPlan 已注入 -> hybridBuild ReAct 精排路径)
// 3) 否则 -> materialize走原有落库路径向后兼容
// 2) 否则 -> hybridBuild进入 ReAct 精排路径)
func (r *schedulePlanRunner) nextAfterPreview(_ context.Context, st *SchedulePlanState) (string, error) {
if st == nil || len(st.CandidatePlans) == 0 {
return schedulePlanGraphNodeExit, nil
}
if r.deps.HybridScheduleWithPlan != nil {
return schedulePlanGraphNodeHybridBuild, nil
}
return schedulePlanGraphNodeMaterialize, nil
return schedulePlanGraphNodeHybridBuild, nil
}
// nextAfterHybridBuild 根据 hybridBuild 结果决定下一步。
@@ -140,8 +103,3 @@ func (r *schedulePlanRunner) nextAfterHybridBuild(_ context.Context, st *Schedul
}
return schedulePlanGraphNodeReactRefine, nil
}
// nextAfterFinalize 用于 finalize 分支——固定结束。
func (r *schedulePlanRunner) nextAfterFinalize(_ context.Context, _ *SchedulePlanState) (string, error) {
return compose.END, nil
}