diff --git a/src/renderer/src/i18n/locales/en-us.json b/src/renderer/src/i18n/locales/en-us.json index 92ad9a8b87..a57c549c7e 100644 --- a/src/renderer/src/i18n/locales/en-us.json +++ b/src/renderer/src/i18n/locales/en-us.json @@ -1505,6 +1505,7 @@ "notes_placeholder": "Enter additional information or context for this knowledge base...", "provider_not_found": "Provider not found", "quota": "{{name}} Left Quota: {{quota}}", + "quota_empty": "Today's {{name}} quota exhausted, please apply on the official website", "quota_infinity": "{{name}} Quota: Unlimited", "rename": "Rename", "search": "Search knowledge base", diff --git a/src/renderer/src/i18n/locales/zh-cn.json b/src/renderer/src/i18n/locales/zh-cn.json index 440d7bd562..8f1d81aabd 100644 --- a/src/renderer/src/i18n/locales/zh-cn.json +++ b/src/renderer/src/i18n/locales/zh-cn.json @@ -1505,6 +1505,7 @@ "notes_placeholder": "输入此知识库的附加信息或上下文...", "provider_not_found": "未找到服务商", "quota": "{{name}} 剩余额度:{{quota}}", + "quota_empty": "今日{{name}}额度不足,请前往官网申请", "quota_infinity": "{{name}} 剩余额度:无限制", "rename": "重命名", "search": "搜索知识库", diff --git a/src/renderer/src/i18n/locales/zh-tw.json b/src/renderer/src/i18n/locales/zh-tw.json index 6b201db319..acda928d31 100644 --- a/src/renderer/src/i18n/locales/zh-tw.json +++ b/src/renderer/src/i18n/locales/zh-tw.json @@ -1505,6 +1505,7 @@ "notes_placeholder": "輸入此知識庫的附加資訊或上下文...", "provider_not_found": "未找到服務商", "quota": "{{name}} 剩餘配額:{{quota}}", + "quota_empty": "今日{{name}}額度不足,請前往官網申請", "quota_infinity": "{{name}} 配額:無限制", "rename": "重新命名", "search": "搜尋知識庫", diff --git a/src/renderer/src/i18n/translate/de-de.json b/src/renderer/src/i18n/translate/de-de.json index a1d5bb3c1a..94c338ba30 100644 --- a/src/renderer/src/i18n/translate/de-de.json +++ b/src/renderer/src/i18n/translate/de-de.json @@ -1505,6 +1505,7 @@ "notes_placeholder": "Zusätzliche Informationen oder Kontext für diese Wissensdatenbank eingeben...", "provider_not_found": "Anbieter nicht gefunden", "quota": "{{name}} verbleibendes Kontingent: {{quota}}", + "quota_empty": "Das heutige {{name}}-Kontingent ist erschöpft. Bitte beantragen Sie es auf der offiziellen Website", "quota_infinity": "{{name}} verbleibendes Kontingent: unbegrenzt", "rename": "Umbenennen", "search": "Wissensdatenbank durchsuchen", diff --git a/src/renderer/src/i18n/translate/el-gr.json b/src/renderer/src/i18n/translate/el-gr.json index 2e02207c91..b13975d218 100644 --- a/src/renderer/src/i18n/translate/el-gr.json +++ b/src/renderer/src/i18n/translate/el-gr.json @@ -1505,6 +1505,7 @@ "notes_placeholder": "Εισάγετε πρόσθετες πληροφορίες ή πληροφορίες προσδιορισμού για αυτή τη βάση γνώσεων...", "provider_not_found": "Η παροχή υπηρεσιών μοντέλου βάσης γνώσεων χαθηκε, αυτή η βάση γνώσεων δεν θα υποστηρίζεται πλέον, παρακαλείστε να δημιουργήσετε ξανά μια βάση γνώσεων", "quota": "Διαθέσιμο όριο για {{name}}: {{quota}}", + "quota_empty": "Το σημερινό όριο {{name}} εξαντλήθηκε, παρακαλούμε υποβάλετε αίτηση στην επίσημη ιστοσελίδα", "quota_infinity": "Διαθέσιμο όριο για {{name}}: Απεριόριστο", "rename": "Μετονομασία", "search": "Αναζήτηση βάσης γνώσεων", diff --git a/src/renderer/src/i18n/translate/es-es.json b/src/renderer/src/i18n/translate/es-es.json index 39b5cb1248..08b90da9ac 100644 --- a/src/renderer/src/i18n/translate/es-es.json +++ b/src/renderer/src/i18n/translate/es-es.json @@ -1505,6 +1505,7 @@ "notes_placeholder": "Ingrese información adicional o contexto para esta base de conocimientos...", "provider_not_found": "El proveedor del modelo de la base de conocimientos ha sido perdido, esta base de conocimientos ya no es compatible, por favor cree una nueva base de conocimientos", "quota": "Cupo restante de {{name}}: {{quota}}", + "quota_empty": "La cuota de {{name}} de hoy está agotada, por favor solicítela en el sitio web oficial", "quota_infinity": "Cupo restante de {{name}}: ilimitado", "rename": "Renombrar", "search": "Buscar en la base de conocimientos", diff --git a/src/renderer/src/i18n/translate/fr-fr.json b/src/renderer/src/i18n/translate/fr-fr.json index d1f3681e5e..9a744c2d56 100644 --- a/src/renderer/src/i18n/translate/fr-fr.json +++ b/src/renderer/src/i18n/translate/fr-fr.json @@ -1505,6 +1505,7 @@ "notes_placeholder": "Entrez des informations supplémentaires ou un contexte pour cette base de connaissances...", "provider_not_found": "Le fournisseur du modèle de la base de connaissances a été perdu, cette base de connaissances ne sera plus supportée, veuillez en créer une nouvelle", "quota": "Quota restant pour {{name}} : {{quota}}", + "quota_empty": "Le quota {{name}} d'aujourd'hui est épuisé, veuillez en faire la demande sur le site officiel", "quota_infinity": "Quota restant pour {{name}} : illimité", "rename": "Renommer", "search": "Rechercher dans la base de connaissances", diff --git a/src/renderer/src/i18n/translate/ja-jp.json b/src/renderer/src/i18n/translate/ja-jp.json index 639b17509d..6ae3451d04 100644 --- a/src/renderer/src/i18n/translate/ja-jp.json +++ b/src/renderer/src/i18n/translate/ja-jp.json @@ -1505,6 +1505,7 @@ "notes_placeholder": "このナレッジベースの追加情報やコンテキストを入力...", "provider_not_found": "プロバイダーが見つかりません", "quota": "{{name}} 残りクォータ: {{quota}}", + "quota_empty": "本日の{{name}}クォータが不足しています。公式サイトで申請してください", "quota_infinity": "{{name}} クォータ: 無制限", "rename": "名前を変更", "search": "ナレッジベースを検索", diff --git a/src/renderer/src/i18n/translate/pt-pt.json b/src/renderer/src/i18n/translate/pt-pt.json index 9fc5186c0e..ae993eaf13 100644 --- a/src/renderer/src/i18n/translate/pt-pt.json +++ b/src/renderer/src/i18n/translate/pt-pt.json @@ -1505,6 +1505,7 @@ "notes_placeholder": "Digite informações adicionais ou contexto para este repositório de conhecimento...", "provider_not_found": "O provedor do modelo do repositório de conhecimento foi perdido, este repositório de conhecimento não será mais suportado, por favor, crie um novo repositório de conhecimento", "quota": "Cota restante de {{name}}: {{quota}}", + "quota_empty": "A cota de {{name}} de hoje está esgotada, por favor solicite no site oficial", "quota_infinity": "Cota restante de {{name}}: ilimitada", "rename": "Renomear", "search": "Pesquisar repositório de conhecimento", diff --git a/src/renderer/src/i18n/translate/ru-ru.json b/src/renderer/src/i18n/translate/ru-ru.json index 899c97ef89..0230c9d1bb 100644 --- a/src/renderer/src/i18n/translate/ru-ru.json +++ b/src/renderer/src/i18n/translate/ru-ru.json @@ -1505,6 +1505,7 @@ "notes_placeholder": "Введите дополнительную информацию или контекст для этой базы знаний...", "provider_not_found": "Поставщик не найден", "quota": "{{name}} Остаток квоты: {{quota}}", + "quota_empty": "Сегодняшняя квота {{name}} исчерпана, пожалуйста, подайте заявку на официальном сайте", "quota_infinity": "{{name}} Квота: Не ограничена", "rename": "Переименовать", "search": "Поиск в базе знаний", diff --git a/src/renderer/src/pages/knowledge/components/QuotaTag.tsx b/src/renderer/src/pages/knowledge/components/QuotaTag.tsx index f2f3fc29b0..e7f99a8037 100644 --- a/src/renderer/src/pages/knowledge/components/QuotaTag.tsx +++ b/src/renderer/src/pages/knowledge/components/QuotaTag.tsx @@ -10,6 +10,8 @@ import { useTranslation } from 'react-i18next' const logger = loggerService.withContext('QuotaTag') +const QUOTA_UNLIMITED = -9999 + const QuotaTag: FC<{ base: KnowledgeBase; providerId: PreprocessProviderId; quota?: number }> = ({ base, providerId, @@ -24,8 +26,8 @@ const QuotaTag: FC<{ base: KnowledgeBase; providerId: PreprocessProviderId; quot if (provider.id !== 'mineru') return // 使用用户的key时quota为无限 if (provider.apiKey) { - setQuota(-9999) - updateProvider({ quota: -9999 }) + setQuota(QUOTA_UNLIMITED) + updateProvider({ quota: QUOTA_UNLIMITED }) return } if (quota === undefined) { @@ -43,28 +45,37 @@ const QuotaTag: FC<{ base: KnowledgeBase; providerId: PreprocessProviderId; quot } } if (_quota !== undefined) { + setQuota(_quota) updateProvider({ quota: _quota }) return } checkQuota() }, [_quota, base, provider.id, provider.apiKey, provider, quota, updateProvider]) - return ( - <> - {quota && ( + const getQuotaDisplay = () => { + if (quota === undefined) return null + if (quota === QUOTA_UNLIMITED) { + return ( - {quota === -9999 - ? t('knowledge.quota_infinity', { - name: provider.name - }) - : t('knowledge.quota', { - name: provider.name, - quota: quota - })} + {t('knowledge.quota_infinity', { name: provider.name })} - )} - - ) + ) + } + if (quota === 0) { + return ( + + {t('knowledge.quota_empty', { name: provider.name })} + + ) + } + return ( + + {t('knowledge.quota', { name: provider.name, quota: quota })} + + ) + } + + return <>{getQuotaDisplay()} } export default QuotaTag