mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-09-11 11:50:17 +08:00
fix: pre-commit errors
This commit is contained in:
@@ -42,7 +42,12 @@ export const FlaggableElement = (props) => {
|
|||||||
label_map.set(flag.attributeName, sliderValues[i]);
|
label_map.set(flag.attributeName, sliderValues[i]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
trigger({ message_id: props.message_id, post_id: props.post_id, label_map: Object.fromEntries(label_map), text: props.text });
|
trigger({
|
||||||
|
message_id: props.message_id,
|
||||||
|
post_id: props.post_id,
|
||||||
|
label_map: Object.fromEntries(label_map),
|
||||||
|
text: props.text,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
const [checkboxValues, setCheckboxValues] = useState(new Array(TEXT_LABEL_FLAGS.length).fill(false));
|
const [checkboxValues, setCheckboxValues] = useState(new Array(TEXT_LABEL_FLAGS.length).fill(false));
|
||||||
const [sliderValues, setSliderValues] = useState(new Array(TEXT_LABEL_FLAGS.length).fill(1));
|
const [sliderValues, setSliderValues] = useState(new Array(TEXT_LABEL_FLAGS.length).fill(1));
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ const handler = async (req, res) => {
|
|||||||
res.status(401).end();
|
res.status(401).end();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse out the local message_id, task ID and the interaction contents.
|
// Parse out the local message_id, task ID and the interaction contents.
|
||||||
const { message_id, post_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`, {
|
const interactionRes = await fetch(`${process.env.FASTAPI_URL}/api/v1/text_labels`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -24,16 +24,15 @@ const handler = async (req, res) => {
|
|||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
"type": "text_labels",
|
type: "text_labels",
|
||||||
"message_id": message_id,
|
message_id: message_id,
|
||||||
"labels": label_map,
|
labels: label_map,
|
||||||
"text": text,
|
text: text,
|
||||||
"user": {
|
user: {
|
||||||
"id": token.sub,
|
id: token.sub,
|
||||||
"display_name": token.name || token.email,
|
display_name: token.name || token.email,
|
||||||
"auth_method": "local",
|
auth_method: "local",
|
||||||
}
|
},
|
||||||
|
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
res.status(interactionRes.status).end();
|
res.status(interactionRes.status).end();
|
||||||
|
|||||||
Reference in New Issue
Block a user