mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
fix(session): normalize CreatedAt in SessionManager AddFullMessage/SetHistory
This commit is contained in:
@@ -105,9 +105,10 @@ func TestTurnProfile_DisabledPreservesDefaultHistoryAndPrompt(t *testing.T) {
|
||||
al := newTurnProfileAgentLoop(t, cfg, provider)
|
||||
agent := al.GetRegistry().GetDefaultAgent()
|
||||
sessionKey := "agent:default:test-default"
|
||||
ts := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
initialHistory := []providers.Message{
|
||||
{Role: "user", Content: "old user"},
|
||||
{Role: "assistant", Content: "old assistant"},
|
||||
{Role: "user", Content: "old user", CreatedAt: &ts},
|
||||
{Role: "assistant", Content: "old assistant", CreatedAt: &ts},
|
||||
}
|
||||
agent.Sessions.SetHistory(sessionKey, initialHistory)
|
||||
agent.Sessions.SetSummary(sessionKey, "old summary")
|
||||
@@ -154,9 +155,10 @@ func TestTurnProfile_HistoryOffSuppressesHistoryAndPersistence(t *testing.T) {
|
||||
al := newTurnProfileAgentLoop(t, cfg, provider)
|
||||
agent := al.GetRegistry().GetDefaultAgent()
|
||||
sessionKey := "agent:default:test-history-off"
|
||||
ts := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
initialHistory := []providers.Message{
|
||||
{Role: "user", Content: "old user"},
|
||||
{Role: "assistant", Content: "old assistant"},
|
||||
{Role: "user", Content: "old user", CreatedAt: &ts},
|
||||
{Role: "assistant", Content: "old assistant", CreatedAt: &ts},
|
||||
}
|
||||
agent.Sessions.SetHistory(sessionKey, initialHistory)
|
||||
agent.Sessions.SetSummary(sessionKey, "old summary")
|
||||
|
||||
Reference in New Issue
Block a user