Skip to content

Commit 98580ce

Browse files
CopilotJunyi-99
andauthored
fix: UpdatedAt timestamp not updating when appending messages to branches (#80)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Junyi-99 <[email protected]>
1 parent 175a717 commit 98580ce

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/api/chat/create_conversation_message_stream_v2.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package chat
22

33
import (
44
"context"
5+
"time"
6+
57
"paperdebugger/internal/api/mapper"
68
"paperdebugger/internal/libs/contextutil"
79
"paperdebugger/internal/libs/shared"
@@ -193,6 +195,7 @@ func (s *ChatServerV2) appendConversationMessage(
193195
// Append to the active branch
194196
activeBranch.InappChatHistory = append(activeBranch.InappChatHistory, bsonMsg)
195197
activeBranch.OpenaiChatHistoryCompletion = append(activeBranch.OpenaiChatHistoryCompletion, userOaiMsg)
198+
activeBranch.UpdatedAt = bson.NewDateTimeFromTime(time.Now())
196199

197200
if err := s.chatServiceV2.UpdateConversationV2(conversation); err != nil {
198201
return nil, nil, err
@@ -332,6 +335,7 @@ func (s *ChatServerV2) CreateConversationMessageStream(
332335
}
333336
activeBranch.InappChatHistory = append(activeBranch.InappChatHistory, bsonMessages...)
334337
activeBranch.OpenaiChatHistoryCompletion = openaiChatHistory
338+
activeBranch.UpdatedAt = bson.NewDateTimeFromTime(time.Now())
335339
if err := s.chatServiceV2.UpdateConversationV2(conversation); err != nil {
336340
return s.sendStreamError(stream, err)
337341
}

0 commit comments

Comments
 (0)