Files
smartmate/backend/services/agent/prompt/conversation_view.go
Losita d7184b776b Version: 0.9.75.dev.260505
后端:
1.收口阶段 6 agent 结构迁移,将 newAgent 内核与 agentsvc 编排层迁入 services/agent
- 切换 Agent 启动装配与 HTTP handler 直连 agent sv,移除旧 service agent bridge
- 补齐 Agent 对 memory、task、task-class、schedule 的 RPC 适配与契约字段
- 扩展 schedule、task、task-class RPC/contract 支撑 Agent 查询、写入与 provider 切流
- 更新迁移文档、README 与相关注释,明确 agent 当前切流点和剩余 memory 迁移面
2026-05-05 16:00:57 +08:00

38 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 agentprompt
import (
"strings"
agentmodel "github.com/LoveLosita/smartflow/backend/services/agent/model"
)
// buildConversationHistoryMessage 将“真实对话流”渲染成节点可直接复用的 msg1。
//
// 职责边界:
// 1. 只负责把 user + assistant speak 组织成稳定文本;
// 2. 不拼接 tool_call / tool observation这些不属于“真实对话”
// 3. 不做长度裁剪,长度预算交给统一压缩层处理。
func buildConversationHistoryMessage(ctx *agentmodel.ConversationContext, title string) string {
title = strings.TrimSpace(title)
if title == "" {
title = "真实对话记录"
}
lines := []string{title + ""}
if ctx == nil {
lines = append(lines, "暂无。")
return strings.Join(lines, "\n")
}
turns := CollectConversationTurns(ctx.HistorySnapshot())
if len(turns) == 0 {
lines = append(lines, "暂无。")
return strings.Join(lines, "\n")
}
for _, turn := range turns {
lines = append(lines, turn.Role+": \""+turn.Content+"\"")
}
return strings.Join(lines, "\n")
}