Version: 0.9.4.dev.260407
后端: 1.粗排结果/预览语义修复(task_item suggested 保真 + existing/嵌入识别补全) - 更新conv/schedule_state.go:LoadScheduleState 补齐 event.rel_id / schedules.embedded_task_id / task_item.embedded_time 三种“已落位”信号;嵌入任务强制 existing + 继承 host slots;补充 task_item duration/name/slot helper;Diff 相关英文注释改中文 - 更新conv/schedule_preview.go:预览层新增 shouldMarkSuggestedInPreview,pending 任务与 source=task_item 的建议态任务统一输出 suggested 2.newAgent 状态快照增强(ScheduleState/OriginalScheduleState 跨轮恢复) - 更新model/state_store.go:AgentStateSnapshot 新增 ScheduleState / OriginalScheduleState - 更新model/graph_run_state.go:AgentGraphRunInput/AgentGraphState 接入两份 schedule 状态;恢复旧快照时自动补 original clone - 更新service/agentsvc/agent_newagent.go:loadOrCreateRuntimeState 返回并恢复 schedule/original;runNewAgentGraph 透传到 graph - 更新node/agent_nodes.go:saveAgentState 一并保存 schedule/original 到 Redis 快照 3.Execute 链路纠偏(只写内存不落库 + 完整打点 + 恢复消息去重) - 更新node/execute.go:AlwaysExecute/confirm resume 路径取消 PersistScheduleChanges,仅保留内存写;新增 execute LLM 完整上下文日志;新增工具调用前后 state 摘要日志;thinking 模式改为 enabled - 更新node/chat.go:pending resume 不再重复写入同一轮 user message - 更新service/agentsvc/agent_newagent.go:新增 deliver preview write/state 摘要日志,便于排查 suggested 丢失问题 4.AlwaysExecute 贯通 Plan→Graph→Execute - 更新node/plan.go:PlanNodeInput 新增 AlwaysExecute;plan_done 后支持自动确认直接进入执行 - 更新graph/common_graph.go:branchAfterPlan 支持 PhaseExecuting/PhaseDone 分支 5.排课上下文补强(显式注入 task_class_ids,减少 Execute 误 ask_user) - 更新prompt/execute.go:Plan/ReAct 两种 execute prompt 都显式写入任务类 ID,声明“上下文已完整,无需追问” - 更新node/rough_build.go:粗排完成 pinned block 显式标注任务类 ID,避免 Execute 找不到 ID 来源 6.流式输出与预览调试工具修复 - 更新stream/emitter.go:保留换行,修复 pseudo stream 分片后文本黏连/双换行问题 - 更新infra/schedule_preview_viewer.html:升级预览工具,支持 candidate_plans / hybrid_entries 前端:无 仓库: 1.更新了infra内的html,适应了获取日程接口
This commit is contained in:
@@ -139,8 +139,8 @@ func (e *ChunkEmitter) EmitAssistantText(blockID, stage, text string, includeRol
|
||||
if e == nil || e.emit == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
text = strings.TrimSpace(text)
|
||||
//这里如果不删掉,换行符会被吞了,导致文字黏连
|
||||
/* text = strings.TrimSpace(text)*/
|
||||
if text == "" {
|
||||
return nil
|
||||
}
|
||||
@@ -509,9 +509,7 @@ func SplitPseudoStreamText(text string, options PseudoStreamOptions) []string {
|
||||
options = normalizePseudoStreamOptions(options)
|
||||
runes := []rune(text)
|
||||
if len(runes) <= options.MaxChunkRunes {
|
||||
if hasTrailingNewline {
|
||||
return []string{text + "\n"}
|
||||
}
|
||||
// text 经 TrimRight(" \t\r") 已保留结尾 \n,直接返回,不再追加。
|
||||
return []string{text}
|
||||
}
|
||||
|
||||
@@ -532,7 +530,9 @@ func SplitPseudoStreamText(text string, options PseudoStreamOptions) []string {
|
||||
continue
|
||||
}
|
||||
|
||||
chunk := strings.TrimSpace(string(runes[start : i+1]))
|
||||
// 用 Trim(" \t\r") 代替 TrimSpace:保留 chunk 内的 \n(段落分隔符)。
|
||||
// TrimSpace 会把 flush 在 \n 边界时结尾的 \n、以及下一段开头的 \n 全部删掉,导致黏连。
|
||||
chunk := strings.Trim(string(runes[start:i+1]), " \t\r")
|
||||
if chunk != "" {
|
||||
chunks = append(chunks, chunk)
|
||||
}
|
||||
@@ -541,19 +541,17 @@ func SplitPseudoStreamText(text string, options PseudoStreamOptions) []string {
|
||||
}
|
||||
|
||||
if start < len(runes) {
|
||||
chunk := strings.TrimSpace(string(runes[start:]))
|
||||
chunk := strings.Trim(string(runes[start:]), " \t\r")
|
||||
if chunk != "" {
|
||||
chunks = append(chunks, chunk)
|
||||
}
|
||||
}
|
||||
|
||||
if len(chunks) == 0 {
|
||||
if hasTrailingNewline {
|
||||
return []string{text + "\n"}
|
||||
}
|
||||
return []string{text}
|
||||
}
|
||||
if hasTrailingNewline {
|
||||
// 仅当最后一个 chunk 尚未以 \n 结尾时才追加,避免 Trim 修复后出现双换行。
|
||||
if hasTrailingNewline && !strings.HasSuffix(chunks[len(chunks)-1], "\n") {
|
||||
chunks[len(chunks)-1] += "\n"
|
||||
}
|
||||
return chunks
|
||||
|
||||
Reference in New Issue
Block a user