@nualang/nualang-ui-components 0.1.1203 → 0.1.1205
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/Containers/App/App.js +9 -5
- package/dist/Dialogs/CreateAssignment/package.json +7 -0
- package/dist/Dialogs/CreatePhrase/CreatePhrase.js +4 -18
- package/dist/Forms/CreateBot/Steps/BotSettings/BotSettings.js +1 -1
- package/dist/Forms/CreateBot/Steps/Confirmation/Confirmation.js +1 -1
- package/dist/Forms/CreateTopic/Steps/TopicInformation/TopicInformation.js +1 -1
- package/dist/Lists/Exercises/Exercises.js +1 -1
- package/dist/Lists/RoleplaySelection/RoleplaySelection.js +1 -1
- package/dist/Misc/HoverText/HoverText.js +2 -2
- package/package.json +1 -1
|
@@ -24,6 +24,7 @@ var _ThemeToggle = _interopRequireDefault(require("../../Misc/ThemeToggle"));
|
|
|
24
24
|
var _SignOut = _interopRequireDefault(require("../../Misc/SignOut"));
|
|
25
25
|
var _Snackbar = _interopRequireDefault(require("../../Misc/Snackbar"));
|
|
26
26
|
var _School = _interopRequireDefault(require("@mui/icons-material/School"));
|
|
27
|
+
var _Assignment = _interopRequireDefault(require("@mui/icons-material/Assignment"));
|
|
27
28
|
var _BubbleChart = _interopRequireDefault(require("@mui/icons-material/BubbleChart"));
|
|
28
29
|
var _Add = _interopRequireDefault(require("@mui/icons-material/Add"));
|
|
29
30
|
var _ArrowBack = _interopRequireDefault(require("@mui/icons-material/ArrowBack"));
|
|
@@ -263,6 +264,10 @@ function App({
|
|
|
263
264
|
navigate("/courses/create");
|
|
264
265
|
handleCloseCreate();
|
|
265
266
|
};
|
|
267
|
+
const handleCreateAssignment = () => {
|
|
268
|
+
navigate("/assignments/create");
|
|
269
|
+
handleCloseCreate();
|
|
270
|
+
};
|
|
266
271
|
const hiddenStyle = {
|
|
267
272
|
position: "absolute",
|
|
268
273
|
left: "-10000px",
|
|
@@ -400,14 +405,13 @@ function App({
|
|
|
400
405
|
"data-cy": "appbar-create-course",
|
|
401
406
|
children: t("course")
|
|
402
407
|
})]
|
|
403
|
-
}), process.env.REACT_APP_STAGE === "dev" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem
|
|
404
|
-
|
|
405
|
-
, {
|
|
408
|
+
}), process.env.REACT_APP_STAGE === "dev" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
|
409
|
+
onClick: handleCreateAssignment,
|
|
406
410
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
|
|
407
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
411
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Assignment.default, {})
|
|
408
412
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
409
413
|
"data-cy": "appbar-create-assignment",
|
|
410
|
-
children: t("
|
|
414
|
+
children: t("assignment")
|
|
411
415
|
})]
|
|
412
416
|
})]
|
|
413
417
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LanguageSelector.default, {
|
|
@@ -223,27 +223,13 @@ function CreatePhrase({
|
|
|
223
223
|
|
|
224
224
|
const autoFillTranslation = async () => {
|
|
225
225
|
try {
|
|
226
|
-
const activePrompt = `Translate the following phrase "${phrase}" from ${learnLang} to ${forLang}. Provide all the acceptable
|
|
227
|
-
|
|
226
|
+
const activePrompt = `Translate the following phrase "${phrase}" from ${learnLang} to ${forLang}. Provide all the acceptable translations if the phrase has multiple interpretations. Format the response as a valid JSON array with each translation as a string inside the array.`;
|
|
227
|
+
let chatGptResponse = await makeChatGptApiRequest({
|
|
228
228
|
model: "gpt-3.5-turbo",
|
|
229
229
|
prompt: activePrompt
|
|
230
230
|
});
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
let translations = chatGptResponse;
|
|
234
|
-
|
|
235
|
-
// If response is not an array, parse it
|
|
236
|
-
if (!Array.isArray(translations)) {
|
|
237
|
-
if (typeof chatGptResponse === "string") {
|
|
238
|
-
try {
|
|
239
|
-
translations = JSON.parse(chatGptResponse);
|
|
240
|
-
} catch (error) {
|
|
241
|
-
throw new Error("Failed to parse OpenAI response into JSON.");
|
|
242
|
-
}
|
|
243
|
-
} else {
|
|
244
|
-
throw new Error("Invalid response format from OpenAI.");
|
|
245
|
-
}
|
|
246
|
-
}
|
|
231
|
+
chatGptResponse = chatGptResponse.replaceAll("```", '').replaceAll("json", '');
|
|
232
|
+
const translations = JSON.parse(chatGptResponse);
|
|
247
233
|
setTranslationList(prevTranslationList => {
|
|
248
234
|
const newTranslations = translations.filter(text => !prevTranslationList.includes(text));
|
|
249
235
|
return [...prevTranslationList, ...newTranslations];
|
|
@@ -107,7 +107,7 @@ function BotSettings({
|
|
|
107
107
|
})]
|
|
108
108
|
})]
|
|
109
109
|
})]
|
|
110
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
110
|
+
}), process.env.REACT_APP_STAGE === "dev" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
111
111
|
item: true,
|
|
112
112
|
xs: 12,
|
|
113
113
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
@@ -150,7 +150,7 @@ function Confirmation({
|
|
|
150
150
|
gutterBottom: true,
|
|
151
151
|
display: "block",
|
|
152
152
|
children: t("advanced_bot_desc")
|
|
153
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
153
|
+
}), process.env.REACT_APP_STAGE === "dev" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
154
154
|
component: "fieldset",
|
|
155
155
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormLabel, {
|
|
156
156
|
component: "legend",
|
|
@@ -191,7 +191,7 @@ TopicInformation.label = "topic_information";
|
|
|
191
191
|
TopicInformation.validationSchema = Yup.object().shape({
|
|
192
192
|
topicName: Yup.string().required("required").test("noSpecialChars", "no_special_characters", value => !(0, _utils.containsInvalidSymbols)(value)),
|
|
193
193
|
description: Yup.string().required("required").test("noSpecialChars", "no_special_characters", value => !(0, _utils.containsInvalidSymbols)(value)),
|
|
194
|
-
topicGoal: Yup.string().test("noSpecialChars", "no_special_characters", value => !(0, _utils.containsInvalidSymbols)(value)),
|
|
194
|
+
topicGoal: Yup.string().test("noSpecialChars", "no_special_characters", value => !(0, _utils.containsInvalidSymbols)(value)).nullable(),
|
|
195
195
|
difficulty: Yup.string().required("required"),
|
|
196
196
|
picture: Yup.string().nullable(),
|
|
197
197
|
tags: Yup.array(Yup.string().test("noSpecialChars", "no_special_characters", value => !(0, _utils.containsInvalidSymbols)(value))).nullable()
|
|
@@ -662,7 +662,7 @@ function BotListItem({
|
|
|
662
662
|
children: isBotHiddenState ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_VisibilityOff.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Visibility.default, {})
|
|
663
663
|
})
|
|
664
664
|
})
|
|
665
|
-
}), isCreator && isLargeScreen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
665
|
+
}), isCreator && isLargeScreen && process.env.REACT_APP_STAGE === "dev" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
666
666
|
title: isBotAdvanced ? t("unmark_as_advanced_bot") : t("mark_as_advanced_bot"),
|
|
667
667
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
668
668
|
"data-cy": "mark_advanced_bot",
|
|
@@ -204,7 +204,7 @@ function Roleplay({
|
|
|
204
204
|
})
|
|
205
205
|
})]
|
|
206
206
|
})) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
207
|
-
onClick:
|
|
207
|
+
onClick: handleRoleplaySelected("roleplay-story"),
|
|
208
208
|
disabled: isRoleplaySelected || isExerciseSelected || !isRoleplayValid,
|
|
209
209
|
sx: {
|
|
210
210
|
display: "flex",
|
|
@@ -239,9 +239,9 @@ function HoverText({
|
|
|
239
239
|
voicePitch: voicePitch,
|
|
240
240
|
voiceSpeed: voiceSpeed,
|
|
241
241
|
muteSound: muteSound
|
|
242
|
-
}, index)), formattedSource && /*#__PURE__*/(0, _jsxRuntime.
|
|
242
|
+
}, index)), formattedSource && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactMarkdown.default, {
|
|
243
243
|
components: components,
|
|
244
|
-
children:
|
|
244
|
+
children: formattedSource
|
|
245
245
|
})]
|
|
246
246
|
})
|
|
247
247
|
});
|