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

Encapsulate valid label fetching to `FlaggableElement`

Open fozziethebeat opened this issue 3 years ago • 1 comments

Closes #584

This creates a new api route /api/valid_labels that returns the list of valid labels that can apply to any message.

FlaggableElement is updated to dynamically fetch labels from the new route and cache them. This allows FlaggableElement to be used anywhere without needing to pipe in the valid labels from call sites. This still calls the api route once per page load.

fozziethebeat avatar Jan 10 '23 11:01 fozziethebeat

Blocking on #590 before marking ready for review so I can merge.

fozziethebeat avatar Jan 10 '23 12:01 fozziethebeat

I see code 422 (unprocessable entity) responses when submitting the label report on the rank pages, is this expected? Also I get the same on the labeling pages (but I'm not sure is we are planning to have the flags there).

othrayte avatar Jan 11 '23 07:01 othrayte

Good catch, I didn't catch that. Fixed now

fozziethebeat avatar Jan 11 '23 07:01 fozziethebeat

Posted #614 as a future cleanup around messages. The types are pretty confusing and different depending on use case.

fozziethebeat avatar Jan 11 '23 07:01 fozziethebeat