diff options
| author | Alex Yaroshuk <[email protected]> | 2026-02-16 00:40:09 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-15 10:40:09 -0600 |
| commit | 3a3aa300bb846ae60391ba96c5f1f4aa9a9a5d74 (patch) | |
| tree | 17067631b953670ddfa02b00af3d7382aa6a4cec /packages/ui/src/components | |
| parent | cf50a289db056657171b73fb5e1f907b0baedd59 (diff) | |
| download | opencode-3a3aa300bb846ae60391ba96c5f1f4aa9a9a5d74.tar.gz opencode-3a3aa300bb846ae60391ba96c5f1f4aa9a9a5d74.zip | |
feat(app): localize "free usage exceeded" error & "Add credits" clickable link (#13652)
Diffstat (limited to 'packages/ui/src/components')
| -rw-r--r-- | packages/ui/src/components/session-turn.css | 6 | ||||
| -rw-r--r-- | packages/ui/src/components/session-turn.tsx | 19 |
2 files changed, 24 insertions, 1 deletions
diff --git a/packages/ui/src/components/session-turn.css b/packages/ui/src/components/session-turn.css index 9887ce2fc..414e8a359 100644 --- a/packages/ui/src/components/session-turn.css +++ b/packages/ui/src/components/session-turn.css @@ -560,6 +560,12 @@ overflow-y: auto; } + .retry-error-link, + .error-card-link { + color: var(--text-strong); + text-decoration: underline; + } + [data-slot="session-turn-collapsible-content-inner"] { width: 100%; min-width: 0; diff --git a/packages/ui/src/components/session-turn.tsx b/packages/ui/src/components/session-turn.tsx index 9ffa671e6..c03622105 100644 --- a/packages/ui/src/components/session-turn.tsx +++ b/packages/ui/src/components/session-turn.tsx @@ -436,6 +436,11 @@ export function SessionTurn( if (s.type !== "retry") return return s }) + const isRetryFreeUsageLimitError = createMemo(() => { + const r = retry() + if (!r) return false + return r.message.includes("Free usage exceeded") + }) const response = createMemo(() => lastTextPart()?.text) const responsePartId = createMemo(() => lastTextPart()?.id) @@ -691,10 +696,22 @@ export function SessionTurn( {(() => { const r = retry() if (!r) return "" - const msg = unwrap(r.message) + const msg = isRetryFreeUsageLimitError() + ? i18n.t("ui.sessionTurn.error.freeUsageExceeded") + : unwrap(r.message) return msg.length > 60 ? msg.slice(0, 60) + "..." : msg })()} </span> + <Show when={isRetryFreeUsageLimitError()}> + <a + href="https://opencode.ai/zen" + target="_blank" + class="retry-error-link" + rel="noopener noreferrer" + > + {i18n.t("ui.sessionTurn.error.addCredits")} + </a> + </Show> <span data-slot="session-turn-retry-seconds"> ยท {i18n.t("ui.sessionTurn.retry.retrying")} {store.retrySeconds > 0 |
