@nualang/nualang-ui-components 0.1.1376 → 0.1.1377
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Dialogs/GenerateBot/GenerateBot.js +55 -4
- package/dist/Dialogs/GenerateRoleplay/GenerateRoleplay.js +113 -79
- package/dist/Editors/Bot/Bot.js +2 -0
- package/dist/Editors/Bot/Editor/Editor.js +2 -0
- package/dist/Editors/PhraseList/PhraseList.js +4 -0
- package/dist/Editors/Roleplay/Roleplay.js +2 -0
- package/dist/Forms/UpdatePhraseList/UpdatePhraseList.js +71 -39
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
|
-
import { Grid, Box, FormControlLabel, Switch, Typography, Slider, TextField, InputAdornment, Tooltip } from "@mui/material";
|
|
2
|
+
import { Grid, Box, FormControlLabel, Switch, Typography, Slider, TextField, InputAdornment, Tooltip, Checkbox, ListItemText, OutlinedInput, Select, InputLabel, FormControl, MenuItem } from "@mui/material";
|
|
3
3
|
import InfoIcon from "@mui/icons-material/Info";
|
|
4
4
|
import Alert from "@mui/material/Alert";
|
|
5
5
|
import LinearProgress from "@mui/material/LinearProgress";
|
|
@@ -51,10 +51,12 @@ function GenerateBotDialog({
|
|
|
51
51
|
bot,
|
|
52
52
|
siteLanguage,
|
|
53
53
|
topicPhrases,
|
|
54
|
+
phraseLists,
|
|
54
55
|
updateRivescriptJSON,
|
|
55
56
|
initialTopicGoal
|
|
56
57
|
}) {
|
|
57
58
|
const [usePhrasesContext, setUsePhrasesContext] = useState(true);
|
|
59
|
+
const [selectedPhraseListIds, setSelectedPhraseListIds] = useState(["all"]);
|
|
58
60
|
const [topicGoal, setTopicGoal] = useState("");
|
|
59
61
|
const [phrases, setPhrases] = useState([]);
|
|
60
62
|
const [isBotGenerating, setIsBotGenerating] = useState(false);
|
|
@@ -84,9 +86,24 @@ function GenerateBotDialog({
|
|
|
84
86
|
setPhrases([...topicPhrases]);
|
|
85
87
|
}
|
|
86
88
|
}, [initialTopicGoal, topicPhrases]);
|
|
89
|
+
const isPhrasesSwitchDisabled = phrases.length === 0 || !phraseLists || phraseLists.length === 0 || !phraseLists.some(pl => pl.phrases && pl.phrases.length > 0);
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
if (isPhrasesSwitchDisabled) {
|
|
92
|
+
setUsePhrasesContext(false);
|
|
93
|
+
}
|
|
94
|
+
}, [isPhrasesSwitchDisabled]);
|
|
87
95
|
const handleCloseDialog = () => {
|
|
88
96
|
setIsGenerateBotDialogOpen(false);
|
|
89
97
|
};
|
|
98
|
+
const effectivePhrases = !phraseLists || phraseLists.length === 0 || selectedPhraseListIds.includes("all") ? phrases : phraseLists.filter(pl => selectedPhraseListIds.includes(pl.id)).flatMap(pl => pl.phrases);
|
|
99
|
+
const handlePhraseListChange = event => {
|
|
100
|
+
const newValue = event.target.value;
|
|
101
|
+
if (newValue[newValue.length - 1] === "all") {
|
|
102
|
+
setSelectedPhraseListIds(["all"]);
|
|
103
|
+
} else {
|
|
104
|
+
setSelectedPhraseListIds(newValue.filter(v => v !== "all"));
|
|
105
|
+
}
|
|
106
|
+
};
|
|
90
107
|
|
|
91
108
|
// const removeExtraTextFromChatGptResponse = (response) => {
|
|
92
109
|
// let stack = [];
|
|
@@ -170,7 +187,7 @@ function GenerateBotDialog({
|
|
|
170
187
|
siteLanguage: siteLanguage,
|
|
171
188
|
difficulty: bot.difficulty,
|
|
172
189
|
sampleQuestionArray: sampleQuestionArray,
|
|
173
|
-
phrases:
|
|
190
|
+
phrases: effectivePhrases,
|
|
174
191
|
usePhrasesContext: usePhrasesContext
|
|
175
192
|
}
|
|
176
193
|
});
|
|
@@ -336,7 +353,7 @@ function GenerateBotDialog({
|
|
|
336
353
|
label: "",
|
|
337
354
|
control: /*#__PURE__*/_jsx(_Fragment, {
|
|
338
355
|
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
339
|
-
title:
|
|
356
|
+
title: isPhrasesSwitchDisabled ? t("topic_no_phrases") : "",
|
|
340
357
|
children: /*#__PURE__*/_jsx("span", {
|
|
341
358
|
children: /*#__PURE__*/_jsx(Switch, {
|
|
342
359
|
checked: usePhrasesContext,
|
|
@@ -349,12 +366,46 @@ function GenerateBotDialog({
|
|
|
349
366
|
sx: {
|
|
350
367
|
marginLeft: 0.5
|
|
351
368
|
},
|
|
352
|
-
disabled:
|
|
369
|
+
disabled: isPhrasesSwitchDisabled
|
|
353
370
|
})
|
|
354
371
|
})
|
|
355
372
|
})
|
|
356
373
|
})
|
|
357
374
|
})]
|
|
375
|
+
}), usePhrasesContext && phraseLists && phraseLists.length > 0 && /*#__PURE__*/_jsx(Grid, {
|
|
376
|
+
mb: 2,
|
|
377
|
+
size: 12,
|
|
378
|
+
mt: 2,
|
|
379
|
+
children: /*#__PURE__*/_jsxs(FormControl, {
|
|
380
|
+
fullWidth: true,
|
|
381
|
+
size: "small",
|
|
382
|
+
children: [/*#__PURE__*/_jsx(InputLabel, {
|
|
383
|
+
children: t("phrase_lists")
|
|
384
|
+
}), /*#__PURE__*/_jsxs(Select, {
|
|
385
|
+
multiple: true,
|
|
386
|
+
value: selectedPhraseListIds,
|
|
387
|
+
onChange: handlePhraseListChange,
|
|
388
|
+
input: /*#__PURE__*/_jsx(OutlinedInput, {
|
|
389
|
+
label: t("phrase_lists")
|
|
390
|
+
}),
|
|
391
|
+
renderValue: selected => selected.includes("all") ? t("all") : phraseLists.filter(pl => selected.includes(pl.id)).map(pl => pl.name).join(", "),
|
|
392
|
+
children: [/*#__PURE__*/_jsxs(MenuItem, {
|
|
393
|
+
value: "all",
|
|
394
|
+
children: [/*#__PURE__*/_jsx(Checkbox, {
|
|
395
|
+
checked: selectedPhraseListIds.includes("all")
|
|
396
|
+
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
397
|
+
primary: t("all")
|
|
398
|
+
})]
|
|
399
|
+
}), phraseLists.map(pl => /*#__PURE__*/_jsxs(MenuItem, {
|
|
400
|
+
value: pl.id,
|
|
401
|
+
children: [/*#__PURE__*/_jsx(Checkbox, {
|
|
402
|
+
checked: selectedPhraseListIds.includes(pl.id)
|
|
403
|
+
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
404
|
+
primary: pl.name
|
|
405
|
+
})]
|
|
406
|
+
}, pl.id))]
|
|
407
|
+
})]
|
|
408
|
+
})
|
|
358
409
|
})]
|
|
359
410
|
}), errorMessage && /*#__PURE__*/_jsx(Grid, {
|
|
360
411
|
mt: 2,
|
|
@@ -4,7 +4,7 @@ import { jsonrepair } from "jsonrepair";
|
|
|
4
4
|
import RemoveRedEyeOutlinedIcon from "@mui/icons-material/RemoveRedEyeOutlined";
|
|
5
5
|
import AutoFixHighIcon from "@mui/icons-material/AutoFixHigh";
|
|
6
6
|
import InfoIcon from "@mui/icons-material/Info";
|
|
7
|
-
import { Grid, Button, Box, TextField, MenuItem, IconButton, FormControlLabel, Switch, Typography, Tooltip,
|
|
7
|
+
import { Grid, Button, Box, TextField, MenuItem, IconButton, FormControlLabel, Switch, Typography, Tooltip, Slider, InputAdornment, Checkbox, ListItemText, OutlinedInput, Select, InputLabel, FormControl } from "@mui/material";
|
|
8
8
|
import LoadingButton from "@mui/lab/LoadingButton";
|
|
9
9
|
import Alert from "@mui/material/Alert";
|
|
10
10
|
import LinearProgress from "@mui/material/LinearProgress";
|
|
@@ -53,12 +53,14 @@ function GenerateRoleplayDialog({
|
|
|
53
53
|
pdfVectorStoreCreationStatus,
|
|
54
54
|
siteLanguage,
|
|
55
55
|
phrases,
|
|
56
|
+
phraseLists,
|
|
56
57
|
topicId,
|
|
57
58
|
initialTopicGoal
|
|
58
59
|
}) {
|
|
59
60
|
const [isPreviewDialogOpen, setIsPreviewDialogOpen] = useState(false);
|
|
60
61
|
const [usePdfContext, setUsePdfContext] = useState(false);
|
|
61
62
|
const [usePhrasesContext, setUsePhrasesContext] = useState(phrases && phrases.length > 0);
|
|
63
|
+
const [selectedPhraseListIds, setSelectedPhraseListIds] = useState(["all"]);
|
|
62
64
|
const [topicGoal, setTopicGoal] = useState("");
|
|
63
65
|
const [isRoleplayGenerating, setIsRoleplayGenerating] = useState(false);
|
|
64
66
|
const [generatedRoleplay, setGeneratedRoleplay] = useState([]);
|
|
@@ -176,7 +178,7 @@ function GenerateRoleplayDialog({
|
|
|
176
178
|
const roleplayDifficulty = values.roleplayDifficulty;
|
|
177
179
|
const basePrompt = usePdfContext ? `Create an informative conversation between 2 people ${values?.actor1?.name && values?.actor2?.name ? `'${values.actor1.name}' and '${values.actor2.name}' ` : ""} about the topic '${values.roleplayTopic}' in the language ${learnLang}. The conversation should be ${i18nLanguage === "en-US" ? "ACTFL" : "CEFR"} level '${t(roleplayDifficulty)}.'` : `Create a conversation between 2 people ${values?.actor1?.name && values?.actor2?.name ? `'${values.actor1.name}' and '${values.actor2?.name}' ` : ""} about the topic '${values.roleplayTopic}' in the language ${learnLang}. The conversation should be ${i18nLanguage === "en-US" ? "ACTFL" : "CEFR"} level '${t(roleplayDifficulty)}.'`;
|
|
178
180
|
const topicGoalPrompt = topicGoal ? ` The conversation should be guided by the following goal: '${topicGoal}'.` : "";
|
|
179
|
-
const promptWithPhrases = usePhrasesContext ? ` Additionally, use the following phrases as part of the conversation, where appropriate to the topic '${values.roleplayTopic}': ${
|
|
181
|
+
const promptWithPhrases = usePhrasesContext ? ` Additionally, use the following phrases as part of the conversation, where appropriate to the topic '${values.roleplayTopic}': ${effectivePhrases.map(phrase => phrase.phrase).join(", ")}. Only use these phrases if they fit naturally into the conversation.` : "";
|
|
180
182
|
const finalPrompt = `${basePrompt}${topicGoalPrompt}${promptWithPhrases}`;
|
|
181
183
|
|
|
182
184
|
// Add explicit JSON formatting instructions with roleplay length
|
|
@@ -213,7 +215,7 @@ function GenerateRoleplayDialog({
|
|
|
213
215
|
usePdfContext: usePdfContext,
|
|
214
216
|
topicGoal: topicGoal,
|
|
215
217
|
usePhrasesContext: usePhrasesContext,
|
|
216
|
-
phrases:
|
|
218
|
+
phrases: effectivePhrases,
|
|
217
219
|
questionLang: questionLang,
|
|
218
220
|
generateQuestions: generateQuestions,
|
|
219
221
|
actor1: values.actor1,
|
|
@@ -309,7 +311,18 @@ function GenerateRoleplayDialog({
|
|
|
309
311
|
} else {
|
|
310
312
|
isSubmitDisabled = !(generatedRoleplay.length !== 0 && !isRoleplayGenerating && previewMessages.length > 1);
|
|
311
313
|
}
|
|
312
|
-
const isPhrasesSwitchDisabled = !topicId || !phrases || phrases.length === 0;
|
|
314
|
+
const isPhrasesSwitchDisabled = !topicId || !phrases || phrases.length === 0 || !phraseLists || phraseLists.length === 0 || !phrases.some(p => phraseLists.some(pl => pl.id === p.phraseListId));
|
|
315
|
+
const effectivePhrases = !phraseLists || phraseLists.length === 0 || selectedPhraseListIds.includes("all") ? phrases : phrases.filter(p => selectedPhraseListIds.includes(p.phraseListId));
|
|
316
|
+
const handlePhraseListChange = event => {
|
|
317
|
+
const newValue = event.target.value;
|
|
318
|
+
if (newValue[newValue.length - 1] === "all") {
|
|
319
|
+
setSelectedPhraseListIds(["all"]);
|
|
320
|
+
} else if (newValue.filter(v => v !== "all").length === 0) {
|
|
321
|
+
setSelectedPhraseListIds(["all"]);
|
|
322
|
+
} else {
|
|
323
|
+
setSelectedPhraseListIds(newValue.filter(v => v !== "all"));
|
|
324
|
+
}
|
|
325
|
+
};
|
|
313
326
|
useEffect(() => {
|
|
314
327
|
if (!generateQuestions) {
|
|
315
328
|
setValues(prevValues => ({
|
|
@@ -323,6 +336,11 @@ function GenerateRoleplayDialog({
|
|
|
323
336
|
}));
|
|
324
337
|
}
|
|
325
338
|
}, [generateQuestions]);
|
|
339
|
+
useEffect(() => {
|
|
340
|
+
if (isPhrasesSwitchDisabled) {
|
|
341
|
+
setUsePhrasesContext(false);
|
|
342
|
+
}
|
|
343
|
+
}, [isPhrasesSwitchDisabled]);
|
|
326
344
|
return /*#__PURE__*/_jsxs(ResponsiveDialog, {
|
|
327
345
|
open: isGenerateRoleplayDialogOpen,
|
|
328
346
|
handleClose: handleCloseDialog,
|
|
@@ -468,47 +486,37 @@ function GenerateRoleplayDialog({
|
|
|
468
486
|
min: 4,
|
|
469
487
|
max: 12
|
|
470
488
|
})]
|
|
471
|
-
}), /*#__PURE__*/
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
children: /*#__PURE__*/
|
|
489
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
|
490
|
+
marginBottom: 1,
|
|
491
|
+
size: 12,
|
|
492
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
493
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
494
|
+
pt: 2,
|
|
476
495
|
display: "flex",
|
|
477
496
|
alignItems: "center",
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
})
|
|
488
|
-
|
|
489
|
-
display: "flex",
|
|
490
|
-
alignItems: "center",
|
|
491
|
-
children: [/*#__PURE__*/_jsx(Typography, {
|
|
492
|
-
children: t("generate_questions")
|
|
493
|
-
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
494
|
-
title: t("enable_gen_questions"),
|
|
495
|
-
placement: "top",
|
|
496
|
-
children: /*#__PURE__*/_jsx(InfoIcon, {
|
|
497
|
-
fontSize: "small",
|
|
498
|
-
style: {
|
|
499
|
-
marginLeft: 4,
|
|
500
|
-
color: "lightgrey"
|
|
501
|
-
} // Light grey color for info icon
|
|
502
|
-
})
|
|
503
|
-
})]
|
|
504
|
-
}),
|
|
505
|
-
labelPlacement: "start",
|
|
506
|
-
sx: {
|
|
507
|
-
marginRight: 0
|
|
508
|
-
}
|
|
509
|
-
})
|
|
497
|
+
children: [t("generate_questions"), /*#__PURE__*/_jsx(Tooltip, {
|
|
498
|
+
title: t("enable_gen_questions"),
|
|
499
|
+
placement: "top",
|
|
500
|
+
children: /*#__PURE__*/_jsx(InfoIcon, {
|
|
501
|
+
fontSize: "small",
|
|
502
|
+
style: {
|
|
503
|
+
marginLeft: 4,
|
|
504
|
+
color: "lightgrey"
|
|
505
|
+
}
|
|
506
|
+
})
|
|
507
|
+
})]
|
|
510
508
|
})
|
|
511
|
-
})
|
|
509
|
+
}), /*#__PURE__*/_jsx(FormControlLabel, {
|
|
510
|
+
label: "",
|
|
511
|
+
control: /*#__PURE__*/_jsx(Switch, {
|
|
512
|
+
checked: generateQuestions,
|
|
513
|
+
onChange: e => setGenerateQuestions(e.target.checked),
|
|
514
|
+
inputProps: {
|
|
515
|
+
"aria-label": "Generate Questions"
|
|
516
|
+
},
|
|
517
|
+
color: "primary"
|
|
518
|
+
})
|
|
519
|
+
})]
|
|
512
520
|
}), generateQuestions && /*#__PURE__*/_jsxs(_Fragment, {
|
|
513
521
|
children: [finalForLang !== learnLang.charAt(0).toUpperCase() + learnLang.slice(1) && /*#__PURE__*/_jsx(Grid, {
|
|
514
522
|
mb: 2,
|
|
@@ -549,48 +557,74 @@ function GenerateRoleplayDialog({
|
|
|
549
557
|
max: Math.floor(values?.roleplayLengthNumber / 2)
|
|
550
558
|
})]
|
|
551
559
|
})]
|
|
552
|
-
}), topicId && /*#__PURE__*/
|
|
553
|
-
children: /*#__PURE__*/
|
|
560
|
+
}), topicId && /*#__PURE__*/_jsxs(_Fragment, {
|
|
561
|
+
children: [/*#__PURE__*/_jsxs(Grid, {
|
|
554
562
|
marginBottom: 1,
|
|
555
563
|
size: 12,
|
|
556
|
-
children: /*#__PURE__*/_jsx(
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
564
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
565
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
566
|
+
pt: 2,
|
|
567
|
+
display: "flex",
|
|
568
|
+
alignItems: "center",
|
|
569
|
+
children: [t("use_topic_phrases"), /*#__PURE__*/_jsx(Tooltip, {
|
|
570
|
+
title: isPhrasesSwitchDisabled ? t("add_phrase_context") : t("enable_phrase_context"),
|
|
571
|
+
placement: "top",
|
|
572
|
+
children: /*#__PURE__*/_jsx(InfoIcon, {
|
|
573
|
+
fontSize: "small",
|
|
574
|
+
style: {
|
|
575
|
+
marginLeft: 4,
|
|
576
|
+
color: "lightgrey"
|
|
577
|
+
}
|
|
578
|
+
})
|
|
579
|
+
})]
|
|
580
|
+
})
|
|
581
|
+
}), /*#__PURE__*/_jsx(FormControlLabel, {
|
|
582
|
+
label: "",
|
|
583
|
+
control: /*#__PURE__*/_jsx(Switch, {
|
|
584
|
+
checked: usePhrasesContext,
|
|
585
|
+
onChange: e => setUsePhrasesContext(e.target.checked),
|
|
586
|
+
inputProps: {
|
|
587
|
+
"aria-label": "Use context from topic phrases"
|
|
588
|
+
},
|
|
589
|
+
color: "primary",
|
|
590
|
+
disabled: isPhrasesSwitchDisabled
|
|
591
|
+
})
|
|
592
|
+
})]
|
|
593
|
+
}), usePhrasesContext && phraseLists && phraseLists.length > 0 && /*#__PURE__*/_jsx(Grid, {
|
|
594
|
+
mb: 2,
|
|
595
|
+
size: 12,
|
|
596
|
+
mt: 2,
|
|
597
|
+
children: /*#__PURE__*/_jsxs(FormControl, {
|
|
598
|
+
fullWidth: true,
|
|
599
|
+
size: "small",
|
|
600
|
+
children: [/*#__PURE__*/_jsx(InputLabel, {
|
|
601
|
+
children: t("phrase_lists")
|
|
602
|
+
}), /*#__PURE__*/_jsxs(Select, {
|
|
603
|
+
multiple: true,
|
|
604
|
+
value: selectedPhraseListIds,
|
|
605
|
+
onChange: handlePhraseListChange,
|
|
606
|
+
input: /*#__PURE__*/_jsx(OutlinedInput, {
|
|
607
|
+
label: t("phrase_lists")
|
|
569
608
|
}),
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
children: [/*#__PURE__*/_jsx(
|
|
574
|
-
|
|
575
|
-
}), /*#__PURE__*/_jsx(
|
|
576
|
-
|
|
577
|
-
placement: "top",
|
|
578
|
-
children: /*#__PURE__*/_jsx(InfoIcon, {
|
|
579
|
-
fontSize: "small",
|
|
580
|
-
style: {
|
|
581
|
-
marginLeft: 4,
|
|
582
|
-
color: "lightgrey"
|
|
583
|
-
} // Light grey color for info icon
|
|
584
|
-
})
|
|
609
|
+
renderValue: selected => selected.includes("all") ? t("all") : phraseLists.filter(pl => selected.includes(pl.id)).map(pl => pl.name).join(", "),
|
|
610
|
+
children: [/*#__PURE__*/_jsxs(MenuItem, {
|
|
611
|
+
value: "all",
|
|
612
|
+
children: [/*#__PURE__*/_jsx(Checkbox, {
|
|
613
|
+
checked: selectedPhraseListIds.includes("all")
|
|
614
|
+
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
615
|
+
primary: t("all")
|
|
585
616
|
})]
|
|
586
|
-
}),
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
617
|
+
}), phraseLists.map(pl => /*#__PURE__*/_jsxs(MenuItem, {
|
|
618
|
+
value: pl.id,
|
|
619
|
+
children: [/*#__PURE__*/_jsx(Checkbox, {
|
|
620
|
+
checked: selectedPhraseListIds.includes(pl.id)
|
|
621
|
+
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
622
|
+
primary: pl.name
|
|
623
|
+
})]
|
|
624
|
+
}, pl.id))]
|
|
625
|
+
})]
|
|
592
626
|
})
|
|
593
|
-
})
|
|
627
|
+
})]
|
|
594
628
|
})]
|
|
595
629
|
}), import.meta.env.REACT_APP_STAGE === "dev" && !isRoleplayGenerating && pdfDetails && pdfVectorStoreCreationStatus === "CREATION_COMPLETE" && /*#__PURE__*/_jsxs(Grid, {
|
|
596
630
|
size: 12,
|
package/dist/Editors/Bot/Bot.js
CHANGED
|
@@ -106,6 +106,7 @@ function Bot({
|
|
|
106
106
|
generateRiveFile,
|
|
107
107
|
siteLanguage,
|
|
108
108
|
topicPhrases,
|
|
109
|
+
phraseLists,
|
|
109
110
|
courseId,
|
|
110
111
|
sectionId,
|
|
111
112
|
topicId,
|
|
@@ -766,6 +767,7 @@ function Bot({
|
|
|
766
767
|
learnLang: learnLang,
|
|
767
768
|
siteLanguage: siteLanguage,
|
|
768
769
|
topicPhrases: topicPhrases,
|
|
770
|
+
phraseLists: phraseLists,
|
|
769
771
|
updateRivescriptJSON: updateRivescriptJSON,
|
|
770
772
|
courseId: courseId,
|
|
771
773
|
sectionId: sectionId,
|
|
@@ -87,6 +87,7 @@ function Editor({
|
|
|
87
87
|
siteLanguage,
|
|
88
88
|
learnLang,
|
|
89
89
|
topicPhrases,
|
|
90
|
+
phraseLists,
|
|
90
91
|
updateRivescriptJSON,
|
|
91
92
|
courseId,
|
|
92
93
|
sectionId,
|
|
@@ -537,6 +538,7 @@ function Editor({
|
|
|
537
538
|
bot: bot,
|
|
538
539
|
siteLanguage: siteLanguage,
|
|
539
540
|
topicPhrases: topicPhrases,
|
|
541
|
+
phraseLists: phraseLists,
|
|
540
542
|
updateRivescriptJSON: updateRivescriptJSON,
|
|
541
543
|
initialTopicGoal: initialTopicGoal
|
|
542
544
|
})]
|
|
@@ -88,6 +88,8 @@ function PhraseList({
|
|
|
88
88
|
touched,
|
|
89
89
|
initialValues,
|
|
90
90
|
onSubmit,
|
|
91
|
+
onSubmitInfo,
|
|
92
|
+
onSubmitExerciseSettings,
|
|
91
93
|
handleChange,
|
|
92
94
|
handleUpdatePhrases,
|
|
93
95
|
handlePlayPhraseList,
|
|
@@ -370,6 +372,8 @@ function PhraseList({
|
|
|
370
372
|
voiceOptions: voices,
|
|
371
373
|
isUserInternal: isUserInternal,
|
|
372
374
|
onSubmit: onSubmit,
|
|
375
|
+
onSubmitInfo: onSubmitInfo,
|
|
376
|
+
onSubmitExerciseSettings: onSubmitExerciseSettings,
|
|
373
377
|
handleSpeak: handleSpeak,
|
|
374
378
|
fileSizeLimit: fileSizeLimit,
|
|
375
379
|
verificationStatus: verificationStatus
|
|
@@ -275,6 +275,7 @@ function Roleplay({
|
|
|
275
275
|
makeCandooAIQuery,
|
|
276
276
|
siteLanguage,
|
|
277
277
|
phrases,
|
|
278
|
+
phraseLists,
|
|
278
279
|
topicId,
|
|
279
280
|
initialTopicGoal,
|
|
280
281
|
isUserInternal,
|
|
@@ -915,6 +916,7 @@ function Roleplay({
|
|
|
915
916
|
actor2: roleplay.actor2
|
|
916
917
|
},
|
|
917
918
|
phrases: phrases,
|
|
919
|
+
phraseLists: phraseLists,
|
|
918
920
|
topicId: topicId,
|
|
919
921
|
initialTopicGoal: initialTopicGoal,
|
|
920
922
|
autoSelect: true
|
|
@@ -45,6 +45,8 @@ export default function UpdatePhraseList({
|
|
|
45
45
|
t = text => text,
|
|
46
46
|
initialValues: rawInitialValues = {},
|
|
47
47
|
onSubmit,
|
|
48
|
+
onSubmitInfo,
|
|
49
|
+
onSubmitExerciseSettings,
|
|
48
50
|
learnLang,
|
|
49
51
|
isUserInternal,
|
|
50
52
|
enableReinitialize,
|
|
@@ -56,44 +58,47 @@ export default function UpdatePhraseList({
|
|
|
56
58
|
const {
|
|
57
59
|
classes
|
|
58
60
|
} = useStyles();
|
|
59
|
-
const
|
|
60
|
-
phraseListName: "",
|
|
61
|
-
description: "",
|
|
62
|
-
|
|
63
|
-
voice: null,
|
|
64
|
-
voicePitch: null,
|
|
65
|
-
voiceLanguageCode: null,
|
|
66
|
-
hiddenPhraseGroupGames: {},
|
|
67
|
-
isKeyboardHiddenPhraseGroupGames: {},
|
|
68
|
-
hiddenWordBankPhraseGroupGames: {},
|
|
69
|
-
...rawInitialValues
|
|
61
|
+
const infoInitialValues = {
|
|
62
|
+
phraseListName: rawInitialValues.phraseListName ?? "",
|
|
63
|
+
description: rawInitialValues.description ?? "",
|
|
64
|
+
picture: rawInitialValues.picture ?? ""
|
|
70
65
|
};
|
|
66
|
+
const exerciseInitialValues = {
|
|
67
|
+
shuffleEnabled: rawInitialValues.shuffleEnabled ?? "enabled",
|
|
68
|
+
voice: rawInitialValues.voice ?? null,
|
|
69
|
+
voicePitch: rawInitialValues.voicePitch ?? null,
|
|
70
|
+
voiceLanguageCode: rawInitialValues.voiceLanguageCode ?? null,
|
|
71
|
+
hiddenPhraseGroupGames: rawInitialValues.hiddenPhraseGroupGames ?? {},
|
|
72
|
+
isKeyboardHiddenPhraseGroupGames: rawInitialValues.isKeyboardHiddenPhraseGroupGames ?? {},
|
|
73
|
+
hiddenWordBankPhraseGroupGames: rawInitialValues.hiddenWordBankPhraseGroupGames ?? {}
|
|
74
|
+
};
|
|
75
|
+
const handleSubmitInfo = onSubmitInfo ?? onSubmit;
|
|
76
|
+
const handleSubmitExercise = onSubmitExerciseSettings ?? onSubmit;
|
|
71
77
|
return /*#__PURE__*/_jsx("div", {
|
|
72
78
|
className: classes.container,
|
|
73
|
-
children: /*#__PURE__*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
size: 12,
|
|
79
|
+
children: /*#__PURE__*/_jsxs(Grid, {
|
|
80
|
+
container: true,
|
|
81
|
+
sx: {
|
|
82
|
+
width: "100%"
|
|
83
|
+
},
|
|
84
|
+
spacing: 1,
|
|
85
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
|
86
|
+
size: 12,
|
|
87
|
+
children: /*#__PURE__*/_jsx(Formik, {
|
|
88
|
+
initialValues: infoInitialValues,
|
|
89
|
+
enableReinitialize: enableReinitialize,
|
|
90
|
+
onSubmit: handleSubmitInfo,
|
|
91
|
+
children: ({
|
|
92
|
+
handleChange,
|
|
93
|
+
handleSubmit,
|
|
94
|
+
handleBlur,
|
|
95
|
+
isSubmitting,
|
|
96
|
+
dirty,
|
|
97
|
+
values,
|
|
98
|
+
errors,
|
|
99
|
+
touched
|
|
100
|
+
}) => /*#__PURE__*/_jsx("form", {
|
|
101
|
+
onSubmit: handleSubmit,
|
|
97
102
|
children: /*#__PURE__*/_jsxs(Card, {
|
|
98
103
|
children: [/*#__PURE__*/_jsx(CardHeader, {
|
|
99
104
|
title: /*#__PURE__*/_jsx(Typography, {
|
|
@@ -185,10 +190,37 @@ export default function UpdatePhraseList({
|
|
|
185
190
|
})]
|
|
186
191
|
})]
|
|
187
192
|
})
|
|
193
|
+
}), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(CardActions, {
|
|
194
|
+
className: classes.padding,
|
|
195
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
196
|
+
type: "submit",
|
|
197
|
+
color: "primary",
|
|
198
|
+
variant: "contained",
|
|
199
|
+
disabled: isSubmitting || !dirty,
|
|
200
|
+
children: t("save_changes")
|
|
201
|
+
})
|
|
188
202
|
})]
|
|
189
203
|
})
|
|
190
|
-
})
|
|
191
|
-
|
|
204
|
+
})
|
|
205
|
+
})
|
|
206
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
207
|
+
size: 12,
|
|
208
|
+
children: /*#__PURE__*/_jsx(Formik, {
|
|
209
|
+
initialValues: exerciseInitialValues,
|
|
210
|
+
enableReinitialize: enableReinitialize,
|
|
211
|
+
onSubmit: handleSubmitExercise,
|
|
212
|
+
children: ({
|
|
213
|
+
handleChange,
|
|
214
|
+
handleSubmit,
|
|
215
|
+
handleBlur,
|
|
216
|
+
isSubmitting,
|
|
217
|
+
dirty,
|
|
218
|
+
values,
|
|
219
|
+
errors,
|
|
220
|
+
touched,
|
|
221
|
+
setFieldValue
|
|
222
|
+
}) => /*#__PURE__*/_jsx("form", {
|
|
223
|
+
onSubmit: handleSubmit,
|
|
192
224
|
children: /*#__PURE__*/_jsxs(Card, {
|
|
193
225
|
children: [/*#__PURE__*/_jsx(CardHeader, {
|
|
194
226
|
title: /*#__PURE__*/_jsx(Typography, {
|
|
@@ -443,9 +475,9 @@ export default function UpdatePhraseList({
|
|
|
443
475
|
})
|
|
444
476
|
})]
|
|
445
477
|
})
|
|
446
|
-
})
|
|
478
|
+
})
|
|
447
479
|
})
|
|
448
|
-
})
|
|
480
|
+
})]
|
|
449
481
|
})
|
|
450
482
|
});
|
|
451
483
|
}
|