Skip to content

Commit

Permalink
Merge branch 'main' into Fix/DB_Session
Browse files Browse the repository at this point in the history
  • Loading branch information
shincap8 authored Sep 13, 2024
2 parents ed88e2b + 89aa3b3 commit c6bfd0e
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ const SelectBetweenImagesGenerative: FC<
const [showImages, setShowImages] = useState<any[]>([]);
const [isMobile, setIsMobile] = useState(false);
const [artifactsInput, setArtifactsInput] = useState<any>(
generative_context.artifacts,
generative_context.artifacts
);
const [prompt, setPrompt] = useState(
"Type your prompt here (e.g. a kid sleeping in a red pool of paint)",
"People from {region} doing a {local activity}. Eg. 'Old Bhopalis sitting near 10 number market'."
);
const { post, response } = useFetch();
const { user } = useContext(UserContext);
const { modelInputs, metadataExample, updateModelInputs } = useContext(
CreateInterfaceContext,
CreateInterfaceContext
);
const neccessaryFields = ["original_prompt"];
const [selectedImage, setSelectedImage] = useState<string>("");
Expand All @@ -54,7 +54,7 @@ const SelectBetweenImagesGenerative: FC<
{
task_id: taskId,
user_id: user.id,
},
}
);
if (response.ok) {
setPromptHistory(history);
Expand Down Expand Up @@ -83,7 +83,7 @@ const SelectBetweenImagesGenerative: FC<

const saveHistoricalData = async (
text: string,
setPromptHistory: (value: any[]) => void,
setPromptHistory: (value: any[]) => void
) => {
const history = await post("/historical_data/save_historical_data", {
task_id: taskId,
Expand All @@ -110,7 +110,7 @@ const SelectBetweenImagesGenerative: FC<
task_id: taskId,
user_id: user.id,
data: prompt.trim(),
},
}
);
if (checkIfPromptExistsForUser) {
setFirstMessageReceived(true);
Expand All @@ -125,15 +125,15 @@ const SelectBetweenImagesGenerative: FC<
body: JSON.stringify({
task_id: taskId,
}),
},
}
);

const promptWithMoreThanOneHundredSubmissions =
await responseHistory.json();

const checkIfPromptIsInOccurrences =
promptWithMoreThanOneHundredSubmissions.some(
(item: any) => item === prompt.trim(),
(item: any) => item === prompt.trim()
);
if (checkIfPromptIsInOccurrences) {
Swal.fire({
Expand All @@ -151,7 +151,7 @@ const SelectBetweenImagesGenerative: FC<
neccessaryFields.every(
(item) =>
modelInputs.hasOwnProperty(item) ||
metadataExample.hasOwnProperty(item),
metadataExample.hasOwnProperty(item)
)
) {
setShowLoader(true);
Expand All @@ -174,7 +174,7 @@ const SelectBetweenImagesGenerative: FC<
prompt_with_more_than_one_hundred: checkIfPromptIsInOccurrences,
},
}),
},
}
);

const imagesHttp = await response.json();
Expand Down Expand Up @@ -212,7 +212,7 @@ const SelectBetweenImagesGenerative: FC<
{
round_id: realRoundId,
user_id: user.id,
},
}
);
} else {
Swal.fire({
Expand Down Expand Up @@ -270,7 +270,7 @@ const SelectBetweenImagesGenerative: FC<
prompt_with_more_than_one_hundred: checkIfPromptIsInOccurrences,
},
}),
},
}
);

const imagesHttp = await response.json();
Expand Down Expand Up @@ -325,7 +325,7 @@ const SelectBetweenImagesGenerative: FC<
user_id: user.id,
round_id: realRoundId,
task_id: taskId,
},
}
);
if (response.ok) {
setPartialSampleId(partialSampleId.id);
Expand Down

0 comments on commit c6bfd0e

Please sign in to comment.