When using moderation an error will be thrown when a prompt is flagged.
In issue
https://www.drupal.org/project/ai_provider_openai/issues/3507407
✨
Log flagged prompts
Active
there's already a logging mechanism but the error is still thrown so it's not very user friendly.
It seems better to not throw an error but log the flagged prompt in a separate overview that can be used to track down the related entity (if there is any) so a content manager can review the flagged prompt and rewrite the piece of content.
I am aware this is only needed when using moderation with entities and not when it is used for manual prompting so I think it's up for discussion to include this or not.
An option in the config form to enable moderation logging so every flagged prompt will be added to an overview where a content manager can review the specific linked content and adjust the content so it passes moderation. When the content has passed moderation, the log should be removed from the overview (on cron or on save) and if the flag is still present, the log will be updated.
A change in the ai_search is also needed for this approach.
- Create an extra option on the config form to enable/disable moderation logging
- Add a new Moderation Log entity
- Create an overview
- Make sure a new log entity is added and managed when a prompt is flagged
An extra overview for moderation logs will be available.
An extra Moderation Log entity will be installed.
Active
1.1
Code