Skip to content

Commit 88eb93d

Browse files
wip
1 parent 2d2cd9f commit 88eb93d

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

src/components/tutor/SummariesStep.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { ref } from 'vue';
1010
const props = defineProps<{
1111
summaries: [string];
1212
files: File;
13-
updateSummary: () => void;
13+
updateSummary: (index: number, content: string) => void;
1414
action: () => void;
1515
actionText?: string;
1616
disabled: boolean;

src/stores/tutor.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,19 @@ export const useTutorStore = defineStore('tutor', () => {
8383
};
8484
};
8585

86-
// const summaries = ref<[string]>([
87-
// "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.",
88-
// "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."
89-
// ]);
90-
9186
const summaries = ref<[string]>([]);
9287

93-
const updateSummary = (index, content) => {
88+
const updateSummary = (index: number, content: string) => {
9489
summaries.value[index] = content;
9590
};
9691

9792
const updateSyllabus = (index, content) => {
9893
syllabi.value[index] = content;
94+
};
95+
96+
const syllabusLanguage: Ref<string> = ref(i18n.global.locale.value);
97+
const selectSyllabusLanguage = (lang: string) => {
98+
syllabusLanguage.value = lang;
9999
};
100100

101101
const getFilesContent = async (arg: File[]) => {
@@ -108,17 +108,24 @@ export const useTutorStore = defineStore('tutor', () => {
108108
}
109109
});
110110
try {
111-
const resp = await postAxios('/tutor/files/content', formData, {
111+
const resp = await postAxios(
112+
`/tutor/files/content?lang=${syllabusLanguage.value}`,
113+
formData,
114+
{
112115
headers: { 'content-type': 'multipart/form-data' }
113-
});
116+
}
117+
);
114118
if (resp.status === 204) {
115119
shouldRetryAction.value = true;
116120
throw new Error('retry getFilesContent');
117121
} else {
118-
const red_summaries = resp.data.extracts.reduce((acc, curr) => {
122+
const red_summaries = resp.data.extracts.reduce(
123+
(acc: string[], curr: { summary: string }) => {
119124
acc = [...acc, curr.summary];
120125
return acc;
121-
}, []);
126+
},
127+
[]
128+
);
122129
summaries.value = red_summaries;
123130
goNext();
124131
isLoading.value = false;
@@ -217,11 +224,6 @@ export const useTutorStore = defineStore('tutor', () => {
217224
hasNewSearch.value = true;
218225
};
219226

220-
const syllabusLanguage: Ref<string> = ref(i18n.global.locale.value);
221-
const selectSyllabusLanguage = (lang: string) => {
222-
syllabusLanguage.value = lang;
223-
};
224-
225227
const retrieveSyllabus = async () => {
226228
if (!tutorSearch.value) {
227229
throw new Error('Body is empty');

src/views/TutorPage.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const getI18nText = computed(() => {
2525
};
2626
});
2727
28-
const stepToAction: Record<0 | 1 | 2 | 3, () => Promise<void>> = {
28+
const stepToAction: Record<0 | 1 | 2 | 3 | 4, () => Promise<void>> = {
2929
1: store.handleSummaryFiles,
3030
2: store.retrieveTutorSearch,
3131
3: store.handleCreateSyllabus,

0 commit comments

Comments
 (0)