fix(quota): keep Kimi free-account errors inline

This commit is contained in:
lzt404 committed 2026-10-05 00:45:17 +08:00
1 parent a3f5d2e54e
commit 19a7f88a29
3 files changed
+9 -2

No files matched your search

+2
View File
@@ -64,3 +64,5 @@
.quota-page .quota-reset-footer { order: 3; align-self: flex-end; margin: auto 0 0; min-height: 30px; padding: 5px 10px; border-radius: 7px; color: #347df4; border-color: #d8e5fb; background: #f3f7ff; }
.quota-page .quota-reset-footer:hover:not(:disabled) { border-color: #9dbcf4; background: #eaf2ff; }
.quota-page .quota-card-message, .quota-page .quota-card-error { min-height: 36px; flex-wrap: wrap; }
.quota-page .quota-card-error > span { display: grid; gap: 4px; min-width: 0; }
.quota-page .quota-card-error small { overflow-wrap: anywhere; font-size: 11px; }
+1 -2
View File
@@ -204,8 +204,7 @@ export function QuotaCard({ file, quota, onRefresh, onReset }: { file: AuthFile;
{quota.status === 'idle' ? <div className="quota-card-message"><span>{disabled ? t('quota.fileDisabled') : t('quota.notFetched')}</span><button type="button" className="secondary-button compact-button" onClick={onRefresh} disabled={disabled}>{disabled ? t('quota.disabled') : t('quota.fetch')}</button></div> : null}
{quota.status === 'loading' ? <div className="quota-card-message"><LoaderCircle size={18} className="spin" />{t(quota.pendingAction === 'reset' ? 'quota.resetting' : 'quota.querying')}</div> : null}
{quota.status === 'error' ? <>
<MessageNotice message={quota.error ? name + ': ' + quota.error : null} />
<div className="quota-card-error"><AlertCircle size={18} />{t('authFiles.quota.failed')}</div>
<div className="quota-card-error"><AlertCircle size={18} /><span>{t('authFiles.quota.failed')}{quota.error ? <small>{quota.error}</small> : null}</span></div>
</> : null}
{quota.status === 'success' && (provider === 'codex' || provider === 'claude') ? <div className="quota-reset-credit-summary">
{(quota.creditsUnlimited || quota.creditBalance !== undefined) ? <span>{t('quota.creditBalance')} <strong>{quota.creditsUnlimited ? t('quota.creditUnlimited') : quota.creditBalance}</strong></span> : null}
+6
View File
@@ -60,4 +60,10 @@ describe('quota card rendering', () => {
expect(html).toContain('Reset time reached; refresh to verify');
expect(html).toContain('0% remaining');
});
it('Kimi 免费账号取不到额度时只显示卡片内失败状态', () => {
const html = render({ status: 'error', rows: [], error: 'free account cannot access quota' }, 'kimi');
expect(html).toContain('quota-card-error');
expect(html).not.toContain('app-notice-entry');
});
});