From d9ce2c56c03b3b31347df89f584fe463d7ede0ab Mon Sep 17 00:00:00 2001 From: Will Miao Date: Fri, 26 Dec 2025 22:39:51 +0800 Subject: [PATCH] feat: Add 'times used' translation keys and implement usage-based sorting in the model service. --- locales/de.json | 3 +++ locales/en.json | 3 +++ locales/es.json | 3 +++ locales/fr.json | 3 +++ locales/he.json | 3 +++ locales/ja.json | 3 +++ locales/ko.json | 3 +++ locales/ru.json | 3 +++ locales/zh-CN.json | 3 +++ locales/zh-TW.json | 3 +++ py/services/base_model_service.py | 4 +--- 11 files changed, 31 insertions(+), 3 deletions(-) diff --git a/locales/de.json b/locales/de.json index 037390c6..db8ff981 100644 --- a/locales/de.json +++ b/locales/de.json @@ -131,6 +131,9 @@ "badges": { "update": "Update", "updateAvailable": "Update verfügbar" + }, + "usage": { + "timesUsed": "Verwendungsanzahl" } }, "globalContextMenu": { diff --git a/locales/en.json b/locales/en.json index fbe2c07f..9a42f6b2 100644 --- a/locales/en.json +++ b/locales/en.json @@ -131,6 +131,9 @@ "badges": { "update": "Update", "updateAvailable": "Update available" + }, + "usage": { + "timesUsed": "Times used" } }, "globalContextMenu": { diff --git a/locales/es.json b/locales/es.json index 09e13994..5db138f9 100644 --- a/locales/es.json +++ b/locales/es.json @@ -131,6 +131,9 @@ "badges": { "update": "Actualización", "updateAvailable": "Actualización disponible" + }, + "usage": { + "timesUsed": "Veces usado" } }, "globalContextMenu": { diff --git a/locales/fr.json b/locales/fr.json index bf66274d..f6b7c4e4 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -131,6 +131,9 @@ "badges": { "update": "Mise à jour", "updateAvailable": "Mise à jour disponible" + }, + "usage": { + "timesUsed": "Nombre d'utilisations" } }, "globalContextMenu": { diff --git a/locales/he.json b/locales/he.json index 2ffd3953..88a325ed 100644 --- a/locales/he.json +++ b/locales/he.json @@ -131,6 +131,9 @@ "badges": { "update": "עדכון", "updateAvailable": "עדכון זמין" + }, + "usage": { + "timesUsed": "מספר שימושים" } }, "globalContextMenu": { diff --git a/locales/ja.json b/locales/ja.json index 592fff2b..2e6e44e3 100644 --- a/locales/ja.json +++ b/locales/ja.json @@ -131,6 +131,9 @@ "badges": { "update": "アップデート", "updateAvailable": "アップデートがあります" + }, + "usage": { + "timesUsed": "使用回数" } }, "globalContextMenu": { diff --git a/locales/ko.json b/locales/ko.json index 57d9d432..35d83a25 100644 --- a/locales/ko.json +++ b/locales/ko.json @@ -131,6 +131,9 @@ "badges": { "update": "업데이트", "updateAvailable": "업데이트 가능" + }, + "usage": { + "timesUsed": "사용 횟수" } }, "globalContextMenu": { diff --git a/locales/ru.json b/locales/ru.json index bd8dda16..3f84c47a 100644 --- a/locales/ru.json +++ b/locales/ru.json @@ -131,6 +131,9 @@ "badges": { "update": "Обновление", "updateAvailable": "Доступно обновление" + }, + "usage": { + "timesUsed": "Количество использований" } }, "globalContextMenu": { diff --git a/locales/zh-CN.json b/locales/zh-CN.json index 2afe244a..223cce17 100644 --- a/locales/zh-CN.json +++ b/locales/zh-CN.json @@ -131,6 +131,9 @@ "badges": { "update": "更新", "updateAvailable": "有可用更新" + }, + "usage": { + "timesUsed": "使用次数" } }, "globalContextMenu": { diff --git a/locales/zh-TW.json b/locales/zh-TW.json index 0675aa65..20761107 100644 --- a/locales/zh-TW.json +++ b/locales/zh-TW.json @@ -131,6 +131,9 @@ "badges": { "update": "更新", "updateAvailable": "有可用更新" + }, + "usage": { + "timesUsed": "使用次數" } }, "globalContextMenu": { diff --git a/py/services/base_model_service.py b/py/services/base_model_service.py index 8f3f306a..7efe337d 100644 --- a/py/services/base_model_service.py +++ b/py/services/base_model_service.py @@ -84,13 +84,11 @@ class BaseModelService(ABC): overall_start = time.perf_counter() sort_params = self.cache_repository.parse_sort(sort_by) + t0 = time.perf_counter() if sort_params.key == 'usage': sorted_data = await self._fetch_with_usage_sort(sort_params) else: sorted_data = await self.cache_repository.fetch_sorted(sort_params) - - t0 = time.perf_counter() - sorted_data = await self.cache_repository.fetch_sorted(sort_params) fetch_duration = time.perf_counter() - t0 initial_count = len(sorted_data)