fix: prevent repeated off-hours handoff notices
This commit is contained in:
@@ -52,6 +52,9 @@ func (g *HandoffGraph) Run(ctx context.Context, argumentsInJSON string) (string,
|
||||
}
|
||||
handled, err := services.ConversationService.TryOffHoursHandoffByAI(g.conversation.ID, g.aiAgent, reason)
|
||||
if err != nil || handled {
|
||||
if handled && err == nil {
|
||||
return services.HandoffOffHoursMessage, nil
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
info := HandoffGraphInterruptInfo{
|
||||
|
||||
@@ -25,8 +25,8 @@ func TestHandoffGraphOffHoursSendsNoticeWithoutConfirmation(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Run() error = %v", err)
|
||||
}
|
||||
if reply != "" {
|
||||
t.Fatalf("expected no graph reply, got %q", reply)
|
||||
if reply != services.HandoffOffHoursMessage {
|
||||
t.Fatalf("expected off-hours graph reply, got %q", reply)
|
||||
}
|
||||
|
||||
message := services.MessageService.FindOne(sqls.NewCnd().Eq("conversation_id", conversation.ID).Desc("id"))
|
||||
|
||||
Reference in New Issue
Block a user