feat: enhance event consumption logic and add success reply handling

This commit is contained in:
mlogclub
2026-04-14 19:05:05 +08:00
parent 1f894ef7f0
commit 3cdd31786a
6 changed files with 103 additions and 2 deletions
+29
View File
@@ -0,0 +1,29 @@
package services
import (
"testing"
"time"
"cs-agent/internal/models"
"cs-agent/internal/pkg/enums"
)
func TestAllowAIMessageOnPendingHandoff(t *testing.T) {
conversation := &models.Conversation{
Status: enums.IMConversationStatusPending,
CurrentAssigneeID: 0,
HandoffAt: ptrTime(time.Now()),
}
if !allowAIMessageOnPendingHandoff(conversation) {
t.Fatalf("expected pending handoff conversation to allow ai handoff notice")
}
conversation.Status = enums.IMConversationStatusAIServing
if allowAIMessageOnPendingHandoff(conversation) {
t.Fatalf("expected ai serving conversation not to use pending handoff allowance")
}
}
func ptrTime(v time.Time) *time.Time {
return &v
}