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 迁移面
This commit is contained in:
21
backend/services/agent/node/speak_text.go
Normal file
21
backend/services/agent/node/speak_text.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package agentnode
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// listItemRe 匹配被粘连在一起的列表序号,用于正文归一化时自动补换行。
|
||||
var listItemRe = regexp.MustCompile(`([^\n])([2-9][\.、]\s)`)
|
||||
|
||||
// normalizeSpeak 统一整理要展示给用户的正文。
|
||||
func normalizeSpeak(speak string) string {
|
||||
speak = strings.TrimSpace(speak)
|
||||
if speak == "" {
|
||||
return speak
|
||||
}
|
||||
if !strings.Contains(speak, "\n") {
|
||||
speak = listItemRe.ReplaceAllString(speak, "$1\n$2")
|
||||
}
|
||||
return speak + "\n"
|
||||
}
|
||||
Reference in New Issue
Block a user