Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
am-bean committed Aug 21, 2024
2 parents a3bdc55 + b56c737 commit b13533c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions backend/app/domain/services/base/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def get_validate_configuration(self, task_id: int) -> dict:
context_info = {
"validation_user_input": config_yaml.get("validation_user_input"),
"validation_context": config_yaml.get("validation_context"),
"validation_options": config_yaml.get("validation_options"),
}
return context_info

Expand Down
4 changes: 3 additions & 1 deletion backend/app/infrastructure/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@ class Validation(Base):
id = Column(Integer, primary_key=True)
uid = Column(ForeignKey("users.id"), index=True)
eid = Column(ForeignKey("examples.id"), nullable=False, index=True)
label = Column(Enum("flagged", "correct", "incorrect", "placeholder"))
label = Column(
Enum("flagged", "correct", "incorrect", "placeholder", "safe", "unsafe")
)
mode = Column(Enum("user", "owner"))
metadata_json = Column(Text)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const SelectMultipleTextMultipleTags: FC<
setLoading2(true);
setSelectionInfo([]);
fetch(
`${process.env.REACT_APP_API_HOST_2}/context/get_random_context_from_key_value/`,
`${process.env.REACT_APP_API_HOST_2}/context/get_random_context_from_key_value`,
{
method: "POST",
headers: {
Expand Down Expand Up @@ -156,7 +156,7 @@ const SelectMultipleTextMultipleTags: FC<
const newSelectionInfo = cleanUpSelection(selectionInfo, "color");
const sendText = text;
setText(undefined);
await post("/example/create_example/", {
await post("/example/create_example", {
context_id: contextId,
user_id: userId,
input_json: { labels: newSelectionInfo },
Expand Down Expand Up @@ -262,7 +262,7 @@ const SelectMultipleTextMultipleTags: FC<
</div>
</div>
<TokenAnnotator
tokens={text.split(" ")}
tokens={text.split(/\s/g)}
value={selectionInfo}
onChange={(value) => handleChange(value)}
getSpan={(span) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,13 @@ const ValidateSamples: FC = () => {
)}
<RadioButton
instructions="Actions"
options={["πŸ‘ Correct", "πŸ‘Ž Incorrect", "🚩 Flag"]}
options={
validationConfigInfo.validation_options || [
"πŸ‘ Correct",
"πŸ‘Ž Incorrect",
"🚩 Flag",
]
}
field_name_for_the_model="label"
onInputChange={(input) => {
setLabel(input.label);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type ConfigurationTask = {
export type ValidationConfigurationTask = {
validation_user_input: object[];
validation_context: object[];
validation_options?: string[];
};

type ModelOutput = {
Expand Down

0 comments on commit b13533c

Please sign in to comment.