fix: get quota and quota tips (#11472)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
槑囿脑袋
2025-11-26 19:53:59 +08:00
committed by GitHub
parent 91f0c47b33
commit 79f75843a7
11 changed files with 37 additions and 16 deletions

View File

@@ -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",

View File

@@ -1505,6 +1505,7 @@
"notes_placeholder": "输入此知识库的附加信息或上下文...",
"provider_not_found": "未找到服务商",
"quota": "{{name}} 剩余额度:{{quota}}",
"quota_empty": "今日{{name}}额度不足,请前往官网申请",
"quota_infinity": "{{name}} 剩余额度:无限制",
"rename": "重命名",
"search": "搜索知识库",

View File

@@ -1505,6 +1505,7 @@
"notes_placeholder": "輸入此知識庫的附加資訊或上下文...",
"provider_not_found": "未找到服務商",
"quota": "{{name}} 剩餘配額:{{quota}}",
"quota_empty": "今日{{name}}額度不足,請前往官網申請",
"quota_infinity": "{{name}} 配額:無限制",
"rename": "重新命名",
"search": "搜尋知識庫",

View File

@@ -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",

View File

@@ -1505,6 +1505,7 @@
"notes_placeholder": "Εισάγετε πρόσθετες πληροφορίες ή πληροφορίες προσδιορισμού για αυτή τη βάση γνώσεων...",
"provider_not_found": "Η παροχή υπηρεσιών μοντέλου βάσης γνώσεων χαθηκε, αυτή η βάση γνώσεων δεν θα υποστηρίζεται πλέον, παρακαλείστε να δημιουργήσετε ξανά μια βάση γνώσεων",
"quota": "Διαθέσιμο όριο για {{name}}: {{quota}}",
"quota_empty": "Το σημερινό όριο {{name}} εξαντλήθηκε, παρακαλούμε υποβάλετε αίτηση στην επίσημη ιστοσελίδα",
"quota_infinity": "Διαθέσιμο όριο για {{name}}: Απεριόριστο",
"rename": "Μετονομασία",
"search": "Αναζήτηση βάσης γνώσεων",

View File

@@ -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",

View File

@@ -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",

View File

@@ -1505,6 +1505,7 @@
"notes_placeholder": "このナレッジベースの追加情報やコンテキストを入力...",
"provider_not_found": "プロバイダーが見つかりません",
"quota": "{{name}} 残りクォータ: {{quota}}",
"quota_empty": "本日の{{name}}クォータが不足しています。公式サイトで申請してください",
"quota_infinity": "{{name}} クォータ: 無制限",
"rename": "名前を変更",
"search": "ナレッジベースを検索",

View File

@@ -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",

View File

@@ -1505,6 +1505,7 @@
"notes_placeholder": "Введите дополнительную информацию или контекст для этой базы знаний...",
"provider_not_found": "Поставщик не найден",
"quota": "{{name}} Остаток квоты: {{quota}}",
"quota_empty": "Сегодняшняя квота {{name}} исчерпана, пожалуйста, подайте заявку на официальном сайте",
"quota_infinity": "{{name}} Квота: Не ограничена",
"rename": "Переименовать",
"search": "Поиск в базе знаний",

View File

@@ -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 (
<Tag color="orange" style={{ borderRadius: 20, margin: 0 }}>
{quota === -9999
? t('knowledge.quota_infinity', {
name: provider.name
})
: t('knowledge.quota', {
name: provider.name,
quota: quota
})}
{t('knowledge.quota_infinity', { name: provider.name })}
</Tag>
)}
</>
)
)
}
if (quota === 0) {
return (
<Tag color="red" style={{ borderRadius: 20, margin: 0 }}>
{t('knowledge.quota_empty', { name: provider.name })}
</Tag>
)
}
return (
<Tag color="orange" style={{ borderRadius: 20, margin: 0 }}>
{t('knowledge.quota', { name: provider.name, quota: quota })}
</Tag>
)
}
return <>{getQuotaDisplay()}</>
}
export default QuotaTag