-
{{ $t('tutor.thirdStep.title') }}
+
+
4 - {{ $t('tutor.thirdStep.title') }}
{{ $t('tutor.thirdStep.description') }}
-
+
+
+
+
+
+
+
-
+
+
+
+
+
diff --git a/src/localisation/en.ts b/src/localisation/en.ts
index dd9b0ae..2b8fef7 100644
--- a/src/localisation/en.ts
+++ b/src/localisation/en.ts
@@ -314,7 +314,8 @@ export const en = {
retry: {
title: 'Please try again',
description: 'An issue occurred while extracting the provided content, please try again.',
- button: 'retry'
+ button: 'retry',
+ stop: 'cancel'
},
loading: {
wait: 'Please wait',
@@ -329,6 +330,12 @@ export const en = {
'WeLearn is generating your syllabus from the documents provided. This step may take a few minutes.'
}
},
+ summaries: {
+ noFileName: 'No file name provided',
+ title: 'Uploaded documents summaries',
+ description:
+ 'WeLearn has extracted the following summaries from your uploaded documents. You can review them before proceeding to the next step.'
+ },
firstStep: {
acceptedFiles: 'Accepted file types: PDF, TXT, DOCX',
searchError: 'No results were found for the provided document.',
@@ -336,6 +343,8 @@ export const en = {
description:
'To get started, upload one or more reference documents your course is based on. They will be used to generate your syllabus.',
cursusDescriptionTitle: 'Course information',
+ cursusDescriptionDescription:
+ 'Fill in the information about your course. It will be used to generate a syllabus that adapts to your needs.',
cursusTitleLabel: 'Title',
cursusTitlePlaceholder: 'Sociolinguistics 101',
cursusLevelLabel: 'Level of study',
@@ -368,5 +377,9 @@ export const en = {
},
previous: 'Previous',
previous_page: 'Previous page',
- next_page: 'Next page'
+ next_page: 'Next page',
+ validate: 'Validate',
+ validated: 'Validated',
+ edit: 'Edit',
+ save: 'Save'
};
diff --git a/src/localisation/fr.ts b/src/localisation/fr.ts
index edff1e2..8acc390 100644
--- a/src/localisation/fr.ts
+++ b/src/localisation/fr.ts
@@ -321,7 +321,8 @@ export const fr = {
title: 'Veuillez réessayer',
description:
"Un problème est survenu lors de l'extraction du contenu renseigné, veuillez relancer.",
- button: 'relancer la requếte'
+ button: 'relancer la requête',
+ stop: 'annuler'
},
loading: {
wait: 'Veuillez patienter',
@@ -336,6 +337,12 @@ export const fr = {
'WeLearn génère votre syllabus à partir des documents fournis. Cette étape peut prendre quelques minutes.'
}
},
+ summaries: {
+ noFileName: 'Aucun nom de fichier fourni',
+ title: 'Résumés des documents importés',
+ description:
+ 'WeLearn a extrait les points clés de vos documents importés pour générer le syllabus.'
+ },
firstStep: {
acceptedFiles: 'Types de fichiers acceptés : PDF, TXT, DOCX',
searchError: 'Aucun résultat trouvé pour le document fourni.',
@@ -343,6 +350,8 @@ export const fr = {
description:
'Pour commencer, importez un ou plusieurs documents de référence sur lesquels s’appuie votre cours. Ils serviront à générer votre syllabus.',
cursusDescriptionTitle: 'Informations sur le cours',
+ cursusDescriptionDescription:
+ "Renseignez les informations sur votre cours. Elle seront utilisées pour générer un syllabus qui s'adapte a vos besoins.",
cursusTitleLabel: 'Titre',
cursusTitlePlaceholder: 'Introduction à la sociolinguistique',
cursusLevelLabel: 'Niveau d’études',
@@ -375,5 +384,9 @@ export const fr = {
},
previous: 'Précédent',
previous_page: 'Page précédente',
- next_page: 'Page suivante'
+ next_page: 'Page suivante',
+ validate: 'Valider',
+ validated: 'Validé',
+ edit: 'Modifier',
+ save: 'Enregistrer'
};
diff --git a/src/stores/tutor.ts b/src/stores/tutor.ts
index b1ae1c6..1f6b250 100644
--- a/src/stores/tutor.ts
+++ b/src/stores/tutor.ts
@@ -1,4 +1,5 @@
import { defineStore } from 'pinia';
+import { scrollToAnchor } from '@/utils/navigation.ts';
import { convertMarkdownToDocx, downloadDocx } from '@/utils/md-to-docx';
import _isequal from 'lodash.isequal';
import { type Ref, ref } from 'vue';
@@ -82,7 +83,22 @@ export const useTutorStore = defineStore('tutor', () => {
};
};
- const retrieveTutorSearch = async (arg: File[]) => {
+ // const summaries = ref<[string]>([
+ // "Global warming, a subset of climate change, refers to the long-term rise in the average temperature of the Earth's climate system, primarily caused by human activities such as fossil fuel burning, deforestation, and certain agricultural and industrial practices that release greenhouse gases. These gases trap heat in the lower atmosphere, leading to various environmental impacts like desert expansion, increased frequency of heat waves and wildfires, accelerated Arctic warming, glacier retreat, and sea ice decline. Climate change also affects biodiversity, forcing species to relocate or face extinction, and poses significant threats to human societies, including increased flooding, extreme heat, food and water scarcity, disease, economic loss, and potential human migration and conflict. Even with efforts to minimize future warming, some effects will persist for centuries, including ocean heating, acidification, and sea-level rise. The Paris Agreement aims to limit global warming to well below 2°C, but current pledges still project a rise of about 2.8°C by the end of the century. There is widespread support for climate action, with most countries aiming to stop emitting carbon dioxide. Strategies include phasing out fossil fuels, conserving energy, switching to clean energy sources, and removing carbon from the atmosphere through methods like reforestation and carbon-storing farming practices.",
+ // "The article discusses the XL-Sum dataset, a large-scale multilingual abstractive summarization dataset containing 1 million professionally annotated article-summary pairs from BBC, covering 44 languages. The dataset is designed to address the lack of high-quality datasets for low-resource languages in abstractive summarization. XL-Sum introduces the first publicly available summarization dataset for many languages and achieves competitive results in both multilingual and low-resource summarization tasks. The dataset is created using a custom crawler and a set of heuristics to extract high-quality summaries from BBC articles. Evaluations show that the summaries are highly abstractive, concise, and of high quality, with minimal redundancy. The mT5 model fine-tuned on XL-Sum achieves state-of-the-art results, demonstrating the dataset's effectiveness in abstractive summarization across multiple languages."
+ // ]);
+
+ const summaries = ref<[string]>([]);
+
+ const updateSummary = (index, content) => {
+ summaries.value[index] = content;
+ };
+
+ const updateSyllabus = (index, content) => {
+ syllabi.value[index] = content;
+ };
+
+ const getFilesContent = async (arg: File[]) => {
isLoading.value = true;
shouldRetryAction.value = false;
const formData = new FormData();
@@ -91,11 +107,37 @@ export const useTutorStore = defineStore('tutor', () => {
formData.append('files', file);
}
});
-
try {
- const resp = await postAxios('/tutor/search', formData, {
+ const resp = await postAxios('/tutor/files/content', formData, {
headers: { 'content-type': 'multipart/form-data' }
});
+ console.log(resp);
+ if (resp.status === 204) {
+ shouldRetryAction.value = true;
+ throw new Error('retry getFilesContent');
+ } else {
+ const red_summaries = resp.data.extracts.reduce((acc, curr) => {
+ acc = [...acc, curr.summary];
+ return acc;
+ }, []);
+ summaries.value = red_summaries;
+ goNext();
+ isLoading.value = false;
+ }
+ } catch (error: any) {
+ throw new Error(error);
+ }
+ };
+
+ const stopAction = () => {
+ isLoading.value = false;
+ };
+
+ const retrieveTutorSearch = async (arg: File[]) => {
+ isLoading.value = true;
+
+ try {
+ const resp = await postAxios('/tutor/search_extracts', { summaries: summaries.value });
if (resp.status === 204) {
shouldRetryAction.value = true;
} else {
@@ -105,6 +147,7 @@ export const useTutorStore = defineStore('tutor', () => {
shouldRetryAction.value = false;
goNext();
+ scrollToAnchor('target-3');
}
} catch (error: any) {
console.error('Error during tutor search:', error);
@@ -112,8 +155,8 @@ export const useTutorStore = defineStore('tutor', () => {
if (error.code === 'ERR_NETWORK') {
reloadError.value = true;
}
- setStep(1);
} finally {
+ setStep(3);
searchedFiles.value = arg;
}
};
@@ -128,6 +171,32 @@ export const useTutorStore = defineStore('tutor', () => {
}
};
+ const handleSummaryFiles = async () => {
+ reloadError.value = false;
+ selectedSources.value = [];
+ const arg = Object.values(newFilesToSearch.value).filter((e) => e);
+ if (!arg.length) {
+ console.error('No files selected');
+ return;
+ }
+
+ if (_isequal(searchedFiles.value, arg)) {
+ hasNewSearch.value = false;
+ goNext();
+ return;
+ }
+
+ tutorSearch.value = undefined;
+ try {
+ await getFilesContent(arg);
+ hasNewSearch.value = true;
+ scrollToAnchor('target-2');
+ // goNext();
+ } catch (error) {
+ console.log('get files content did not work');
+ }
+ };
+
const handleSearch = async () => {
reloadError.value = false;
selectedSources.value = [];
@@ -171,6 +240,7 @@ export const useTutorStore = defineStore('tutor', () => {
source.toLowerCase().includes('pedagogicalengineer')
)[0];
hasSyllabusError.value = false;
+ scrollToAnchor('target-4');
} catch (error) {
console.error('Error during syllabus retrieval:', error);
hasSyllabusError.value = true;
@@ -245,6 +315,7 @@ export const useTutorStore = defineStore('tutor', () => {
tutorSearch,
appendSource,
retrieveSyllabus,
+ updateSummary,
handleCreateSyllabus,
hasSearchError,
hasSyllabusError,
@@ -257,6 +328,11 @@ export const useTutorStore = defineStore('tutor', () => {
level,
duration,
shouldRetryAction,
- description
+ description,
+ handleSummaryFiles,
+ summaries,
+ newFilesToSearch,
+ stopAction,
+ updateSyllabus
};
});
diff --git a/src/utils/navigation.ts b/src/utils/navigation.ts
new file mode 100644
index 0000000..58ad80d
--- /dev/null
+++ b/src/utils/navigation.ts
@@ -0,0 +1,3 @@
+export const scrollToAnchor = (id: string) => {
+ document.getElementById(id).scrollIntoView({ behavior: 'smooth' });
+};
diff --git a/src/views/TutorPage.vue b/src/views/TutorPage.vue
index 6961e9c..069ebf7 100644
--- a/src/views/TutorPage.vue
+++ b/src/views/TutorPage.vue
@@ -1,12 +1,14 @@
-
+
@@ -55,13 +60,18 @@ const stepToAction: Record<1 | 2 | 3, () => Promise> = {
{{ $t('tutor.retry.description') }}
-
+
+
+
+