feat: aso add label for ai processed
This commit is contained in:
parent
56c9f764fc
commit
6de059dca7
3 changed files with 243 additions and 2 deletions
|
|
@ -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{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue