feat: implement runtime reply service and refactor related components

This commit is contained in:
mlogclub
2026-04-12 23:37:52 +08:00
parent 6499126f40
commit 93cda6ae82
9 changed files with 502 additions and 382 deletions
+30
View File
@@ -0,0 +1,30 @@
package runtime
import (
"cs-agent/internal/models"
"cs-agent/internal/pkg/enums"
"github.com/mlogclub/simple/common/strs"
)
type replyEligibility struct{}
func newReplyEligibility() *replyEligibility {
return &replyEligibility{}
}
func (e *replyEligibility) CanReply(conversation models.Conversation, message models.Message, aiAgent models.AIAgent) bool {
if message.SenderType != enums.IMSenderTypeCustomer {
return false
}
if conversation.HandoffAt != nil || conversation.CurrentAssigneeID > 0 {
return false
}
if aiAgent.ServiceMode == enums.IMConversationServiceModeHumanOnly {
return false
}
if strs.IsBlank(message.Content) {
return false
}
return true
}