mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-07-19 11:20:04 +08:00
Ensuring the flagging post has a message or post id
This commit is contained in:
@@ -16,7 +16,7 @@ export function MessageTableEntry(props: MessageTableEntryProps) {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<FlaggableElement text={item.text} post_id={item.id} key={`flag_${item.id}`}>
|
||||
<FlaggableElement text={item.text} message_id={item.message_id} post_id={item.id} key={`flag_${item.id}`}>
|
||||
<HStack>
|
||||
<Avatar
|
||||
size="sm"
|
||||
|
||||
@@ -6,7 +6,7 @@ import { withoutRole } from "src/lib/auth";
|
||||
*/
|
||||
const handler = withoutRole("banned", async (req, res, token) => {
|
||||
// Parse out the local message_id, task ID and the interaction contents.
|
||||
const { message_id, label_map, text } = await JSON.parse(req.body);
|
||||
const { message_id, post_id, label_map, text } = await JSON.parse(req.body);
|
||||
|
||||
const interactionRes = await fetch(`${process.env.FASTAPI_URL}/api/v1/text_labels`, {
|
||||
method: "POST",
|
||||
@@ -16,7 +16,7 @@ const handler = withoutRole("banned", async (req, res, token) => {
|
||||
},
|
||||
body: JSON.stringify({
|
||||
type: "text_labels",
|
||||
message_id: message_id,
|
||||
message_id: message_id || post_id,
|
||||
labels: label_map,
|
||||
text: text,
|
||||
user: {
|
||||
@@ -26,6 +26,10 @@ const handler = withoutRole("banned", async (req, res, token) => {
|
||||
},
|
||||
}),
|
||||
});
|
||||
if (interactionRes.status !== 204) {
|
||||
const r = await interactionRes.json();
|
||||
console.error(JSON.stringify(r));
|
||||
}
|
||||
res.status(interactionRes.status).end();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user