refactor: implement off-hours handoff logic and enhance related tests

This commit is contained in:
mlogclub
2026-05-08 23:26:25 +08:00
parent 6f4c026320
commit 664e418115
6 changed files with 254 additions and 4 deletions
+14
View File
@@ -360,6 +360,20 @@ func (s *conversationService) HandoffByAI(conversationID int64, aiAgent models.A
return err
}
func (s *conversationService) TryOffHoursHandoffByAI(conversationID int64, aiAgent models.AIAgent, reason string) (bool, error) {
if conversationID <= 0 {
return false, errorsx.InvalidParam("会话不存在")
}
handled, err := ConversationHumanDispatchService.TryOffHoursHandoffByAI(conversationID, aiAgent, reason)
if err != nil {
slog.Warn("off-hours ai handoff failed",
"conversation_id", conversationID,
"ai_agent_id", aiAgent.ID,
"error", err)
}
return handled, err
}
func (s *conversationService) CloseConversation(conversationID int64, closeReason string, operator *dto.AuthPrincipal) error {
if operator == nil {
return errorsx.Unauthorized("未登录或登录已过期")