mail icon indicating copy to clipboard operation
mail copied to clipboard

AI email summary includes prompt

Open 1358 opened this issue 7 months ago • 4 comments

Steps to reproduce

Let the mail app generate some mail summary.

Expected behavior

There should only be the actual summary be shown

Actual behavior

The AI Summary includes information from the Prompt and/or "-signs: main - INFO - {'output': 'Here is a helpful summary of the email message in under 160 characters:\n\n"Reminder: Review and update something by end of week."'}

Mail app version

5.1.3

Nextcloud version

31.0.6

Mailserver or service

No response

Operating system

No response

PHP engine version

None

Nextcloud memory caching

No response

Web server

None

Database

None

Additional info

No response

1358 avatar Jun 16 '25 09:06 1358

I added Output *ONLY* the Summary itself, leave out any introduction. to the Prompt here https://github.com/nextcloud/mail/blob/ee21dccc3d517eb5e9a2c8fd6fb8fd588ac73382/lib/Service/AiIntegrations/AiIntegrationsService.php#L100 (and asked to summarize in a specific language) which seems to successfully solve this issue.

Would be nice if these Prompts were accessible on in the AI admin settings

Is there a way to reset already existing summaries and force the mail app to re-summerize all mails?

1358 avatar Jun 16 '25 13:06 1358

Thanks for your bug report 👍

Sounds reasonable to update the prompt like that. Could you send a pr?

Is there a way to reset already existing summaries

Only by clearing the cache.

kesselb avatar Jun 17 '25 12:06 kesselb

Would be nice if these Prompts were accessible on in the AI admin settings

Logged a feature request for it https://github.com/nextcloud/mail/issues/11285.

kesselb avatar Jun 17 '25 12:06 kesselb

Is there a way to reset already existing summaries and force the mail app to re-summerize all mails?

@1358 Yes, you can clear the memory cache. In case you want to only clear the keys corresponding to the mail summaries you can only delete the ones containing the string mail.ai.

Redis example: redis-cli keys '*mail.ai*' | xargs -d '\n' redis-cli del

st3iny avatar Jun 17 '25 12:06 st3iny

Sounds reasonable to update the prompt like that. Could you send a pr?

Sure :)

Is there a way to reset already existing summaries

Only by clearing the cache.

Redis example: redis-cli keys '*mail.ai*' | xargs -d '\n' redis-cli del

Hm, this seems to only affect the quick-replies and the thread-summary, not the message summary shown in the message list below the subject. Digging into the db update public.oc_mail_messages set summary = null where summary is not null; removes the summaries from the message list but they are not re-generated afterwards. Is there anything else needed to reset this?

1358 avatar Jun 26 '25 08:06 1358

Looking at https://github.com/nextcloud/mail/pull/10465, it appears that the AI summaries are only triggered when a message is detected for the first time. It may work to move the message to a different folder. Otherwise, remove the account and add again.

kesselb avatar Jun 26 '25 09:06 kesselb