l-min-components 1.7.1334 → 1.7.1336
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/package.json
CHANGED
|
@@ -308,34 +308,6 @@ const AppMainLayout = ({ children }) => {
|
|
|
308
308
|
|
|
309
309
|
const [isAffiliateLoading, setIsAffiliateLoading] = useState(true);
|
|
310
310
|
|
|
311
|
-
const SetupRightBar = ({
|
|
312
|
-
accountType,
|
|
313
|
-
planState,
|
|
314
|
-
affiliateAccount,
|
|
315
|
-
findText,
|
|
316
|
-
}) => {
|
|
317
|
-
switch (accountType) {
|
|
318
|
-
case "enterprise":
|
|
319
|
-
return <EnterpriseRightBar planState={planState} />;
|
|
320
|
-
|
|
321
|
-
case "instructor":
|
|
322
|
-
return affiliateAccount?.id ? (
|
|
323
|
-
<AffiliateRightBar
|
|
324
|
-
planState={planState}
|
|
325
|
-
affiliateAccount={affiliateAccount.id}
|
|
326
|
-
/>
|
|
327
|
-
) : (
|
|
328
|
-
<InstructorRightBar planState={planState} />
|
|
329
|
-
);
|
|
330
|
-
|
|
331
|
-
case "developer":
|
|
332
|
-
return <DeveloperBanner findText={findText} />;
|
|
333
|
-
case "personal":
|
|
334
|
-
default:
|
|
335
|
-
return <DeveloperBanner findText={findText} />;
|
|
336
|
-
}
|
|
337
|
-
};
|
|
338
|
-
|
|
339
311
|
return (
|
|
340
312
|
<OutletContext.Provider
|
|
341
313
|
value={{
|
|
@@ -419,16 +391,15 @@ const AppMainLayout = ({ children }) => {
|
|
|
419
391
|
)}
|
|
420
392
|
</LeftLayout>
|
|
421
393
|
<CenterLayout isOpen={isOpen} style={centerLayoutStyle}>
|
|
422
|
-
{window.location.pathname.includes("instructor")
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
)}
|
|
394
|
+
{(window.location.pathname.includes("instructor") ||
|
|
395
|
+
activeAccountType === "instructor") && (
|
|
396
|
+
<InstructorAccountSwitcher
|
|
397
|
+
// setAccountType={setAffiliatesActive}
|
|
398
|
+
generalData={generalData}
|
|
399
|
+
onChange={(v) => setAffiliateAccount(v)}
|
|
400
|
+
setIsAffiliateLoading={setIsAffiliateLoading}
|
|
401
|
+
/>
|
|
402
|
+
)}
|
|
432
403
|
|
|
433
404
|
{window.location.pathname.includes("enterprise") &&
|
|
434
405
|
(planState === "GRACE PERIOD" ||
|
|
@@ -482,13 +453,22 @@ const AppMainLayout = ({ children }) => {
|
|
|
482
453
|
affiliateAccount={affiliateAccount}
|
|
483
454
|
/>
|
|
484
455
|
) : activeAccountType === "instructor" ? (
|
|
485
|
-
|
|
456
|
+
// <>
|
|
457
|
+
// {affiliateAccount?.id ? (
|
|
458
|
+
// <AffiliateRightBar
|
|
459
|
+
// planState={planState}
|
|
460
|
+
// affiliateAccount={affiliateAccount.id}
|
|
461
|
+
// />
|
|
462
|
+
// ) : (
|
|
463
|
+
// <InstructorRightBar planState={planState} />
|
|
464
|
+
// )}
|
|
465
|
+
|
|
466
|
+
// </>
|
|
467
|
+
affiliateAccount?.id && (
|
|
486
468
|
<AffiliateRightBar
|
|
487
469
|
planState={planState}
|
|
488
470
|
affiliateAccount={affiliateAccount.id}
|
|
489
471
|
/>
|
|
490
|
-
) : (
|
|
491
|
-
<InstructorRightBar planState={planState} />
|
|
492
472
|
)
|
|
493
473
|
) : activeAccountType === "personal" ? (
|
|
494
474
|
<PersonalRightBar
|
package/src/utils/useAiUtils.js
CHANGED
|
@@ -44,8 +44,64 @@ const setupAnalysis = (data, otherValues = {}) => {
|
|
|
44
44
|
return null;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
+
const getDialogueByModal = (ai_model_data) => {
|
|
48
|
+
if (!ai_model_data) return [];
|
|
49
|
+
const speech_analysis_list = ai_model_data?.data?.speech_analysis;
|
|
50
|
+
const dialogues = speech_analysis_list?.map((item) => {
|
|
51
|
+
const data = Object.values(item?.attempt_data)?.[0];
|
|
52
|
+
return {
|
|
53
|
+
data,
|
|
54
|
+
audioText: item?.model_data ? getResponse(item?.model_data) : undefined,
|
|
55
|
+
setupAnalysis: item?.model_data
|
|
56
|
+
? setupAnalysis(
|
|
57
|
+
{ speech_analysis: [{ model_data: item?.model_data }] },
|
|
58
|
+
{ audio: data?.recording }
|
|
59
|
+
)
|
|
60
|
+
: undefined,
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
return dialogues;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const getQuizByModal = (ai_model_data) => {
|
|
67
|
+
if (!ai_model_data) return [];
|
|
68
|
+
|
|
69
|
+
const speech_analysis_list = ai_model_data?.data?.speech_analysis;
|
|
70
|
+
|
|
71
|
+
const grammerSetup = (audio_id) => {
|
|
72
|
+
if (!audio_id) return undefined;
|
|
73
|
+
const grammer_list = ai_model_data?.data?.grammar;
|
|
74
|
+
|
|
75
|
+
if (!grammer_list || grammer_list?.length === 0) return undefined;
|
|
76
|
+
const findGrammer = grammer_list?.find(
|
|
77
|
+
(item) => item?.attempt_data?.recording?.id === audio_id
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
return [{ model_data: findGrammer?.model_data }];
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const quizist = speech_analysis_list?.map((item) => {
|
|
84
|
+
const data = item?.attempt_data;
|
|
85
|
+
return {
|
|
86
|
+
data,
|
|
87
|
+
audioText: item?.model_data ? getResponse(item?.model_data) : undefined,
|
|
88
|
+
setupAnalysis: item?.model_data
|
|
89
|
+
? setupAnalysis(
|
|
90
|
+
{
|
|
91
|
+
speech_analysis: [{ model_data: item?.model_data }],
|
|
92
|
+
grammar: grammerSetup(data?.recording?.id),
|
|
93
|
+
},
|
|
94
|
+
{ audio: data?.recording || data, student_text: data?.text }
|
|
95
|
+
)
|
|
96
|
+
: undefined,
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
return quizist;
|
|
101
|
+
};
|
|
102
|
+
|
|
47
103
|
const useAiUtils = () => {
|
|
48
|
-
return { setupAnalysis, getResponse };
|
|
104
|
+
return { setupAnalysis, getResponse, getDialogueByModal, getQuizByModal };
|
|
49
105
|
};
|
|
50
106
|
|
|
51
107
|
export default useAiUtils;
|