Skip to content

Commit

Permalink
fix: changes text in modify
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwisecodes committed Sep 24, 2024
1 parent 1ab164d commit d7e1cb1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { useLessonChat } from "@/components/ContextProviders/ChatProvider";
export type FeedbackOption<T> = {
label: string;
enumValue: T;
chatMessage: string;
};

export const DropDownFormWrapper = <
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,26 @@ import { DropDownFormWrapper, FeedbackOption } from "./drop-down-form-wrapper";
import { SmallRadioButton } from "./small-radio-button";

const modifyOptions = [
{ label: "Make it easier", enumValue: "MAKE_IT_EASIER" },
{ label: "Make it harder", enumValue: "MAKE_IT_HARDER" },
{ label: "Shorten content", enumValue: "SHORTEN_CONTENT" },
{ label: "Add more detail", enumValue: "ADD_MORE_DETAIL" },
{
label: "Make it easier",
enumValue: "MAKE_IT_EASIER",
chatMessage: "easier",
},
{
label: "Make it harder",
enumValue: "MAKE_IT_HARDER",
chatMessage: "harder",
},
{
label: "Shorten content",
enumValue: "SHORTEN_CONTENT",
chatMessage: "shorter",
},
{
label: "Add more detail",
enumValue: "ADD_MORE_DETAIL",
chatMessage: "more detailed",
},
{ label: "Other", enumValue: "OTHER" },
] as const;

Expand Down Expand Up @@ -63,9 +79,14 @@ const ModifyButton = ({
async function modifySection(
option: FeedbackOption<AilaUserModificationAction>,
) {
const message =
option.label === "Other"
? `For the ${sectionTitle}, ${userFeedbackText}`
: `Make the ${sectionTitle} ${option.chatMessage.toLowerCase()}`;

await Promise.all([
append({
content: `For the ${sectionTitle}, ${option.label === "Other" ? userFeedbackText : option.label}`,
content: message,
role: "user",
}),
recordUserModifySectionContent(),
Expand Down Expand Up @@ -136,10 +157,12 @@ function handleLabelText({
text: string;
section: string;
}): string {
console.log("section", section);
if (
section === "Misconceptions" ||
section === "Keyword learning points" ||
section === "Learning cycles"
section === "Key learning points" ||
section === "Learning cycles" ||
"additional materials"
) {
if (text.includes("it")) {
return text.replace("it", "them");
Expand Down

0 comments on commit d7e1cb1

Please sign in to comment.