From 1f8f155a3c6ae5d6a97c7ae225d3274c0b9ca8f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Francisco=20Calvo?= Date: Tue, 17 Dec 2024 13:03:40 +0100 Subject: [PATCH 1/8] chore: update packages versions --- argilla-frontend/package.json | 2 +- argilla-server/src/argilla_server/_version.py | 2 +- argilla/src/argilla/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/argilla-frontend/package.json b/argilla-frontend/package.json index 2cd8b1211f..d7d810f803 100644 --- a/argilla-frontend/package.json +++ b/argilla-frontend/package.json @@ -1,6 +1,6 @@ { "name": "argilla", - "version": "2.6.0dev0", + "version": "2.6.0", "private": true, "scripts": { "dev": "nuxt", diff --git a/argilla-server/src/argilla_server/_version.py b/argilla-server/src/argilla_server/_version.py index b8d3a961ee..f2ea41be80 100644 --- a/argilla-server/src/argilla_server/_version.py +++ b/argilla-server/src/argilla_server/_version.py @@ -15,4 +15,4 @@ # coding: utf-8 # -__version__ = "2.6.0dev0" +__version__ = "2.6.0" diff --git a/argilla/src/argilla/_version.py b/argilla/src/argilla/_version.py index 95df7d76ea..4ba88b7b80 100644 --- a/argilla/src/argilla/_version.py +++ b/argilla/src/argilla/_version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2.6.0dev0" +__version__ = "2.6.0" From 3b105af8770cdbc75001cb7d66a1dd66146dfc3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Francisco=20Calvo?= Date: Tue, 17 Dec 2024 13:04:02 +0100 Subject: [PATCH 2/8] chore: update CHANGELOG.md versions --- argilla-frontend/CHANGELOG.md | 2 ++ argilla-server/CHANGELOG.md | 2 ++ argilla/CHANGELOG.md | 2 ++ 3 files changed, 6 insertions(+) diff --git a/argilla-frontend/CHANGELOG.md b/argilla-frontend/CHANGELOG.md index 3bc635ca4e..5cddb6d43e 100644 --- a/argilla-frontend/CHANGELOG.md +++ b/argilla-frontend/CHANGELOG.md @@ -16,6 +16,8 @@ These are the section headers that we use: ## [Unreleased]() +## [2.6.0](https://github.com/argilla-io/argilla/compare/v2.5.0...v2.6.0) + ### Fixed - Improved performance and accessibility ([#5724](https://github.com/argilla-io/argilla/pull/5724)) diff --git a/argilla-server/CHANGELOG.md b/argilla-server/CHANGELOG.md index 6d1209ce1d..412c290a09 100644 --- a/argilla-server/CHANGELOG.md +++ b/argilla-server/CHANGELOG.md @@ -16,6 +16,8 @@ These are the section headers that we use: ## [Unreleased]() +## [2.6.0](https://github.com/argilla-io/argilla/compare/v2.5.0...v2.6.0) + ### Added - Added new `POST /api/v1/datasets/:dataset_id/export` endpoint to export datasets to Hugging Face Hub using a background job. ([#5709](https://github.com/argilla-io/argilla/pull/5709)) diff --git a/argilla/CHANGELOG.md b/argilla/CHANGELOG.md index 1c4cf3fc37..49e4955923 100644 --- a/argilla/CHANGELOG.md +++ b/argilla/CHANGELOG.md @@ -16,6 +16,8 @@ These are the section headers that we use: ## [Unreleased]() +## [2.6.0](https://github.com/argilla-io/argilla/compare/v2.5.0...v2.6.0) + ### Fixed - Fixed error when iterating over datasets and settings are not properly loaded. ([#5753](https://github.com/argilla-io/argilla/pull/5753)) From 4d2a89389c348bf9a2850efac01907ed3ccb9899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Pumar?= Date: Tue, 17 Dec 2024 14:24:25 +0100 Subject: [PATCH 3/8] Feat/improve export hover (#5764) Co-authored-by: Leire Aguirre --- argilla-frontend/CHANGELOG.md | 4 ++ .../header/header-bar/ExportToHub.vue | 54 +++++++++++-------- .../header-bar/useExportToHubViewModel.ts | 30 ++++++++++- argilla-frontend/translation/de.js | 4 +- argilla-frontend/translation/en.js | 4 +- argilla-frontend/translation/es.js | 4 +- 6 files changed, 69 insertions(+), 31 deletions(-) diff --git a/argilla-frontend/CHANGELOG.md b/argilla-frontend/CHANGELOG.md index 5cddb6d43e..a157a645b3 100644 --- a/argilla-frontend/CHANGELOG.md +++ b/argilla-frontend/CHANGELOG.md @@ -18,6 +18,10 @@ These are the section headers that we use: ## [2.6.0](https://github.com/argilla-io/argilla/compare/v2.5.0...v2.6.0) +### Added + +- Added feature to export datasets from Argilla to Hugging Face hub from the UI ([#5730](https://github.com/argilla-io/argilla/pull/5730)) + ### Fixed - Improved performance and accessibility ([#5724](https://github.com/argilla-io/argilla/pull/5724)) diff --git a/argilla-frontend/components/features/annotation/header/header-bar/ExportToHub.vue b/argilla-frontend/components/features/annotation/header/header-bar/ExportToHub.vue index 1308838b06..097424feb1 100644 --- a/argilla-frontend/components/features/annotation/header/header-bar/ExportToHub.vue +++ b/argilla-frontend/components/features/annotation/header/header-bar/ExportToHub.vue @@ -3,6 +3,8 @@ @@ -13,7 +15,7 @@ -

- - {{ exportToHubForm.orgOrUsername }}/{{ - exportToHubForm.datasetName - }} - -

+

+

+

tablet") { diff --git a/argilla-frontend/components/features/annotation/header/header-bar/useExportToHubViewModel.ts b/argilla-frontend/components/features/annotation/header/header-bar/useExportToHubViewModel.ts index 98917787bd..2757ef8741 100644 --- a/argilla-frontend/components/features/annotation/header/header-bar/useExportToHubViewModel.ts +++ b/argilla-frontend/components/features/annotation/header/header-bar/useExportToHubViewModel.ts @@ -1,5 +1,5 @@ import { useResolve } from "ts-injecty"; -import { onBeforeMount, ref, computed } from "vue"; +import { onBeforeMount, ref, computed, watch } from "vue"; import { Dataset } from "~/v1/domain/entities/dataset/Dataset"; import { ExportDatasetToHubUseCase } from "~/v1/domain/usecases/export-dataset-to-hub-use-case"; import { JobRepository } from "~/v1/infrastructure/repositories"; @@ -20,6 +20,7 @@ export const useExportToHubViewModel = (props: ExportToHubProps) => { const { get, set } = useLocalStorage(); const isDialogOpen = ref(false); + const isDialogHovered = ref(false); const errors = ref({ orgOrUsername: [], datasetName: [], @@ -162,16 +163,41 @@ export const useExportToHubViewModel = (props: ExportToHubProps) => { const closeDialog = () => { isDialogOpen.value = false; + isDialogHovered.value = false; }; + const openDialogOnHover = () => { + if (isExporting.value) { + isDialogHovered.value = true; + } + }; + + const closeDialogOnLeave = () => { + if (isExporting.value && !isDialogOpen.value) { + isDialogHovered.value = false; + } + }; + + const isDialogVisible = computed( + () => isDialogOpen.value || isDialogHovered.value + ); + + watch(isExporting, (newValue) => { + if (!newValue) { + closeDialog(); + } + }); + onBeforeMount(() => { watchExportStatus(); }); return { - isDialogOpen, + isDialogVisible, closeDialog, openDialog, + openDialogOnHover, + closeDialogOnLeave, isExporting, exportToHub, exportToHubForm, diff --git a/argilla-frontend/translation/de.js b/argilla-frontend/translation/de.js index ba7009e1f5..59ab61eaec 100644 --- a/argilla-frontend/translation/de.js +++ b/argilla-frontend/translation/de.js @@ -338,8 +338,8 @@ export default { datasetNameIsRequired: "Datensatzname ist erforderlich ", }, exporting: "Exportieren in den Umarmungsgesichtszentrum ", - private: "privater Datensatz", - public: "öffentlicher Datensatz", + private: "Privater Datensatz", + public: "Öffentlicher Datensatz", exportingWarning: "Das kann ein paar Sekunden dauern", }, config: { diff --git a/argilla-frontend/translation/en.js b/argilla-frontend/translation/en.js index 915859e1dd..6e3707c60d 100644 --- a/argilla-frontend/translation/en.js +++ b/argilla-frontend/translation/en.js @@ -337,8 +337,8 @@ export default { datasetNameIsRequired: "Dataset name is required", }, exporting: "Exporting to Hugging Face hub", - private: "private dataset", - public: "public dataset", + private: "Private dataset", + public: "Public dataset", exportingWarning: "This might take a few seconds", }, config: { diff --git a/argilla-frontend/translation/es.js b/argilla-frontend/translation/es.js index 7852a614c9..38dfd1909f 100644 --- a/argilla-frontend/translation/es.js +++ b/argilla-frontend/translation/es.js @@ -342,8 +342,8 @@ export default { datasetNameIsRequired: "El nombre del dataset es requerido", }, exporting: "Exportando al hub de Hugging Face", - private: "dataset privado", - public: "dataset público", + private: "Dataset privado", + public: "Dataset público", exportingWarning: "Esto puede tardar unos segundos", }, config: { From d6f823b9363ad56c5345eba4ae2d1fb7b02d3138 Mon Sep 17 00:00:00 2001 From: Paco Aranda Date: Tue, 17 Dec 2024 15:36:43 +0100 Subject: [PATCH 4/8] [CHORE] Add missing fixed entries (#5765) # Description **Type of change** - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Refactor (change restructuring the codebase without changing functionality) - Improvement (change adding some improvement to an existing functionality) - Documentation update **How Has This Been Tested** **Checklist** - I added relevant documentation - I followed the style guidelines of this project - I did a self-review of my code - I made corresponding changes to the documentation - I confirm My changes generate no new warnings - I have added tests that prove my fix is effective or that my feature works - I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/) --- argilla/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/argilla/CHANGELOG.md b/argilla/CHANGELOG.md index 49e4955923..94f72d3dcb 100644 --- a/argilla/CHANGELOG.md +++ b/argilla/CHANGELOG.md @@ -21,6 +21,10 @@ These are the section headers that we use: ### Fixed - Fixed error when iterating over datasets and settings are not properly loaded. ([#5753](https://github.com/argilla-io/argilla/pull/5753)) +- Fixed error when loading field from raw dictionaries. ([#5756](https://github.com/argilla-io/argilla/pull/5756)) +- Fixed error when importing datasets from hub that already exists. ([#5756](https://github.com/argilla-io/argilla/pull/5756)) +- Fixed error when importing discarded responses without a response. ([#5756](https://github.com/argilla-io/argilla/pull/5756)) +- Fixed error when importing datasets with responses from existing users. ([#5756](https://github.com/argilla-io/argilla/pull/5756)) ## [2.5.0](https://github.com/argilla-io/argilla/compare/v2.4.0...v2.5.0) From 3643cf396ed56fa76f72a4893908b344b8c7432f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Pumar?= Date: Wed, 18 Dec 2024 12:02:26 +0100 Subject: [PATCH 5/8] =?UTF-8?q?=E2=9C=A8=20Add=20share=20component=20(#572?= =?UTF-8?q?7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Francisco Aranda Co-authored-by: Paco Aranda Co-authored-by: Leire Co-authored-by: José Francisco Calvo --- argilla-frontend/CHANGELOG.md | 1 + .../base/base-button/BaseButton.vue | 6 + .../progress/AnnotationProgress.vue | 26 +++-- .../annotation/progress/share/Share.vue | 82 ++++++++++++++ .../progress/share/useShareViewModel.ts | 106 ++++++++++++++++++ .../progress/status-counter/StatusCounter.vue | 58 +++++++++- .../useAnnotationProgressViewModel.ts | 19 +++- argilla-frontend/nuxt.config.ts | 3 + argilla-frontend/pages/welcome-hf-sign-in.vue | 2 +- .../plugins/axios/axios-global-handler.ts | 56 +-------- .../plugins/extensions/copy-to-clipboard.ts | 28 +---- argilla-frontend/translation/en.js | 2 + argilla-frontend/v1/di/di.ts | 2 +- .../v1/domain/entities/dataset/Progress.ts | 9 +- .../entities/environment/Environment.ts | 5 + .../repositories/AxiosErrorHandler.ts | 44 ++++++++ .../repositories/EnvironmentRepository.ts | 17 ++- .../services/useAxiosExtension.ts | 24 ++-- .../infrastructure/services/useClipboard.ts | 27 +++++ .../services/useRunningEnvironment.test.ts | 1 + .../services/useRunningEnvironment.ts | 7 ++ .../v1/infrastructure/types/environment.ts | 1 + argilla-server/CHANGELOG.md | 3 + argilla-server/src/argilla_server/_app.py | 94 +++++++++++++++- .../argilla_server/api/schemas/v1/settings.py | 1 + .../src/argilla_server/contexts/datasets.py | 1 + .../src/argilla_server/contexts/settings.py | 2 +- argilla-server/src/argilla_server/settings.py | 5 + .../handlers/v1/settings/test_get_settings.py | 21 ++-- .../tests/unit/commons/test_settings.py | 12 ++ .../reference/argilla-server/configuration.md | 2 + 31 files changed, 556 insertions(+), 111 deletions(-) create mode 100644 argilla-frontend/components/features/annotation/progress/share/Share.vue create mode 100644 argilla-frontend/components/features/annotation/progress/share/useShareViewModel.ts create mode 100644 argilla-frontend/v1/infrastructure/repositories/AxiosErrorHandler.ts create mode 100644 argilla-frontend/v1/infrastructure/services/useClipboard.ts diff --git a/argilla-frontend/CHANGELOG.md b/argilla-frontend/CHANGELOG.md index a157a645b3..88a0456446 100644 --- a/argilla-frontend/CHANGELOG.md +++ b/argilla-frontend/CHANGELOG.md @@ -20,6 +20,7 @@ These are the section headers that we use: ### Added +- Add share progress feature ([#5727](https://github.com/argilla-io/argilla/pull/5727)) - Added feature to export datasets from Argilla to Hugging Face hub from the UI ([#5730](https://github.com/argilla-io/argilla/pull/5730)) ### Fixed diff --git a/argilla-frontend/components/base/base-button/BaseButton.vue b/argilla-frontend/components/base/base-button/BaseButton.vue index 41704556d5..ee7a13a30e 100644 --- a/argilla-frontend/components/base/base-button/BaseButton.vue +++ b/argilla-frontend/components/base/base-button/BaseButton.vue @@ -25,6 +25,8 @@ :target="target" :rel="newRel" @click="onClick" + @mouseover="$emit('mouseover')" + @mouseleave="$emit('mouseleave')" > @@ -36,6 +38,8 @@ :loading="loading" :disabled="disabled" @click="onClick" + @mouseover="$emit('mouseover')" + @mouseleave="$emit('mouseleave')" > @@ -48,6 +52,8 @@ :type="type" :disabled="disabled" @click="onClick" + @mouseover="$emit('mouseover')" + @mouseleave="$emit('mouseleave')" > - + - + + diff --git a/argilla-frontend/components/features/annotation/progress/share/useShareViewModel.ts b/argilla-frontend/components/features/annotation/progress/share/useShareViewModel.ts new file mode 100644 index 0000000000..f022a34e06 --- /dev/null +++ b/argilla-frontend/components/features/annotation/progress/share/useShareViewModel.ts @@ -0,0 +1,106 @@ +import { onBeforeMount, ref } from "vue"; +import { useUser } from "~/v1/infrastructure/services"; +import { useClipboard } from "~/v1/infrastructure/services/useClipboard"; +import { useDataset } from "~/v1/infrastructure/storage/DatasetStorage"; +import { useMetrics } from "~/v1/infrastructure/storage/MetricsStorage"; +import { useTeamProgress } from "~/v1/infrastructure/storage/TeamProgressStorage"; + +export const useShareViewModel = () => { + const { copy } = useClipboard(); + const { user } = useUser(); + const { state: metrics } = useMetrics(); + const { state: dataset } = useDataset(); + const { state: progress } = useTeamProgress(); + + const isDialogOpen = ref(false); + const sharingImage = ref<{ + src: string; + loaded: boolean; + }>({ + src: "", + loaded: false, + }); + + const copyOnClipboard = () => { + closeDialog(); + + const url = new URL(`${window.location.origin}/share-your-progress`); + const params = new URLSearchParams(""); + params.set("user_name", user.value.userName); + params.set("records_submitted", metrics.submitted.toString()); + params.set("team_progress", progress.percentage.completed.toString()); + params.set("dataset_name", dataset.name); + params.set("dataset_id", dataset.id); + + url.search = params.toString(); + + const textToCopy = `I've just contributed ${ + metrics.submitted + } examples to this dataset: + +${url.toString()}`; + + copy(textToCopy); + }; + + const createImageLink = () => { + const url = new URL("https://argilla.imglab-cdn.net/dibt/dibt_v2.png"); + const params = new URLSearchParams(url.search); + params.set("width", "1200"); + params.set("text-width", "700"); + params.set("text-height", "590"); + params.set("text-padding", "60"); + params.set("text-color", "39,71,111"); + params.set("text-x", "460"); + params.set("text-y", "40"); + + params.set( + "text", + `@${user.value.userName} +I've just contributed ${metrics.submitted} examples to this dataset: +${dataset.name} + +Team progress +${progress.percentage.completed}%` + ); + + return `${url.origin}${url.pathname}?${params.toString()}`; + }; + + const openDialog = () => { + setPreloadedImage(); + + isDialogOpen.value = true; + }; + + const closeDialog = () => { + isDialogOpen.value = false; + }; + + const setPreloadedImage = () => { + sharingImage.value.loaded = false; + + const image = createImageLink(); + + const preFetchImage = new Image(); + preFetchImage.src = image; + preFetchImage.onload = () => { + sharingImage.value = { + src: image, + loaded: true, + }; + }; + }; + + onBeforeMount(() => { + setPreloadedImage(); + }); + + return { + sharingImage, + isDialogOpen, + openDialog, + closeDialog, + copyOnClipboard, + }; +}; diff --git a/argilla-frontend/components/features/annotation/progress/status-counter/StatusCounter.vue b/argilla-frontend/components/features/annotation/progress/status-counter/StatusCounter.vue index 8215ec5f65..258c04fe6a 100644 --- a/argilla-frontend/components/features/annotation/progress/status-counter/StatusCounter.vue +++ b/argilla-frontend/components/features/annotation/progress/status-counter/StatusCounter.vue @@ -1,5 +1,5 @@ - + + + """ + + return textwrap.dedent(share_page) + + @app.get("/share-your-progress", include_in_schema=False) + async def share_your_progress_page( + request: Request, + dataset_name: str = Query(), + dataset_id: str = Query(), + user_name: str = Query(), + team_progress: float = Query(default=0.0), + records_submitted: int = Query(default=0), + ): + share_image = create_image_link(user_name, dataset_name, records_submitted, team_progress) + share_page = create_share_html(dataset_name, dataset_id, share_image, request.url) + + return HTMLResponse(content=share_page, status_code=200) + + def create_server_app() -> FastAPI: """Configure the argilla server""" @@ -74,6 +163,7 @@ def create_server_app() -> FastAPI: configure_logging() configure_common_middleware(app) configure_api_router(app) + configure_share_your_progress(app) configure_telemetry(app) configure_app_statics(app) configure_api_docs(app) diff --git a/argilla-server/src/argilla_server/api/schemas/v1/settings.py b/argilla-server/src/argilla_server/api/schemas/v1/settings.py index a427386135..cb0810fbbd 100644 --- a/argilla-server/src/argilla_server/api/schemas/v1/settings.py +++ b/argilla-server/src/argilla_server/api/schemas/v1/settings.py @@ -31,6 +31,7 @@ class HuggingfaceSettings(BaseModel): class ArgillaSettings(BaseModel): show_huggingface_space_persistent_storage_warning: Optional[bool] = None + share_your_progress_enabled: bool = False class Settings(BaseModel): diff --git a/argilla-server/src/argilla_server/contexts/datasets.py b/argilla-server/src/argilla_server/contexts/datasets.py index 5a3f4a039a..61a9a03a96 100644 --- a/argilla-server/src/argilla_server/contexts/datasets.py +++ b/argilla-server/src/argilla_server/contexts/datasets.py @@ -445,6 +445,7 @@ async def get_dataset_users_progress(db: AsyncSession, dataset: Dataset) -> List .join(User) .where(Record.dataset_id == dataset.id) .group_by(User.username, Record.status, Response.status) + .order_by(User.inserted_at.asc()) ) annotators_progress = defaultdict(lambda: defaultdict(dict)) diff --git a/argilla-server/src/argilla_server/contexts/settings.py b/argilla-server/src/argilla_server/contexts/settings.py index c7bfb542a7..a922adbd65 100644 --- a/argilla-server/src/argilla_server/contexts/settings.py +++ b/argilla-server/src/argilla_server/contexts/settings.py @@ -27,7 +27,7 @@ def get_settings() -> Settings: def _get_argilla_settings() -> ArgillaSettings: - argilla_settings = ArgillaSettings() + argilla_settings = ArgillaSettings(share_your_progress_enabled=settings.enable_share_your_progress) if _get_huggingface_settings(): argilla_settings.show_huggingface_space_persistent_storage_warning = ( diff --git a/argilla-server/src/argilla_server/settings.py b/argilla-server/src/argilla_server/settings.py index 52415cd6f3..12b4358547 100644 --- a/argilla-server/src/argilla_server/settings.py +++ b/argilla-server/src/argilla_server/settings.py @@ -149,6 +149,11 @@ class Settings(BaseSettings): description="The telemetry configuration for Hugging Face hub telemetry. ", ) + enable_share_your_progress: bool = Field( + default=False, + description="Share your progress feature for community initiatives. Default=False", + ) + # See also the telemetry.py module @field_validator("enable_telemetry", mode="before") @classmethod diff --git a/argilla-server/tests/unit/api/handlers/v1/settings/test_get_settings.py b/argilla-server/tests/unit/api/handlers/v1/settings/test_get_settings.py index e52bd3a5ea..f9df63245e 100644 --- a/argilla-server/tests/unit/api/handlers/v1/settings/test_get_settings.py +++ b/argilla-server/tests/unit/api/handlers/v1/settings/test_get_settings.py @@ -19,7 +19,7 @@ from argilla_server.contexts import settings as settings_context from argilla_server.contexts.settings import HUGGINGFACE_SETTINGS from argilla_server.integrations.huggingface.spaces import HuggingfaceSettings -from argilla_server.settings import settings as argilla_server_settings +from argilla_server.settings import settings as argilla_server_settings, settings from httpx import AsyncClient @@ -33,9 +33,7 @@ async def test_get_settings_for_argilla_settings_running_on_huggingface(self, as response = await async_client.get(self.url()) assert response.status_code == 200 - assert response.json()["argilla"] == { - "show_huggingface_space_persistent_storage_warning": True, - } + assert response.json()["argilla"]["show_huggingface_space_persistent_storage_warning"] is True async def test_get_settings_for_argilla_settings_running_on_huggingface_with_disabled_storage_warning( self, async_client: AsyncClient @@ -45,9 +43,7 @@ async def test_get_settings_for_argilla_settings_running_on_huggingface_with_dis response = await async_client.get(self.url()) assert response.status_code == 200 - assert response.json()["argilla"] == { - "show_huggingface_space_persistent_storage_warning": False, - } + assert response.json()["argilla"]["show_huggingface_space_persistent_storage_warning"] is False async def test_get_settings_for_argilla_settings_not_running_on_huggingface(self, async_client: AsyncClient): response = await async_client.get(self.url()) @@ -86,3 +82,14 @@ async def test_get_settings_for_huggingface_settings_not_running_on_huggingface( assert response.status_code == 200 assert "huggingface" not in response.json() + + async def test_get_settings_with_share_your_progress_enabled(self, async_client: AsyncClient): + try: + settings.enable_share_your_progress = True + + response = await async_client.get(self.url()) + + assert response.status_code == 200 + assert response.json()["argilla"]["share_your_progress_enabled"] is True + finally: + settings.enable_share_your_progress = False diff --git a/argilla-server/tests/unit/commons/test_settings.py b/argilla-server/tests/unit/commons/test_settings.py index 14c2d27799..b98d52825e 100644 --- a/argilla-server/tests/unit/commons/test_settings.py +++ b/argilla-server/tests/unit/commons/test_settings.py @@ -84,3 +84,15 @@ def test_settings_database_postgresql_max_overflow(monkeypatch): monkeypatch.setenv("ARGILLA_DATABASE_POSTGRESQL_MAX_OVERFLOW", "12") assert Settings().database_postgresql_max_overflow == 12 + + +def test_enable_share_your_progress(monkeypatch): + monkeypatch.setenv("ARGILLA_ENABLE_SHARE_YOUR_PROGRESS", "true") + + assert Settings().enable_share_your_progress is True + + +def test_disable_enable_share_your_progress(monkeypatch): + monkeypatch.setenv("ARGILLA_ENABLE_SHARE_YOUR_PROGRESS", "false") + + assert Settings().enable_share_your_progress is False diff --git a/argilla/docs/reference/argilla-server/configuration.md b/argilla/docs/reference/argilla-server/configuration.md index 99cb92cf9b..42dadbd2d0 100644 --- a/argilla/docs/reference/argilla-server/configuration.md +++ b/argilla/docs/reference/argilla-server/configuration.md @@ -46,6 +46,8 @@ You can set the following environment variables to further configure your server - `ARGILLA_DOCS_ENABLED`: If False, disables openapi docs endpoint at _/api/docs_. +- `ARGILLA_ENABLE_SHARE_YOUR_PROGRESS`: If True, enables the share your progress feature. This feature allows users to share their progress with the community. If False, the feature will be disabled. + - `HF_HUB_DISABLE_TELEMETRY`: If True, disables telemetry for usage metrics. Alternatively, you can disable telemetry by setting `HF_HUB_OFFLINE=1`. #### Authentication From a4686ee87c08e8cd37fa7ebc19deb643a314519e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Pumar?= Date: Wed, 18 Dec 2024 13:24:34 +0100 Subject: [PATCH 6/8] =?UTF-8?q?=F0=9F=90=9B=20Try?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- argilla-frontend/pages/oauth/_provider/useOAuthViewModel.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/argilla-frontend/pages/oauth/_provider/useOAuthViewModel.ts b/argilla-frontend/pages/oauth/_provider/useOAuthViewModel.ts index 74f2a09962..5cfd4292bd 100644 --- a/argilla-frontend/pages/oauth/_provider/useOAuthViewModel.ts +++ b/argilla-frontend/pages/oauth/_provider/useOAuthViewModel.ts @@ -1,4 +1,4 @@ -import { useFetch, useRoute } from "@nuxtjs/composition-api"; +import { onBeforeMount, useRoute } from "@nuxtjs/composition-api"; import { useResolve } from "ts-injecty"; import { ProviderType } from "~/v1/domain/entities/oauth/OAuthProvider"; import { OAuthLoginUseCase } from "~/v1/domain/usecases/oauth-login-use-case"; @@ -17,7 +17,7 @@ export const useOAuthViewModel = () => { const oauthLoginUseCase = useResolve(OAuthLoginUseCase); const { pop } = useLocalStorage(); - useFetch(async () => { + onBeforeMount(async () => { await tryLogin(); }); From 2e426423f74a67eeef4c92f2ebb80f6e0d9a17e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Pumar?= Date: Wed, 18 Dec 2024 13:46:31 +0100 Subject: [PATCH 7/8] =?UTF-8?q?Revert=20"=F0=9F=90=9B=20Try"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit a4686ee87c08e8cd37fa7ebc19deb643a314519e. --- argilla-frontend/pages/oauth/_provider/useOAuthViewModel.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/argilla-frontend/pages/oauth/_provider/useOAuthViewModel.ts b/argilla-frontend/pages/oauth/_provider/useOAuthViewModel.ts index 5cfd4292bd..74f2a09962 100644 --- a/argilla-frontend/pages/oauth/_provider/useOAuthViewModel.ts +++ b/argilla-frontend/pages/oauth/_provider/useOAuthViewModel.ts @@ -1,4 +1,4 @@ -import { onBeforeMount, useRoute } from "@nuxtjs/composition-api"; +import { useFetch, useRoute } from "@nuxtjs/composition-api"; import { useResolve } from "ts-injecty"; import { ProviderType } from "~/v1/domain/entities/oauth/OAuthProvider"; import { OAuthLoginUseCase } from "~/v1/domain/usecases/oauth-login-use-case"; @@ -17,7 +17,7 @@ export const useOAuthViewModel = () => { const oauthLoginUseCase = useResolve(OAuthLoginUseCase); const { pop } = useLocalStorage(); - onBeforeMount(async () => { + useFetch(async () => { await tryLogin(); }); From 12160d0a2cd4894aef8c04d0a612efaa308a936f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Pumar?= Date: Wed, 18 Dec 2024 14:55:25 +0100 Subject: [PATCH 8/8] =?UTF-8?q?=E2=9C=A8=20Fix=20twice=20rendering=20Nuxt?= =?UTF-8?q?=20issue=20https://github.com/nuxt/nuxt/issues/5703?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- argilla-frontend/nuxt.config.ts | 6 +-- argilla-frontend/package-lock.json | 70 +++++++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 5 deletions(-) diff --git a/argilla-frontend/nuxt.config.ts b/argilla-frontend/nuxt.config.ts index 56135ab46d..77469449f0 100644 --- a/argilla-frontend/nuxt.config.ts +++ b/argilla-frontend/nuxt.config.ts @@ -191,9 +191,9 @@ const config: NuxtConfig = { }, extractCSS: true, splitChunks: { - pages: true, - commons: true, - layouts: true, + pages: false, + commons: false, + layouts: false, }, optimization: { splitChunks: { diff --git a/argilla-frontend/package-lock.json b/argilla-frontend/package-lock.json index cb75a08577..09fe398399 100644 --- a/argilla-frontend/package-lock.json +++ b/argilla-frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "argilla", - "version": "2.6.0dev0", + "version": "2.6.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "argilla", - "version": "2.6.0dev0", + "version": "2.6.0", "dependencies": { "@codescouts/events": "1.0.10", "@nuxtjs/auth-next": "5.0.0-1613647907.37b1156", @@ -60,6 +60,7 @@ "jest": "27.5.1", "jest-serializer-vue": "2.0.2", "jest-transform-stub": "2.0.0", + "nuxt-compress": "5.0.0", "prettier": "2.8.8", "sass-loader": "10.5.2", "typescript": "5.7.2", @@ -12296,6 +12297,56 @@ "node": ">= 0.8.0" } }, + "node_modules/compression-webpack-plugin": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/compression-webpack-plugin/-/compression-webpack-plugin-6.1.2.tgz", + "integrity": "sha512-z6xtgKP3Uds2lyrkx2PGwrE9FZT8raHTC3ImFrY3e0faAfSfVIV63JmR+sfk5pf4OhUj3E4XdjZBCKpjYWIw6Q==", + "dev": true, + "dependencies": { + "cacache": "^15.0.5", + "find-cache-dir": "^3.3.1", + "schema-utils": "^3.0.0", + "serialize-javascript": "^5.0.1", + "webpack-sources": "^1.4.3" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^4.0.0 || ^5.0.0" + } + }, + "node_modules/compression-webpack-plugin/node_modules/schema-utils": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/compression-webpack-plugin/node_modules/serialize-javascript": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", + "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, "node_modules/compression/node_modules/bytes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", @@ -22342,6 +22393,21 @@ "nuxt": "bin/nuxt.js" } }, + "node_modules/nuxt-compress": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nuxt-compress/-/nuxt-compress-5.0.0.tgz", + "integrity": "sha512-KxsYzgRTMJhqQfGfgLbam0gOTw8GtmrhJhQjUfcShCmBpVaL2sFM6urOKW3I/fIx+aRvF9uE0FZCFviF1TLZww==", + "dev": true, + "dependencies": { + "compression-webpack-plugin": "^6.1.1" + }, + "engines": { + "node": ">= 12.10.0" + }, + "peerDependencies": { + "nuxt": ">=2.9.0" + } + }, "node_modules/nuxt-highlightjs": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/nuxt-highlightjs/-/nuxt-highlightjs-1.0.3.tgz",