feat: aso add label for ai processed
This commit is contained in:
@@ -136,6 +136,18 @@ func processEmails(imapClient *imap.IMAPClient, fetcher *fetcher.Fetcher, aiProc
|
||||
}
|
||||
logger.WithField("responseLength", len(response)).Debug("Generated AI response")
|
||||
|
||||
// Mark as AI-processed immediately to prevent reprocessing if subsequent steps fail
|
||||
if err := imapClient.MarkAsAIProcessed(email); err != nil {
|
||||
logger.WithFields(logrus.Fields{
|
||||
"subject": email.Subject,
|
||||
"error": err,
|
||||
}).Warn("Failed to mark email as AI-processed, continuing with draft save")
|
||||
// Continue anyway - if this fails, worst case is we might reprocess
|
||||
// But we want to try to save the draft we just generated
|
||||
} else {
|
||||
logger.Debug("Marked email as AI-processed")
|
||||
}
|
||||
|
||||
// Save as draft
|
||||
if err := imapClient.SaveDraft(email, response); err != nil {
|
||||
logger.WithFields(logrus.Fields{
|
||||
|
||||
Reference in New Issue
Block a user