Version: 0.9.3.dev.260407
后端:
1.Execute 上下文修复(无限循环 / 重复确认根治)
- 更新node/execute.go:speak 写入历史(修复旧 TODO);confirm 动作 speak 不再丢失;
continue 无工具调用时写 reason 保证上下文推进;区分 tool_call 数组/JSON损坏两种
correction hint;goal_check hint 区分 plan/ReAct 模式
- 更新node/execute.go:新增 AlwaysExecute 字段,extra.always_execute=true 时写工具
跳过确认闸门直接执行并持久化
- 更新model/graph_run_state.go:AgentGraphRequest 新增 AlwaysExecute;新增
WriteSchedulePreviewFunc 类型和 WriteSchedulePreview Dep
- 更新service/agentsvc/agent.go:新增 readAgentExtraBool 辅助
2.粗排全链路修复
- 更新service/agentsvc/agent_newagent.go:makeRoughBuildFunc 改用 HybridScheduleEntry
而非 TaskClassItem.EmbeddedTime,普通时段放置不再被丢弃
- 更新conv/schedule_provider.go:LoadScheduleState 从 task class 日期范围推算多周
规划窗口,不再硬编码当前周 7 天;DayMapping 覆盖全部相关周,粗排跨周结果不再
被 WeekDayToDay 静默丢弃
- 更新node/rough_build.go:pinned block 区分有/无未覆盖 pending 任务两种情况,
有 pending 时明确操作顺序(find_free→place)和完成判定,防止 LLM 重复调
list_tasks;新增 countPendingTasks 辅助(只统计 Slots 为空的真正未覆盖任务)
- 更新model/common_state.go:新增 StartDirectExecute(),Chat 直接路由 execute 时
清空旧 PlanSteps,修复跨会话 HasPlan() 误判导致 ReAct 走 plan 模式的 bug
- 更新node/chat.go:handleRouteExecute 改用 StartDirectExecute()
3.排程预览缓存迁移至 Deliver 节点
- 更新node/agent_nodes.go:Deliver 节点完成后调用 WriteSchedulePreview,只有任务
真正完成才写预览缓存,中断路径不写中间态
- 更新service/agentsvc/agent_newagent.go:注入 makeWriteSchedulePreviewFunc;移除
graph 结束后的内联写入;makeRoughBuildFunc 注释修正
- 更新conv/schedule_preview.go:ScheduleStateToPreview 补设 GeneratedAt
- 更新model/agent.go:GetSchedulePlanPreviewResponse 新增 HybridEntries 字段
- 更新service/agentsvc/agent_schedule_preview.go:GET handler Redis/MySQL 两条路径
均透传 HybridEntries
4.Execute thinking 模式修复
- 更新newAgent/llm/ark_adapter.go:thinking 开启时强制 temperature=1,MaxTokens 自
动托底至 16000,调用方与适配层行为对齐
- 更新node/execute.go:调用参数同步改为 temperature=1.0 / MaxTokens=16000
undo:
1.流式推送换行未修复(undo)
2.上下文依然待审视
前端:无
仓库:无
This commit is contained in:
@@ -10,26 +10,28 @@ import (
|
||||
|
||||
// buildStageMessages 组装某个阶段通用的 messages。
|
||||
//
|
||||
// 步骤说明:
|
||||
// 1. 先合并 context 自带 system prompt 与阶段 prompt,保证通用约束和阶段约束都生效;
|
||||
// 2. 再把置顶上下文块和工具摘要补成 system message,尽量顶在 history 前面;
|
||||
// 3. 最后追加历史消息与本轮 user prompt,保持"新约束在前、历史在后"的稳定顺序。
|
||||
// 消息排列策略(利用 LLM 近因效应):
|
||||
// 1. system prompt(角色 + 阶段规则)— 始终最顶部,定义基本身份;
|
||||
// 2. tool schemas(能力边界)— 稳定参考信息,放在 history 前即可;
|
||||
// 3. history(对话历史、工具调用、修正反馈)— 按时间顺序排列;
|
||||
// 4. pinned blocks(当前计划、当前步骤、粗排结果等最新约束)— 紧贴 user prompt,
|
||||
// 利用近因效应让 LLM 优先关注本轮最相关的约束,而非被历史消息分散注意力;
|
||||
// 5. user prompt(阶段性指令)— 始终在末尾,是本轮回答的核心触发。
|
||||
func buildStageMessages(stageSystemPrompt string, ctx *newagentmodel.ConversationContext, runtimeUserPrompt string) []*schema.Message {
|
||||
messages := make([]*schema.Message, 0, 4)
|
||||
|
||||
// 1. 合并 system prompt:基础角色约束 + 阶段规则,始终在最顶部。
|
||||
mergedSystemPrompt := mergeSystemPrompts(ctx, stageSystemPrompt)
|
||||
if mergedSystemPrompt != "" {
|
||||
messages = append(messages, schema.SystemMessage(mergedSystemPrompt))
|
||||
}
|
||||
|
||||
if pinnedText := renderPinnedBlocks(ctx); pinnedText != "" {
|
||||
messages = append(messages, schema.SystemMessage(pinnedText))
|
||||
}
|
||||
|
||||
// 2. 工具摘要:稳定参考信息,放在 history 前即可。
|
||||
if toolText := renderToolSchemas(ctx); toolText != "" {
|
||||
messages = append(messages, schema.SystemMessage(toolText))
|
||||
}
|
||||
|
||||
// 3. 对话历史:按时间顺序,包含工具调用结果和修正反馈。
|
||||
if ctx != nil {
|
||||
history := ctx.HistorySnapshot()
|
||||
if len(history) > 0 {
|
||||
@@ -48,6 +50,13 @@ func buildStageMessages(stageSystemPrompt string, ctx *newagentmodel.Conversatio
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 置顶上下文块:当前计划、当前步骤、粗排结果等最新约束。
|
||||
// 放在 history 之后、user prompt 之前,利用 LLM 近因效应提升对最新约束的注意力。
|
||||
if pinnedText := renderPinnedBlocks(ctx); pinnedText != "" {
|
||||
messages = append(messages, schema.SystemMessage(pinnedText))
|
||||
}
|
||||
|
||||
// 5. 阶段性用户提示词:始终在末尾,是本轮回答的核心触发。
|
||||
runtimeUserPrompt = strings.TrimSpace(runtimeUserPrompt)
|
||||
if runtimeUserPrompt != "" {
|
||||
messages = append(messages, schema.UserMessage(runtimeUserPrompt))
|
||||
|
||||
Reference in New Issue
Block a user