Files
smartmate/backend/agent/quicknote/quick_note_graph_test.go
Losita c689af56c8 Version: 0.5.6.dev.260314
 feat(agent): 重构 Agent 分层并修复普通聊天助手消息未写入 Redis 的问题

🔧 按职责重构 backend/agent 目录为 route/chat/quicknote 三层结构

🔄 将随口记链路拆分为 graph/nodes/tool/state/prompt,其中 graph 仅负责连线

🏃 新增 quicknote runner(方法引用)来收口节点依赖,提升代码可读性

🔀 将控制码分流逻辑抽离到 agent/route,服务层改为薄封装调用

📚 更新相关 README 与测试引用路径,保持原业务逻辑不变

🐛 修复普通聊天链路遗漏 assistant 写入 Redis 的问题(确保 MySQL 和 Redis 的口径一致)
2026-03-14 19:42:26 +08:00

37 lines
820 B
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 quicknote
import "testing"
func TestDeriveQuickNoteTitleFromInput(t *testing.T) {
cases := []struct {
name string
input string
want string
}{
{
name: "保留核心事项并去掉尾部提醒口头语",
input: "明天上午12点我要去取快递到时候记得q我",
want: "明天上午12点我要去取快递",
},
{
name: "去掉常见前缀口头语",
input: "提醒我周五下午三点交实验报告",
want: "周五下午三点交实验报告",
},
{
name: "空输入兜底",
input: " ",
want: "这条任务",
},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
got := deriveQuickNoteTitleFromInput(tc.input)
if got != tc.want {
t.Fatalf("title 提取不符合预期got=%q want=%q", got, tc.want)
}
})
}
}