Skip to content

Commit

Permalink
chore: revert AI checker
Browse files Browse the repository at this point in the history
  • Loading branch information
rimorin authored Dec 12, 2024
1 parent 4b8e2c4 commit 041fed3
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions src/components/modal/updatestatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,36 +99,36 @@ const UpdateUnitStatus = NiceModal.create(
const rollbar = useRollbar();
const posthog = usePostHog();

const checkIfNotesAreSensitive = async (note: string) => {
// Return early if note is not provided or matches unitDetails.note
if (!note || note === unitDetails?.note) {
return false;
}
setCheckingNotes(true);
try {
const modal = getGenerativeModel(ai, AI_SETTINGS);
const result = await modal.generateContent(note);
const text = result.response.text();
const json = JSON.parse(text);
if (json.containsPersonalInfo) {
posthog?.capture("sensitive_note_submission", {
note: note,
reason: json.reason,
publisherName
});
rollbar.warn(
`Note submission rejected: ${json.reason}. Note content: ${note}`
);
alert(json.recommendation);
}
return json.containsPersonalInfo;
} catch (error) {
errorHandler(error, rollbar, true);
return false;
} finally {
setCheckingNotes(false);
}
};
// const checkIfNotesAreSensitive = async (note: string) => {
// // Return early if note is not provided or matches unitDetails.note
// if (!note || note === unitDetails?.note) {
// return false;
// }
// setCheckingNotes(true);
// try {
// const modal = getGenerativeModel(ai, AI_SETTINGS);
// const result = await modal.generateContent(note);
// const text = result.response.text();
// const json = JSON.parse(text);
// if (json.containsPersonalInfo) {
// posthog?.capture("sensitive_note_submission", {
// note: note,
// reason: json.reason,
// publisherName
// });
// rollbar.warn(
// `Note submission rejected: ${json.reason}. Note content: ${note}`
// );
// alert(json.recommendation);
// }
// return json.containsPersonalInfo;
// } catch (error) {
// errorHandler(error, rollbar, true);
// return false;
// } finally {
// setCheckingNotes(false);
// }
// };

const handleSubmitClick = async (event: FormEvent<HTMLElement>) => {
event.preventDefault();
Expand Down Expand Up @@ -159,9 +159,9 @@ const UpdateUnitStatus = NiceModal.create(
}
try {
setIsSaving(true);
if (await checkIfNotesAreSensitive(updateData.note as string)) {
return;
}
// if (await checkIfNotesAreSensitive(updateData.note as string)) {
// return;
// }
await pollingVoidFunction(() =>
update(
ref(
Expand Down

0 comments on commit 041fed3

Please sign in to comment.