From 514579918f0c5d84442dde4e21ade44ba5e60f50 Mon Sep 17 00:00:00 2001 From: tmaog Date: Fri, 15 Nov 2024 16:24:51 +0100 Subject: [PATCH 1/6] fix: setupModel update --- src/data/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/api.ts b/src/data/api.ts index f132484..baa72c1 100644 --- a/src/data/api.ts +++ b/src/data/api.ts @@ -60,7 +60,7 @@ const AIAPIGeneration = axiosCreate.create({ SetupModel: '{"secretKey": "' + process.env.SETUPMODEL + - '","modelName": "gpt35Turbo","endpoint": "https://ai4edu.openai.azure.com/"}', + '","modelName": "GPT-4o-MINI","endpoint": "https://ai4edu.openai.azure.com/"}', }, }); From 0b54c5840838ad98b486bac1325f644c202fa7bc Mon Sep 17 00:00:00 2001 From: tmaog Date: Fri, 2 May 2025 11:21:03 +0200 Subject: [PATCH 2/6] fix: bug cach clear --- src/pages/flows/[id]/index.tsx | 2 ++ src/utils/cache.ts | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 src/utils/cache.ts diff --git a/src/pages/flows/[id]/index.tsx b/src/pages/flows/[id]/index.tsx index 8189690..c1c5cf9 100644 --- a/src/pages/flows/[id]/index.tsx +++ b/src/pages/flows/[id]/index.tsx @@ -20,6 +20,7 @@ import { APIV2 } from '../../../data/api'; import useStore from '../../../store'; import { PolyglotFlow } from '../../../types/polyglotElements'; import auth0 from '../../../utils/auth0'; +import { clearFlowCaches } from '../../../utils/cache'; type FlowIndexProps = { accessToken: string | undefined; @@ -66,6 +67,7 @@ const FlowIndex = ({ accessToken }: FlowIndexProps) => { }); if (returnPath) router.push(returnPath); storeState.updateFlowInfo(response.data); + clearFlowCaches(response.data._id); } else { outputToast && toast({ diff --git a/src/utils/cache.ts b/src/utils/cache.ts new file mode 100644 index 0000000..565084a --- /dev/null +++ b/src/utils/cache.ts @@ -0,0 +1,9 @@ + +export function clearFlowCaches(flowId: string) { + try { + localStorage.removeItem('flow'); + localStorage.removeItem('rescue-' + flowId); + } catch (error) { + console.warn('Failed to clear flow caches', error); + } + } \ No newline at end of file From bcb31fa653610e55f73bd17d685ea0c24661861e Mon Sep 17 00:00:00 2001 From: tmaog Date: Fri, 2 May 2025 11:21:45 +0200 Subject: [PATCH 3/6] fix: bug cach clear --- src/utils/cache.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/utils/cache.ts b/src/utils/cache.ts index 565084a..a9aaec1 100644 --- a/src/utils/cache.ts +++ b/src/utils/cache.ts @@ -1,9 +1,8 @@ - export function clearFlowCaches(flowId: string) { - try { - localStorage.removeItem('flow'); - localStorage.removeItem('rescue-' + flowId); - } catch (error) { - console.warn('Failed to clear flow caches', error); - } - } \ No newline at end of file + try { + localStorage.removeItem('flow'); + localStorage.removeItem('rescue-' + flowId); + } catch (error) { + console.warn('Failed to clear flow caches', error); + } +} From 3f95f25132d4fc65ea31f16774e92de40c44b87e Mon Sep 17 00:00:00 2001 From: tmaog Date: Thu, 8 May 2025 15:30:25 +0200 Subject: [PATCH 4/6] fix: data bug --- src/components/Card/PlanLessonCard.tsx | 5 +++-- src/components/Modals/AIToolModal.tsx | 2 +- src/components/Modals/CreateAILPModal.tsx | 9 +++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/Card/PlanLessonCard.tsx b/src/components/Card/PlanLessonCard.tsx index 798bda3..8b28ecf 100644 --- a/src/components/Card/PlanLessonCard.tsx +++ b/src/components/Card/PlanLessonCard.tsx @@ -27,6 +27,7 @@ type FlowCardProps = { px?: SpaceProps['px']; id: number; isSelected: boolean; + suggestedType: string; setSelectedNode: (id: number) => void; updateNodeAt: (id: number, updatedNode: PlanLessonNode) => void; }; @@ -45,13 +46,13 @@ const PlanLessonCard = ({ setSelectedNode, isSelected, updateNodeAt, + suggestedType, }: FlowCardProps) => { const [specificData, setSpecificData] = useState({ solutions_number: 1, distractors_number: 1, easily_discardable_distractors_number: 1, }); - const planNodeSuggestedType = planNode.type; useEffect(() => { @@ -79,7 +80,7 @@ const PlanLessonCard = ({ Topic: {planNode.topic} - Type: {planNode.type} + Suggested Type: {suggestedType} Details: {planNode.details} diff --git a/src/components/Modals/AIToolModal.tsx b/src/components/Modals/AIToolModal.tsx index 15e8da8..83737c8 100644 --- a/src/components/Modals/AIToolModal.tsx +++ b/src/components/Modals/AIToolModal.tsx @@ -411,7 +411,7 @@ const AIToolModal = ({ break; case 'short answer question': adaptedData = { - question: dataGen.assignment, + question: dataGen.assignment + ' ' + dataGen.plus, correctAnswers: dataGen.solutions, }; break; diff --git a/src/components/Modals/CreateAILPModal.tsx b/src/components/Modals/CreateAILPModal.tsx index d2ca88d..8b64a12 100644 --- a/src/components/Modals/CreateAILPModal.tsx +++ b/src/components/Modals/CreateAILPModal.tsx @@ -77,7 +77,7 @@ const dataFactory: Record any> = { possibleAnswer: values.solutions[0], }), closeEndedQuestionNode: (values) => ({ - question: values.assignment, + question: values.assignment + ' ' + values.plus, correctAnswers: values.solutions, isAnswerCorrect: [], }), @@ -539,7 +539,7 @@ const CreateAILPModal = ({ isOpen, onClose, action }: ModaTemplateProps) => { if (!learningOutcome || !eduLevel) { throw new Error('Missing learningOutcome or eduLevel'); } - API.planLesson({ + await API.planLesson({ topics: selectedTopic, learning_outcome: learningOutcome, language: analysedMaterial.language, @@ -717,7 +717,7 @@ const CreateAILPModal = ({ isOpen, onClose, action }: ModaTemplateProps) => {