Open-Assistant icon indicating copy to clipboard operation
Open-Assistant copied to clipboard

Add flagged_message table and admin management endpoints

Open andreaskoepf opened this issue 2 years ago • 4 comments

  • Create a "flagged_message" table with message_id (FK, ondelete="CASCADE" similar to emoji table, see here), processed boolean column (not null default false) and created_date datetime not null default current_timestamp & create alembic migration script
  • insert/update a row in flagged_message table whenever the red_flag emoji is added to the message, potentially in PromptRepository.handle_message_emoji() (this happen for text-label requests with is_report==True, see here). Check if there is an existing entry in the "flagged_message" table .. if found update it and set processed = False & created_date to current timestamp . (Do nothing when the flag is removed.)
  • Add GET /admin/flagged_messages/ REST endpoints to query unprocessed reported messages ordered by create_date (with max_count limit)
  • Add PUT /admin/flagged_messages/{message_id}/processed endpoint to mark the message as processed

Related issue: https://github.com/LAION-AI/Open-Assistant/issues/912

andreaskoepf avatar Jan 28 '23 14:01 andreaskoepf

Initial work on this has already been contributed by @GraemeHarris.

For a full solution we need now:

  • (backend): Paging for the flag queries
  • (web frontend): Admin pages to offer the backend functionality to the user

andreaskoepf avatar Feb 23 '23 11:02 andreaskoepf

Will dive into fleshing this out

GraemeHarris avatar Feb 23 '23 12:02 GraemeHarris

Since this issue was stale, I unassigned @GraemeHarris and set it to high prio.

andreaskoepf avatar Apr 17 '23 15:04 andreaskoepf

I will see if I redeem myself quickly! But if anyone does take it out sooner let me know :)

GraemeHarris avatar Apr 20 '23 16:04 GraemeHarris