Skip to content

Commit 5cecc3f

Browse files
feat(about): adds info per corpus
1 parent e02802d commit 5cecc3f

File tree

4 files changed

+107
-9
lines changed

4 files changed

+107
-9
lines changed

src/localisation/en.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,16 @@ export const en = {
170170
en: 'English'
171171
},
172172
landing: {
173+
sourceNameTitle: 'Resource Name',
174+
sourceUrlTitle: 'Resource Link',
175+
sourceNumberTitle: 'Number of Documents',
176+
sourcesTitle: 'About Our Resources',
177+
sourcesDescription_1:
178+
'WeLearn brings together open, reliable, and high-quality resources, all related to the Sustainable Development Goals (SDGs), drawn from the analysis of over 16 million online documents.',
179+
sourcesDescription_2:
180+
'Resources are selected based on three criteria: openness (open-access documents), reliability (recognized collections), and relevance, using a classification model that retains only content linked to one of the 17 SDGs.',
181+
sourcesDescription_3: 'The table below shows the distribution of documents by source:',
182+
173183
slogan: 'Sustainability Education Made Easy',
174184
description:
175185
'Explore resources, learn, and boost sustainability integration in your courses with AI.',

src/localisation/fr.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,16 @@ export const fr = {
174174
en: 'Anglais'
175175
},
176176
landing: {
177+
sourceNameTitle: 'Nom de la resource',
178+
sourceUrlTitle: 'Lien vers la resource',
179+
sourceNumberTitle: 'Nombre de documents',
180+
sourcesTitle: 'A propos de nos resources',
181+
sourcesDescription_1:
182+
'WeLearn rassemble des ressources ouvertes, fiables et de haute qualité, toutes liées aux Objectifs de développement durable (ODD), issues de l’analyse de plus de 16 millions de documents en ligne.',
183+
sourcesDescription_2:
184+
'Les ressources sont sélectionnées selon trois critères : l’ouverture (documents en libre accès), la fiabilité (collections reconnues) et la pertinence, grâce à un modèle de classification qui ne retient que les contenus liés à l’un des 17 ODD.',
185+
sourcesDescription_3:
186+
'Le tableau ci-dessous présente la répartition des documents par source :',
177187
slogan: 'L’éducation à la durabilité, facilitée',
178188
description:
179189
'Explorez des ressources, apprenez et renforcez l’intégration de la durabilité dans vos cours avec l’IA.',

src/stores/sources.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import i18n from '@/localisation/i18n';
66

77
export const useSourcesStore = defineStore('sources', () => {
88
const sourcesList = ref<ReducedCorpus[]>([]);
9+
const infoPerCorpus: Ref<[]> = ref([]);
910
async function getSourcesList() {
1011
if (sourcesList.value.length > 0) {
1112
return;
@@ -35,6 +36,19 @@ export const useSourcesStore = defineStore('sources', () => {
3536

3637
const totalDocs: Ref<number> = ref(0);
3738

39+
const getInfoPerCorpus = async () => {
40+
if (infoPerCorpus.value.length > 0) {
41+
return;
42+
}
43+
try {
44+
const response = await getAxios('/metric/nb_docs_info_per_corpus');
45+
infoPerCorpus.value = response;
46+
} catch {
47+
console.error('unable to get info per corpus');
48+
infoPerCorpus.value = [];
49+
}
50+
};
51+
3852
const getNbDocsInBase = async () => {
3953
if (totalDocs.value > 0) {
4054
return;
@@ -43,5 +57,12 @@ export const useSourcesStore = defineStore('sources', () => {
4357
const flooredNb = Math.floor(response.nb_docs / 100) * 100;
4458
totalDocs.value = new Intl.NumberFormat(i18n.global.locale.value).format(flooredNb);
4559
};
46-
return { totalDocs, getNbDocsInBase, getSourcesList, sourcesList };
60+
return {
61+
infoPerCorpus,
62+
getInfoPerCorpus,
63+
totalDocs,
64+
getNbDocsInBase,
65+
getSourcesList,
66+
sourcesList
67+
};
4768
});

src/views/AboutPage.vue

Lines changed: 65 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
<script setup lang="ts">
2+
import { useSourcesStore } from '@/stores/sources';
3+
import { onBeforeMount } from 'vue';
4+
import i18n from '@/localisation/i18n';
5+
6+
const sourcesStore = useSourcesStore();
7+
8+
onBeforeMount(() => {
9+
sourcesStore.getInfoPerCorpus();
10+
});
11+
</script>
112
<template>
213
<div class="wrapper py-6">
314
<div class="presentation is-flex is-fullwidth is-justify-content-center is-align-items-center">
@@ -8,14 +19,6 @@
819
<p class="subtitle has-text-centered mt-4 mb-6">
920
{{ $t('landing.description') }}
1021
</p>
11-
12-
<!-- <div class="is-flex mb-6 is-justify-content-space-around is-align-items-center"> -->
13-
<!-- <p class="is-size-5 has-text-weight-semibold">+ 5 000 000 documents traités</p> -->
14-
<!-- <p class="is-size-5 has-text-weight-semibold">+ {{ totalDocs }} documents retenus</p> -->
15-
<!-- <p class="is-size-5 has-text-weight-semibold"> -->
16-
<!-- À partir de{{ sourcesList.length }} corpus -->
17-
<!-- </p> -->
18-
<!-- </div> -->
1922
</div>
2023
</div>
2124

@@ -36,6 +39,42 @@
3639
</p>
3740
</div>
3841

42+
<div class="section mt-6" v-if="sourcesStore?.infoPerCorpus?.length > 0">
43+
<div class="description mx-auto">
44+
<h1 class="subtitle has-text-weight-bold mb-2">{{ $t('landing.sourcesTitle') }} ></h1>
45+
<p class="subtitle is-size-6">
46+
{{ $t('landing.sourcesDescription_1') }}
47+
</p>
48+
<p class="subtitle is-size-6">
49+
{{ $t('landing.sourcesDescription_2') }}
50+
</p>
51+
<p class="subtitle is-size-6 pb-2">
52+
{{ $t('landing.sourcesDescription_3') }}
53+
</p>
54+
<div class="table-wrapper">
55+
<table class="sources-table">
56+
<thead>
57+
<tr>
58+
<th>{{ $t('landing.sourceNameTitle') }}</th>
59+
<th>{{ $t('landing.sourceUrlTitle') }}</th>
60+
<th class="qty-sources">{{ $t('landing.sourceNumberTitle') }}</th>
61+
</tr>
62+
</thead>
63+
<tbody>
64+
<tr v-for="source in sourcesStore.infoPerCorpus" :key="source.corpus">
65+
<td>{{ $t(`corpus.${source.corpus}`, source.corpus) }}</td>
66+
<td>
67+
<a target="_blanc" :href="source.url">{{ source.url }}</a>
68+
</td>
69+
<td class="qty-sources">
70+
{{ new Intl.NumberFormat(i18n.global.locale.value).format(source.qty_in_qdrant) }}
71+
</td>
72+
</tr>
73+
</tbody>
74+
</table>
75+
</div>
76+
</div>
77+
</div>
3978
<div class="section mt-6">
4079
<div class="is-flex is-fullwidth is-justify-content-space-evenly">
4180
<div class="description">
@@ -101,6 +140,24 @@
101140
</template>
102141

103142
<style scoped>
143+
.sources-table {
144+
width: 100%;
145+
}
146+
147+
.sources-table th {
148+
text-align: left;
149+
padding-left: 0;
150+
}
151+
152+
.sources-table td {
153+
padding-left: 0;
154+
padding-right: 0;
155+
}
156+
157+
.sources-table .qty-sources {
158+
text-align: right;
159+
}
160+
104161
.wrapper {
105162
width: 100%;
106163
}

0 commit comments

Comments
 (0)