@nualang/nualang-ui-components 0.1.1208 → 0.1.1210
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/Cards/Classroom/Classroom.js +5 -122
- package/dist/Cards/Course/Course.js +3 -70
- package/dist/Containers/App/App.js +22 -18
- package/dist/Dialogs/CreatePhrase/CreatePhrase.js +6 -2
- package/dist/Dialogs/GenerateBot/GenerateBot.js +13 -8
- package/dist/Dialogs/GeneratePhrases/GeneratePhrases.js +13 -4
- package/dist/Dialogs/GenerateQuestion/GenerateQuestion.js +10 -2
- package/dist/Dialogs/GenerateRoleplay/GenerateRoleplay.js +17 -8
- package/dist/Forms/CreateClassroom/CreateClassroom.js +0 -1
- package/dist/Forms/CreateClassroom/Steps/ClassroomSettings/ClassroomSettings.js +0 -29
- package/dist/Forms/CreateClassroom/Steps/Confirmation/Confirmation.js +1 -27
- package/dist/Forms/CreateCourse/CreateCourse.js +0 -1
- package/dist/Forms/CreateCourse/Steps/Confirmation/Confirmation.js +0 -26
- package/dist/Forms/CreateCourse/Steps/CourseSettings/CourseSettings.js +0 -29
- package/dist/Forms/UpdateClassroom/UpdateClassroom.js +0 -3
- package/dist/Forms/UpdateCourse/UpdateCourse.js +0 -3
- package/dist/Misc/LanguageSelector/LanguageSelector.js +4 -1
- package/dist/Screens/Classrooms/Classrooms.js +0 -12
- package/dist/Screens/Classrooms/SearchClassrooms/SearchClassrooms.js +0 -6
- package/dist/Screens/Classrooms/ViewClassroom/ViewClassroom.js +2 -65
- package/dist/Screens/Courses/Courses.js +0 -9
- package/dist/Screens/Courses/SearchCourses/SearchCourses.js +0 -6
- package/dist/Screens/Courses/ViewCourse/ViewCourse.js +2 -61
- package/dist/Screens/Dashboard/Dashboard.js +0 -12
- package/dist/Screens/Profile/Profile.js +0 -16
- package/dist/Screens/Search/Search.js +0 -6
- package/dist/Tables/ClassroomRows/ClassroomRows.js +0 -47
- package/dist/Tables/Classrooms/Classrooms.js +0 -7
- package/dist/Tables/CourseRows/CourseRows.js +0 -47
- package/dist/Tables/Courses/Courses.js +0 -7
- package/dist/hooks/useClassroomState.js +0 -3
- package/dist/hooks/useClassroomStateOld.js +1 -5
- package/dist/hooks/useCourseState.js +0 -3
- package/dist/hooks/useRecognition.js +11 -2
- package/dist/utils/index.js +6 -1
- package/package.json +1 -1
- package/dist/Dialogs/CreateReview/CreateReview.js +0 -119
- package/dist/Dialogs/CreateReview/package.json +0 -6
- package/dist/Dialogs/DeleteReview/DeleteReview.js +0 -31
- package/dist/Dialogs/DeleteReview/package.json +0 -6
- package/dist/Dialogs/Reviews/Reviews.js +0 -32
- package/dist/Dialogs/Reviews/package.json +0 -6
- package/dist/Lists/Reviews/Reviews.js +0 -427
- package/dist/Lists/Reviews/package.json +0 -6
- package/dist/Misc/NotFound/Reviews.js +0 -57
|
@@ -12,15 +12,11 @@ var _Skeleton = _interopRequireDefault(require("@mui/material/Skeleton"));
|
|
|
12
12
|
var _Rating = _interopRequireDefault(require("@mui/material/Rating"));
|
|
13
13
|
var _Group = _interopRequireDefault(require("@mui/icons-material/Group"));
|
|
14
14
|
var _ExitToApp = _interopRequireDefault(require("@mui/icons-material/ExitToApp"));
|
|
15
|
-
var _Edit = _interopRequireDefault(require("@mui/icons-material/Edit"));
|
|
16
|
-
var _RateReview = _interopRequireDefault(require("@mui/icons-material/RateReview"));
|
|
17
15
|
var _Add = _interopRequireDefault(require("@mui/icons-material/Add"));
|
|
18
16
|
var _Person = _interopRequireDefault(require("@mui/icons-material/Person"));
|
|
19
17
|
var _MoreVert = _interopRequireDefault(require("@mui/icons-material/MoreVert"));
|
|
20
|
-
var _Reviews = _interopRequireDefault(require("../../Dialogs/Reviews"));
|
|
21
18
|
var _Members = _interopRequireDefault(require("../../Dialogs/Members"));
|
|
22
19
|
var _Members2 = _interopRequireDefault(require("../../Lists/Members"));
|
|
23
|
-
var _Reviews2 = _interopRequireDefault(require("../../Lists/Reviews"));
|
|
24
20
|
var _index = require("../../utils/index");
|
|
25
21
|
var _index2 = _interopRequireDefault(require("../../utils/placeholder-images/index"));
|
|
26
22
|
var _ProgressiveCardMedia = _interopRequireDefault(require("../../Misc/ProgressiveCardMedia"));
|
|
@@ -35,16 +31,13 @@ function OverflowMenu({
|
|
|
35
31
|
classroomId,
|
|
36
32
|
anchorEl,
|
|
37
33
|
handleClose,
|
|
38
|
-
handleClickOpenReviews,
|
|
39
34
|
handleClickOpenMembers,
|
|
40
35
|
isCreator,
|
|
41
36
|
isMember,
|
|
42
37
|
viewClassroom,
|
|
43
38
|
joinClassroom,
|
|
44
39
|
leaveClassroom,
|
|
45
|
-
isInviteFeatureDisabled
|
|
46
|
-
reviewsEnabled,
|
|
47
|
-
reviewCount
|
|
40
|
+
isInviteFeatureDisabled
|
|
48
41
|
}) {
|
|
49
42
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Menu, {
|
|
50
43
|
id: `card-menu-${classroomId}`,
|
|
@@ -52,16 +45,7 @@ function OverflowMenu({
|
|
|
52
45
|
keepMounted: true,
|
|
53
46
|
open: Boolean(anchorEl),
|
|
54
47
|
onClose: handleClose,
|
|
55
|
-
children: [
|
|
56
|
-
onClick: handleClickOpenReviews,
|
|
57
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardMenuIcon, {
|
|
58
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RateReview.default, {
|
|
59
|
-
fontSize: "small"
|
|
60
|
-
})
|
|
61
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
62
|
-
children: t("reviews")
|
|
63
|
-
})]
|
|
64
|
-
}), isCreator && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
|
48
|
+
children: [isCreator && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
|
65
49
|
onClick: handleClickOpenMembers,
|
|
66
50
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardMenuIcon, {
|
|
67
51
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Group.default, {
|
|
@@ -123,14 +107,6 @@ function ClassroomLoading() {
|
|
|
123
107
|
width: "20%"
|
|
124
108
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
125
109
|
flexGrow: 1
|
|
126
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
127
|
-
mr: 0.5,
|
|
128
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Rating.default, {
|
|
129
|
-
value: 0,
|
|
130
|
-
precision: 0.5,
|
|
131
|
-
readOnly: true,
|
|
132
|
-
size: "small"
|
|
133
|
-
})
|
|
134
110
|
})]
|
|
135
111
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
136
112
|
variant: "body1",
|
|
@@ -153,11 +129,8 @@ function ClassroomCard({
|
|
|
153
129
|
handleLeaveClassroom,
|
|
154
130
|
membersProps,
|
|
155
131
|
getMemberDetails,
|
|
156
|
-
getUserReviews,
|
|
157
132
|
getMemberInfo,
|
|
158
|
-
reviewPlaceholderImageUrl,
|
|
159
133
|
memberPlaceholderImageUrl,
|
|
160
|
-
getClassroomReviews,
|
|
161
134
|
getClassroomMember,
|
|
162
135
|
getClassroomMembers,
|
|
163
136
|
username,
|
|
@@ -171,52 +144,15 @@ function ClassroomCard({
|
|
|
171
144
|
});
|
|
172
145
|
const {
|
|
173
146
|
isMember,
|
|
174
|
-
membersQuery
|
|
175
|
-
reviewsQuery
|
|
147
|
+
membersQuery
|
|
176
148
|
} = (0, _useClassroomState.default)({
|
|
177
149
|
classroomId: classroom && classroom.classroomId ? classroom.classroomId : null,
|
|
178
150
|
username,
|
|
179
151
|
memberId: username,
|
|
180
|
-
getClassroomReviews,
|
|
181
152
|
getClassroomMember,
|
|
182
153
|
getClassroomMembers,
|
|
183
154
|
visible
|
|
184
155
|
});
|
|
185
|
-
const [isReviewsOpen, setIsReviewsOpen] = (0, _react.useState)(false);
|
|
186
|
-
const handleClickOpenReviews = () => {
|
|
187
|
-
setIsReviewsOpen(true);
|
|
188
|
-
};
|
|
189
|
-
const formatReviews = async reviews => {
|
|
190
|
-
try {
|
|
191
|
-
if (Array.isArray(reviews)) {
|
|
192
|
-
const newReviews = await Promise.all(reviews.map(async review => {
|
|
193
|
-
const noReviews = await getUserReviews(review.createdBy);
|
|
194
|
-
const memberInfo = await getMemberInfo({
|
|
195
|
-
memberId: review.createdBy
|
|
196
|
-
});
|
|
197
|
-
return {
|
|
198
|
-
...review,
|
|
199
|
-
username: memberInfo.username,
|
|
200
|
-
userImage: memberInfo.userImage,
|
|
201
|
-
noReviews: noReviews.Items.length
|
|
202
|
-
};
|
|
203
|
-
}));
|
|
204
|
-
setNewReviews(newReviews);
|
|
205
|
-
}
|
|
206
|
-
} catch (error) {
|
|
207
|
-
console.error("error", error);
|
|
208
|
-
throw error;
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
const [newReviewsList, setNewReviews] = (0, _react.useState)(null);
|
|
212
|
-
(0, _react.useEffect)(() => {
|
|
213
|
-
if (getMemberInfo && reviewsQuery.isSuccess && reviewsQuery.data.Items && reviewsQuery.data.Items.length) {
|
|
214
|
-
formatReviews(reviewsQuery.data.Items);
|
|
215
|
-
}
|
|
216
|
-
}, [getMemberInfo, reviewsQuery.isSuccess]);
|
|
217
|
-
const handleCloseReviews = () => {
|
|
218
|
-
setIsReviewsOpen(false);
|
|
219
|
-
};
|
|
220
156
|
const [isMembersOpen, setIsMembersOpen] = (0, _react.useState)(false);
|
|
221
157
|
const handleClickOpenMembers = () => {
|
|
222
158
|
setIsMembersOpen(true);
|
|
@@ -246,8 +182,7 @@ function ClassroomCard({
|
|
|
246
182
|
verificationStatus,
|
|
247
183
|
gameAward,
|
|
248
184
|
createdByName,
|
|
249
|
-
visibility
|
|
250
|
-
reviewsEnabled
|
|
185
|
+
visibility
|
|
251
186
|
} = classroom;
|
|
252
187
|
const viewClassroom = () => {
|
|
253
188
|
handleViewClassroom(classroom.classroomId);
|
|
@@ -265,8 +200,6 @@ function ClassroomCard({
|
|
|
265
200
|
joinClassroom();
|
|
266
201
|
}
|
|
267
202
|
};
|
|
268
|
-
const starRating = reviewsQuery.isSuccess && reviewsQuery.data.Items.length > 0 ? (reviewsQuery.data.Items.reduce((total, next) => total + parseFloat(next.starRating), 0) / reviewsQuery.data.Items.length).toPrecision(3) : 0;
|
|
269
|
-
const reviewCount = reviewsQuery.isSuccess ? reviewsQuery.data.Items.length : 0;
|
|
270
203
|
const memberCount = membersQuery.isSuccess ? membersQuery.data.Items.length : 0;
|
|
271
204
|
const isInviteFeatureDisabled = classroomId && classroomId.toLowerCase().includes("wayside");
|
|
272
205
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CardElements.CardContainer, {
|
|
@@ -366,44 +299,6 @@ function ClassroomCard({
|
|
|
366
299
|
children: [memberCount, " ", memberCount === 1 ? t("member") : t("members")]
|
|
367
300
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
368
301
|
flexGrow: 1
|
|
369
|
-
}), reviewsEnabled === "enabled" && reviewCount > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
370
|
-
children: reviewsQuery.isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Rating.default, {
|
|
371
|
-
value: 0,
|
|
372
|
-
precision: 0.5,
|
|
373
|
-
readOnly: true,
|
|
374
|
-
size: "small",
|
|
375
|
-
role: "button",
|
|
376
|
-
tabIndex: 0
|
|
377
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
378
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
379
|
-
mr: 0.5,
|
|
380
|
-
sx: _CardElements.classes.cursorPointer,
|
|
381
|
-
onClick: handleClickOpenReviews,
|
|
382
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Rating.default, {
|
|
383
|
-
value: starRating,
|
|
384
|
-
precision: 0.5,
|
|
385
|
-
readOnly: true,
|
|
386
|
-
size: "small",
|
|
387
|
-
onKeyDown: event => {
|
|
388
|
-
if (event.key === "Enter") {
|
|
389
|
-
handleClickOpenReviews();
|
|
390
|
-
}
|
|
391
|
-
},
|
|
392
|
-
role: "button",
|
|
393
|
-
tabIndex: 0
|
|
394
|
-
})
|
|
395
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
396
|
-
mr: 1,
|
|
397
|
-
sx: _CardElements.classes.cursorPointer,
|
|
398
|
-
onClick: handleClickOpenReviews,
|
|
399
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
400
|
-
variant: "body2",
|
|
401
|
-
color: "textSecondary",
|
|
402
|
-
component: "p",
|
|
403
|
-
children: [starRating ? starRating : 0, " (", reviewCount, ")"]
|
|
404
|
-
})
|
|
405
|
-
})]
|
|
406
|
-
})
|
|
407
302
|
})]
|
|
408
303
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardDescription, {
|
|
409
304
|
variant: "body1",
|
|
@@ -439,24 +334,13 @@ function ClassroomCard({
|
|
|
439
334
|
classroomId: classroomId,
|
|
440
335
|
anchorEl: anchorEl,
|
|
441
336
|
handleClose: handleCloseMenu,
|
|
442
|
-
handleClickOpenReviews: handleClickOpenReviews,
|
|
443
337
|
handleClickOpenMembers: handleClickOpenMembers,
|
|
444
338
|
isCreator: isCreator,
|
|
445
339
|
isMember: isMember,
|
|
446
340
|
viewClassroom: viewClassroom,
|
|
447
341
|
joinClassroom: joinClassroom,
|
|
448
342
|
leaveClassroom: leaveClassroom,
|
|
449
|
-
isInviteFeatureDisabled: isInviteFeatureDisabled
|
|
450
|
-
reviewsEnabled: reviewsEnabled,
|
|
451
|
-
reviewCount: reviewCount
|
|
452
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Reviews.default, {
|
|
453
|
-
t: t,
|
|
454
|
-
dialogTitle: classroomName,
|
|
455
|
-
open: isReviewsOpen,
|
|
456
|
-
handleClose: handleCloseReviews,
|
|
457
|
-
isLoading: reviewsQuery.isLoading,
|
|
458
|
-
reviews: Array.isArray(newReviewsList) && newReviewsList.length ? newReviewsList : [],
|
|
459
|
-
placeholderImageUrl: reviewPlaceholderImageUrl
|
|
343
|
+
isInviteFeatureDisabled: isInviteFeatureDisabled
|
|
460
344
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Members.default, {
|
|
461
345
|
t: t,
|
|
462
346
|
placeholderImageUrl: memberPlaceholderImageUrl,
|
|
@@ -487,7 +371,6 @@ Classroom.propTypes = {
|
|
|
487
371
|
forLang: _propTypes.default.string.isRequired,
|
|
488
372
|
isMember: _propTypes.default.bool,
|
|
489
373
|
isCreator: _propTypes.default.bool,
|
|
490
|
-
reviews: _Reviews2.default.propTypes,
|
|
491
374
|
members: _Members2.default.propTypes,
|
|
492
375
|
createdAt: _propTypes.default.number.isRequired,
|
|
493
376
|
createdBy: _propTypes.default.string.isRequired,
|
|
@@ -11,8 +11,6 @@ var _material = require("@mui/material");
|
|
|
11
11
|
var _Skeleton = _interopRequireDefault(require("@mui/material/Skeleton"));
|
|
12
12
|
var _Group = _interopRequireDefault(require("@mui/icons-material/Group"));
|
|
13
13
|
var _ExitToApp = _interopRequireDefault(require("@mui/icons-material/ExitToApp"));
|
|
14
|
-
var _Edit = _interopRequireDefault(require("@mui/icons-material/Edit"));
|
|
15
|
-
var _RateReview = _interopRequireDefault(require("@mui/icons-material/RateReview"));
|
|
16
14
|
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
17
15
|
var _Settings = _interopRequireDefault(require("@mui/icons-material/Settings"));
|
|
18
16
|
var _Person = _interopRequireDefault(require("@mui/icons-material/Person"));
|
|
@@ -21,11 +19,9 @@ var _FileCopy = _interopRequireDefault(require("@mui/icons-material/FileCopy"));
|
|
|
21
19
|
var _OndemandVideo = _interopRequireDefault(require("@mui/icons-material/OndemandVideo"));
|
|
22
20
|
var _PictureAsPdf = _interopRequireDefault(require("@mui/icons-material/PictureAsPdf"));
|
|
23
21
|
var _School = _interopRequireDefault(require("@mui/icons-material/School"));
|
|
24
|
-
var _Reviews = _interopRequireDefault(require("../../Dialogs/Reviews"));
|
|
25
22
|
var _Members = _interopRequireDefault(require("../../Dialogs/Members"));
|
|
26
23
|
var _CourseOutline = _interopRequireDefault(require("../../Dialogs/CourseOutline"));
|
|
27
24
|
var _Members2 = _interopRequireDefault(require("../../Lists/Members"));
|
|
28
|
-
var _Reviews2 = _interopRequireDefault(require("../../Lists/Reviews"));
|
|
29
25
|
var _index = _interopRequireDefault(require("../../utils/placeholder-images/index"));
|
|
30
26
|
var _index2 = require("../../utils/index");
|
|
31
27
|
var _PlayArrow = _interopRequireDefault(require("@mui/icons-material/PlayArrow"));
|
|
@@ -44,7 +40,6 @@ function OverflowMenu({
|
|
|
44
40
|
courseId,
|
|
45
41
|
anchorEl,
|
|
46
42
|
handleClose,
|
|
47
|
-
handleClickOpenReviews,
|
|
48
43
|
handleClickOpenMembers,
|
|
49
44
|
isCreator,
|
|
50
45
|
isMember,
|
|
@@ -55,8 +50,6 @@ function OverflowMenu({
|
|
|
55
50
|
isAdmin,
|
|
56
51
|
handleDuplicateCourse,
|
|
57
52
|
course,
|
|
58
|
-
reviewsEnabled,
|
|
59
|
-
reviewCount,
|
|
60
53
|
classroomId,
|
|
61
54
|
isClassroomArchived = false
|
|
62
55
|
}) {
|
|
@@ -66,16 +59,7 @@ function OverflowMenu({
|
|
|
66
59
|
keepMounted: true,
|
|
67
60
|
open: Boolean(anchorEl),
|
|
68
61
|
onClose: handleClose,
|
|
69
|
-
children: [
|
|
70
|
-
onClick: handleClickOpenReviews,
|
|
71
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardMenuIcon, {
|
|
72
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RateReview.default, {
|
|
73
|
-
fontSize: "small"
|
|
74
|
-
})
|
|
75
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
76
|
-
children: t("reviews")
|
|
77
|
-
})]
|
|
78
|
-
}), isCreator && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
|
62
|
+
children: [isCreator && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
|
79
63
|
onClick: handleClickOpenMembers,
|
|
80
64
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardMenuIcon, {
|
|
81
65
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Group.default, {
|
|
@@ -212,11 +196,8 @@ function CourseCard({
|
|
|
212
196
|
selected,
|
|
213
197
|
getMemberDetails,
|
|
214
198
|
getMemberInfo,
|
|
215
|
-
getUserReviews,
|
|
216
|
-
reviewPlaceholderImageUrl,
|
|
217
199
|
memberPlaceholderImageUrl,
|
|
218
200
|
getCourseSections,
|
|
219
|
-
getCourseReviews,
|
|
220
201
|
getCourseMember,
|
|
221
202
|
getCourseMembers,
|
|
222
203
|
username,
|
|
@@ -250,51 +231,16 @@ function CourseCard({
|
|
|
250
231
|
const {
|
|
251
232
|
membersQuery,
|
|
252
233
|
memberQuery,
|
|
253
|
-
reviewsQuery,
|
|
254
234
|
isMember
|
|
255
235
|
} = (0, _useCourseState.default)({
|
|
256
236
|
courseId: course && course.courseId ? course.courseId : null,
|
|
257
237
|
username,
|
|
258
238
|
getCourseSections,
|
|
259
|
-
getCourseReviews,
|
|
260
239
|
getCourseMember,
|
|
261
240
|
getCourseMembers,
|
|
262
241
|
memberId,
|
|
263
242
|
visible
|
|
264
243
|
});
|
|
265
|
-
const [newReviewsList, setNewReviews] = (0, _react.useState)(null);
|
|
266
|
-
const formatReviews = async reviews => {
|
|
267
|
-
try {
|
|
268
|
-
const newReviews = await Promise.all(reviews.map(async review => {
|
|
269
|
-
const noReviews = await getUserReviews(review.createdBy);
|
|
270
|
-
const memberInfo = await getMemberInfo({
|
|
271
|
-
memberId: review.createdBy
|
|
272
|
-
});
|
|
273
|
-
return {
|
|
274
|
-
...review,
|
|
275
|
-
username: memberInfo.username,
|
|
276
|
-
userImage: memberInfo.userImage,
|
|
277
|
-
noReviews: noReviews.Items.length
|
|
278
|
-
};
|
|
279
|
-
}));
|
|
280
|
-
setNewReviews(newReviews);
|
|
281
|
-
} catch (error) {
|
|
282
|
-
console.error("error", error);
|
|
283
|
-
throw error;
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
(0, _react.useEffect)(() => {
|
|
287
|
-
if (getMemberInfo && reviewsQuery.isSuccess && reviewsQuery.data.Items && reviewsQuery.data.Items.length) {
|
|
288
|
-
formatReviews(reviewsQuery.data.Items);
|
|
289
|
-
}
|
|
290
|
-
}, [getMemberInfo, reviewsQuery.isSuccess]);
|
|
291
|
-
const [isReviewsOpen, setIsReviewsOpen] = (0, _react.useState)(false);
|
|
292
|
-
const handleClickOpenReviews = () => {
|
|
293
|
-
setIsReviewsOpen(true);
|
|
294
|
-
};
|
|
295
|
-
const handleCloseReviews = () => {
|
|
296
|
-
setIsReviewsOpen(false);
|
|
297
|
-
};
|
|
298
244
|
const [isMembersOpen, setIsMembersOpen] = (0, _react.useState)(false);
|
|
299
245
|
const handleClickOpenMembers = () => {
|
|
300
246
|
setIsMembersOpen(true);
|
|
@@ -336,8 +282,7 @@ function CourseCard({
|
|
|
336
282
|
gameAward,
|
|
337
283
|
createdByName,
|
|
338
284
|
exerciseStartTotal,
|
|
339
|
-
visibility
|
|
340
|
-
reviewsEnabled
|
|
285
|
+
visibility
|
|
341
286
|
} = course;
|
|
342
287
|
const viewCourse = () => {
|
|
343
288
|
if (selectable) {
|
|
@@ -365,7 +310,7 @@ function CourseCard({
|
|
|
365
310
|
startCourse();
|
|
366
311
|
}
|
|
367
312
|
};
|
|
368
|
-
|
|
313
|
+
|
|
369
314
|
// const memberCount = membersQuery.isSuccess ? membersQuery.data.Items.length : 0;
|
|
370
315
|
|
|
371
316
|
const isPlaysVisible = !disablePlays && exerciseStartTotal > -1;
|
|
@@ -571,7 +516,6 @@ function CourseCard({
|
|
|
571
516
|
classroomId: classroomId,
|
|
572
517
|
anchorEl: anchorEl,
|
|
573
518
|
handleClose: handleCloseMenu,
|
|
574
|
-
handleClickOpenReviews: handleClickOpenReviews,
|
|
575
519
|
handleClickOpenMembers: handleClickOpenMembers,
|
|
576
520
|
isCreator: isCreator,
|
|
577
521
|
isMember: isMember,
|
|
@@ -582,17 +526,7 @@ function CourseCard({
|
|
|
582
526
|
handleRemoveCourse: handleRemoveCourse,
|
|
583
527
|
handleDuplicateCourse: handleDuplicateCourse,
|
|
584
528
|
course: course,
|
|
585
|
-
reviewsEnabled: reviewsEnabled,
|
|
586
|
-
reviewCount: reviewCount,
|
|
587
529
|
isClassroomArchived: isClassroomArchived
|
|
588
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Reviews.default, {
|
|
589
|
-
t: t,
|
|
590
|
-
dialogTitle: courseName,
|
|
591
|
-
open: isReviewsOpen,
|
|
592
|
-
handleClose: handleCloseReviews,
|
|
593
|
-
isLoading: reviewsQuery.isLoading,
|
|
594
|
-
reviews: Array.isArray(newReviewsList) && newReviewsList.length ? newReviewsList : [],
|
|
595
|
-
placeholderImageUrl: reviewPlaceholderImageUrl
|
|
596
530
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Members.default, {
|
|
597
531
|
getMemberDetails: getMemberDetails,
|
|
598
532
|
t: t,
|
|
@@ -642,7 +576,6 @@ MemoizedCourse.propTypes = {
|
|
|
642
576
|
createdAt: _propTypes.default.number.isRequired,
|
|
643
577
|
createdBy: _propTypes.default.string.isRequired,
|
|
644
578
|
userImage: _propTypes.default.string,
|
|
645
|
-
reviews: _propTypes.default.arrayOf(_Reviews2.default.propTypes),
|
|
646
579
|
members: _propTypes.default.arrayOf(_Members2.default.propTypes),
|
|
647
580
|
sections: _propTypes.default.arrayOf({
|
|
648
581
|
sectionId: _propTypes.default.string.isRequired,
|
|
@@ -10,7 +10,6 @@ var _DefaultColourButton = _interopRequireDefault(require("../../Misc/DefaultCol
|
|
|
10
10
|
var _styles = require("@mui/material/styles");
|
|
11
11
|
var _mui = require("tss-react/mui");
|
|
12
12
|
var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
|
|
13
|
-
var _Star = _interopRequireDefault(require("@mui/icons-material/Star"));
|
|
14
13
|
var _Search = _interopRequireDefault(require("@mui/icons-material/Search"));
|
|
15
14
|
var _InputBase = _interopRequireDefault(require("@mui/material/InputBase"));
|
|
16
15
|
var _InputAdornment = _interopRequireDefault(require("@mui/material/InputAdornment"));
|
|
@@ -91,7 +90,8 @@ const SearchIconWrapper = (0, _styles.styled)("div")(({
|
|
|
91
90
|
justifyContent: "center"
|
|
92
91
|
}));
|
|
93
92
|
const StyledInputBase = (0, _styles.styled)(_InputBase.default)(({
|
|
94
|
-
theme
|
|
93
|
+
theme,
|
|
94
|
+
isUpgradePossible
|
|
95
95
|
}) => ({
|
|
96
96
|
color: "inherit",
|
|
97
97
|
width: "100%",
|
|
@@ -100,9 +100,9 @@ const StyledInputBase = (0, _styles.styled)(_InputBase.default)(({
|
|
|
100
100
|
paddingLeft: `calc(1em + ${theme.spacing(4)})`,
|
|
101
101
|
transition: theme.transitions.create("width"),
|
|
102
102
|
[theme.breakpoints.up("lg")]: {
|
|
103
|
-
width: "30ch",
|
|
103
|
+
width: isUpgradePossible ? "20ch" : "30ch",
|
|
104
104
|
"&:focus": {
|
|
105
|
-
width: "35ch"
|
|
105
|
+
width: isUpgradePossible ? "25ch" : "35ch"
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
}
|
|
@@ -111,7 +111,8 @@ function AppSearch({
|
|
|
111
111
|
t,
|
|
112
112
|
navigate,
|
|
113
113
|
searchText,
|
|
114
|
-
setSearchText
|
|
114
|
+
setSearchText,
|
|
115
|
+
isUpgradePossible
|
|
115
116
|
}) {
|
|
116
117
|
const [debouncedSearchText, setDebouncedSearchText] = (0, _react.useState)("");
|
|
117
118
|
const [prevDebouncedSearchText, setPrevDebouncedSearchText] = (0, _react.useState)("");
|
|
@@ -146,6 +147,7 @@ function AppSearch({
|
|
|
146
147
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Search.default, {})
|
|
147
148
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledInputBase, {
|
|
148
149
|
autoFocus: true,
|
|
150
|
+
isUpgradePossible: isUpgradePossible,
|
|
149
151
|
placeholder: t("app_search_placeholder"),
|
|
150
152
|
value: searchText,
|
|
151
153
|
onChange: ev => {
|
|
@@ -283,6 +285,7 @@ function App({
|
|
|
283
285
|
};
|
|
284
286
|
const isSearchActive = searchText || isMobileSearchExpanded;
|
|
285
287
|
const isTeacher = user && user["custom:role"] === "teach";
|
|
288
|
+
const isUpgradePossible = subscription && !subscription.isPaidUser && subscription.isUpgradePossible;
|
|
286
289
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
287
290
|
className: classes.root,
|
|
288
291
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Header.default, {
|
|
@@ -307,7 +310,8 @@ function App({
|
|
|
307
310
|
t: t,
|
|
308
311
|
navigate: navigate,
|
|
309
312
|
searchText: searchText,
|
|
310
|
-
setSearchText: setSearchText
|
|
313
|
+
setSearchText: setSearchText,
|
|
314
|
+
isUpgradePossible: isUpgradePossible
|
|
311
315
|
})]
|
|
312
316
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
313
317
|
children: [isLgScreen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
@@ -316,7 +320,8 @@ function App({
|
|
|
316
320
|
t: t,
|
|
317
321
|
navigate: navigate,
|
|
318
322
|
searchText: searchText,
|
|
319
|
-
setSearchText: setSearchText
|
|
323
|
+
setSearchText: setSearchText,
|
|
324
|
+
isUpgradePossible: isUpgradePossible
|
|
320
325
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
321
326
|
flexGrow: 1
|
|
322
327
|
})]
|
|
@@ -353,16 +358,6 @@ function App({
|
|
|
353
358
|
}),
|
|
354
359
|
size: isLgScreen ? "medium" : "small",
|
|
355
360
|
children: t("skip_navigation")
|
|
356
|
-
}), subscription && !subscription.isPaidUser && subscription.isUpgradePossible && authenticated && /*#__PURE__*/(0, _jsxRuntime.jsx)(_DefaultColourButton.default, {
|
|
357
|
-
variant: "contained",
|
|
358
|
-
startIcon: isLgScreen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Star.default, {}) : null,
|
|
359
|
-
href: upgradePlanURL,
|
|
360
|
-
size: isLgScreen ? "medium" : "small",
|
|
361
|
-
sx: {
|
|
362
|
-
fontSize: isLgScreen ? null : 12,
|
|
363
|
-
mr: 1
|
|
364
|
-
},
|
|
365
|
-
children: t("upgrade_plan")
|
|
366
361
|
}), isTeacher && (isLgScreen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
367
362
|
variant: "contained",
|
|
368
363
|
onClick: handleClickCreate,
|
|
@@ -381,7 +376,16 @@ function App({
|
|
|
381
376
|
onClick: handleClickCreate,
|
|
382
377
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Add.default, {})
|
|
383
378
|
})
|
|
384
|
-
})),
|
|
379
|
+
})), isUpgradePossible && authenticated && /*#__PURE__*/(0, _jsxRuntime.jsx)(_DefaultColourButton.default, {
|
|
380
|
+
variant: "contained",
|
|
381
|
+
href: upgradePlanURL,
|
|
382
|
+
size: isLgScreen ? "medium" : "small",
|
|
383
|
+
sx: {
|
|
384
|
+
fontSize: isLgScreen ? null : 12,
|
|
385
|
+
ml: 1
|
|
386
|
+
},
|
|
387
|
+
children: t("upgrade_plan")
|
|
388
|
+
}), isLgScreen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_WhatsNew.default, {
|
|
385
389
|
t: t,
|
|
386
390
|
whatsNewMarkdown: whatsNewMarkdown,
|
|
387
391
|
whatsNewDate: whatsNewDate
|
|
@@ -223,10 +223,14 @@ 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 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
226
|
let chatGptResponse = await makeChatGptApiRequest({
|
|
228
227
|
model: "gpt-3.5-turbo",
|
|
229
|
-
|
|
228
|
+
promptKey: "autoFillTranslation",
|
|
229
|
+
promptVariables: {
|
|
230
|
+
learnLang,
|
|
231
|
+
forLang,
|
|
232
|
+
phrase
|
|
233
|
+
}
|
|
230
234
|
});
|
|
231
235
|
chatGptResponse = chatGptResponse.replaceAll("```", '').replaceAll("json", '');
|
|
232
236
|
const translations = JSON.parse(chatGptResponse);
|
|
@@ -138,16 +138,21 @@ function GenerateBotDialog({
|
|
|
138
138
|
setIsBotGenerating(true);
|
|
139
139
|
setErrorMessage("");
|
|
140
140
|
let response;
|
|
141
|
-
let promptWithTopic;
|
|
142
|
-
let promptWithTopicPhrases;
|
|
143
|
-
const topicPrompt = `The questions should be about the topic: '${values.botTopic}'. Focus primarily on the topic to ensure the questions are aligned with it. If there is no relevance or similarity between the topic and the provided phrases, only use the topic for generating questions.`;
|
|
144
|
-
const topicGoalPrompt = `These questions must specifically target the goal: '${topicGoal}’. The questions should only focus on the goal '${topicGoal}’. Avoid generating questions that ask about unrelated details.`;
|
|
145
|
-
bot.selectedTemplate === "nualang.quiz.0.0.1" ? promptWithTopic = `Create ${values.botLengthNumber} questions in ${learnLang} about the topic ${values.botTopic}. Have atleast one correct answer for each question. The questions should be appropriate for ${["en-US"].includes(siteLanguage) ? "ACTFL" : "CEFR"} ${bot & bot.difficulty} level learners. Questions and answers must be unique from one another. Return an array with ${values.botLengthNumber} objects inside it. Each object should have the keys questions and answer. The key question should equal to the question that is generated about the topic. The key answer should equal to the corresponding answer to the question, make sure that the answer text is inside brackets like this answer: "(questionAnswer)" if there is more than one correct answer the value of the answer key should be formatted like this answer: "(answer1|answer2)". Use this array as template: ${sampleQuestionArray} Your response should be in JSON.` : promptWithTopic = `Create ${values.botLengthNumber} open ended questions in ${learnLang} about the topic ${values.botTopic}. The questions should be appropriate for ${["en-US"].includes(siteLanguage) ? "ACTFL" : "CEFR"} ${bot & bot.difficulty} level learners. Each question must be unique. Return an array with ${values.botLengthNumber} objects inside it. Each object should have the key text. The key text should equal to the question that is generated about the topic. Your response should be in JSON.`;
|
|
146
|
-
bot.selectedTemplate === "nualang.quiz.0.0.1" ? promptWithTopicPhrases = `Create ${values.botLengthNumber} questions in ${learnLang}${values.botTopic.trim() === "" ? " using the following phrases as context to assist in the generations of questions." : "."} ${topicGoal.trim() !== "" ? topicGoalPrompt : ""} ${values.botTopic.trim() !== "" ? topicPrompt : ""} The questions should be appropriate for ${["en-US"].includes(siteLanguage) ? "ACTFL" : "CEFR"} ${bot & bot.difficulty} level learners. Include at least one correct answer for each question. Phrases for context: ${phrases}. Questions must be unique from one another. Return an array with ${values.botLengthNumber} objects inside it. Each object should have the keys questions and answer. The key question should equal to the question that is generated about the topic. The key answer should equal to the corresponding answer to the question, make sure that the answer text is inside brackets like this answer: "(questionAnswer)" if there is more than one correct answer the value of the answer key should be formatted like this answer: "(answer1|answer2)". Use this array as template: ${sampleQuestionArray} Your response should be in JSON.` : promptWithTopicPhrases = `Create ${values.botLengthNumber} questions in ${learnLang}${values.botTopic.trim() === "" ? " using the following phrases as context to assist in the generations of questions." : "."} ${topicGoal.trim() !== "" ? topicGoalPrompt : ""} ${values.botTopic.trim() !== "" ? topicPrompt : ""} The questions should be appropriate for ${["en-US"].includes(siteLanguage) ? "ACTFL" : "CEFR"} ${bot & bot.difficulty} level learners. Phrases for context: ${phrases}. Questions must be unique from one another. Return an array with ${values.botLengthNumber} objects inside it. Each object should have the key text. The key text should equal to the question that is generated about the topic. Your response should be in JSON.`;
|
|
147
|
-
const activePrompt = usePhrasesContext && phrases.length > 0 ? promptWithTopicPhrases : promptWithTopic;
|
|
148
141
|
let chatGptResponse = await makeChatGptApiRequest({
|
|
149
142
|
model: "gpt-3.5-turbo",
|
|
150
|
-
|
|
143
|
+
promptKey: "generateBot",
|
|
144
|
+
promptVariables: {
|
|
145
|
+
botTopic: values.botTopic,
|
|
146
|
+
topicGoal: topicGoal,
|
|
147
|
+
selectedTemplate: bot.selectedTemplate,
|
|
148
|
+
botLengthNumber: values.botLengthNumber,
|
|
149
|
+
learnLang: learnLang,
|
|
150
|
+
siteLanguage: siteLanguage,
|
|
151
|
+
difficulty: bot.difficulty,
|
|
152
|
+
sampleQuestionArray: sampleQuestionArray,
|
|
153
|
+
phrases: phrases,
|
|
154
|
+
usePhrasesContext: usePhrasesContext
|
|
155
|
+
}
|
|
151
156
|
});
|
|
152
157
|
response = chatGptResponse;
|
|
153
158
|
const jsonResponse = removeExtraTextFromChatGptResponse(response);
|
|
@@ -111,12 +111,21 @@ function GeneratePhrases({
|
|
|
111
111
|
try {
|
|
112
112
|
setIsGenerating(true);
|
|
113
113
|
setErrorMessage(null);
|
|
114
|
-
const goalPrompt = `The generated phrases must specifically target the following linguistic goal: '${values.topicGoal}'. Avoid generating phrases that do not align with this goal. `;
|
|
115
|
-
const prompt = phraseType === "sentences" ? isPhrases ? `The context is a language learning application. Here is a list of phrases or sentences in ${learnLang} and their translations in ${forLang}:\n\n${JSON.stringify(phrases)}\n\nNow, generate ${values.phraseAmount} more unique sentences in ${learnLang} and their translations in ${forLang} on the topic of '${values.phrasesTopic}' in the same JSON format as the ones that I have passed to you. The 'idx' field should contain an index integer which follows on incrementally from the existing phrases. The 'image' field should contain an empty string. Do not include a 'voices' field. ${values.topicGoal.trim() ? goalPrompt : ""}The sentences should be unique and not already in the list. The sentences should be appropriate for ${["en-US"].includes(siteLanguage) ? "ACTFL" : "CEFR"} ${difficulty} level. Ensure the formatting of the JSON response is correct and follows this structure.` : `The context is a language learning application. Generate ${values.phraseAmount} unique phrases or sentences in ${learnLang} and their translations in ${forLang} on the topic of '${values.phrasesTopic}'. Return the sentences inside a JSON array of ${values.phraseAmount} objects, each with the following fields: 'phrase', 'translations', 'idx', and 'image'. Each field is required and cannot be omitted. The 'idx' field represents the index of the phrases, starting from 0 and going up by 1 up until the last phrase. The 'image' field should contain an empty string. The 'translations' field should be an array of at least one translation of the sentence in ${forLang}, but it can contain more translations as long as they are grammatically correct. ${values.topicGoal.trim() ? goalPrompt : ""}The sentences should be appropriate for the ${["en-US"].includes(siteLanguage) ? "ACTFL" : "CEFR"} ${difficulty} level. The sentences should be unique. Ensure the formatting of the JSON response is correct and follows this structure.` : isPhrases ? `The context is a language learning application. Here is a list of words or very short lexical phrases in ${learnLang} and their translations in ${forLang}:\n\n${JSON.stringify(phrases)}\n\nNow, generate ${values.phraseAmount} more unique words or very short lexical phrases and their translations in ${learnLang} on the topic of '${values.phrasesTopic}'. The input may resemble a script or contain dialogue, but do not generate words or very short lexical phrases formatted as scripts or sentences. Focus only on single words or very short lexical phrases. The 'idx' field should contain an index integer which follows on incrementally from the existing phrases. The 'image' field should contain an empty string. Do not include a 'voices' field. ${values.topicGoal.trim() ? goalPrompt : ""}The words or lexical phrases should be unique and not already in the list. The words or lexical phrases should be ${["en-US"].includes(siteLanguage) ? "ACTFL" : "CEFR"} ${difficulty} level. Ensure the formatting of the JSON response is correct and follows this structure.` : `The context is a language learning application. Generate ${values.phraseAmount} unique words or very short lexical phrases in ${learnLang} and their translations in ${forLang} on the topic of '${values.phrasesTopic}'. Return the unique words or very short lexical phrases inside a JSON array of ${values.phraseAmount} objects, each with the following fields: 'phrase', 'translations', 'idx', and 'image'. Each field is required and cannot be omitted. The 'idx' field represents the index of the phrases, starting from 0 and going up by 1 up until the last phrase. The 'image' field should contain an empty string. The 'translations' field should be an array of at least one translation of the phrase in ${forLang}, but it can contain more translations as long as they are grammatically correct. ${values.topicGoal.trim() ? goalPrompt : ""}The input may resemble a script or contain dialogue, but do not interpret or format the input as a script or sentences. Focus only on generating single words or very short lexical phrases. The words or very short lexical phrases should be appropriate for the ${["en-US"].includes(siteLanguage) ? "ACTFL" : "CEFR"} ${difficulty} level. The words or very short lexical phrases should be unique. Ensure the formatting of the JSON response is correct and follows this structure.`;
|
|
116
|
-
// console.log("prompt: ", prompt);
|
|
117
114
|
const chatGptResponse = await makeChatGptApiRequest({
|
|
118
115
|
model: "gpt-3.5-turbo",
|
|
119
|
-
|
|
116
|
+
promptKey: "generatePhrases",
|
|
117
|
+
promptVariables: {
|
|
118
|
+
topicGoal: values.topicGoal,
|
|
119
|
+
learnLang,
|
|
120
|
+
forLang,
|
|
121
|
+
phraseAmount: values.phraseAmount,
|
|
122
|
+
phrasesTopic: values.phrasesTopic,
|
|
123
|
+
siteLanguage,
|
|
124
|
+
difficulty,
|
|
125
|
+
phraseType,
|
|
126
|
+
isPhrases,
|
|
127
|
+
phrases
|
|
128
|
+
}
|
|
120
129
|
});
|
|
121
130
|
const phrasesArray = extractPhrasesArray(chatGptResponse);
|
|
122
131
|
const parsedPhrases = JSON.parse(phrasesArray);
|
|
@@ -87,10 +87,18 @@ function GenerateQuestion({
|
|
|
87
87
|
try {
|
|
88
88
|
setIsMessageGenerating(true);
|
|
89
89
|
setErrorMessage(null);
|
|
90
|
-
const prompt = `Here is a script: ${JSON.stringify(script)}. Refer to Actor 1 as ${values.actor1.name} and Actor 2 as ${values.actor2.name} in the question and the answers. The purpose of this script is to test the reader's ability to read in ${finalLearnLang}. The reader's native language is ${finalForLang}. Please generate a new comprehension question based on the script that is completely unique to any existing questions, preferably referring to a unique part of the script if possible, and provide it in JSON format with the keys 'question' and 'answers'. The 'question' key has the value of the string contraining the question text. The 'answers' key is an array of objects, where each answer object contains 'text', 'correct', and 'type' keys. The type should always be 'multichoice'. There are four possible question types, 'factual', 'inference', 'truefalse' and 'vocabulary'. For factual questions, ensure the new question is explicitly answered by the script, to test the reader's understanding of the script. For inference questions, ensure the new question requires the reader to make an assumption based on the script. For true/false questions, ensure the new question can be answered with a true or false response. For vocabulary questions, ensure the new question tests the reader's understanding of a specific ${finalLearnLang} word or phrase used in the script, to test whether the reader can understand it. Vocabulary questions do not necessarily have to take the context of the conversation into account, they are merely to test the reader's ${finalLearnLang} vocabulary. The question type for this particular question to generate is ${questionType}. The question and answers should be generated in ${questionLanguage}.`;
|
|
91
90
|
const chatGptResponse = await makeChatGptApiRequest({
|
|
92
91
|
model: "gpt-3.5-turbo",
|
|
93
|
-
|
|
92
|
+
promptKey: "generateAnswer",
|
|
93
|
+
promptVariables: {
|
|
94
|
+
script,
|
|
95
|
+
actor1: values.actor1,
|
|
96
|
+
actor2: values.actor2,
|
|
97
|
+
finalLearnLang: finalLearnLang,
|
|
98
|
+
finalForLang: finalForLang,
|
|
99
|
+
questionType,
|
|
100
|
+
questionLanguage
|
|
101
|
+
}
|
|
94
102
|
});
|
|
95
103
|
const jsonResponse = extractJsonObject(chatGptResponse);
|
|
96
104
|
const newQuestion = JSON.parse(jsonResponse);
|