From b5f2a04ea29d4342f6e43790e9496a1fbaeac1bb Mon Sep 17 00:00:00 2001 From: "sp.wack" <83104063+amanape@users.noreply.github.com> Date: Wed, 28 May 2025 17:23:14 +0400 Subject: [PATCH] Add refill link to out-of-credits error message (#8737) Co-authored-by: openhands --- .../features/chat/chat-interface.tsx | 7 +---- .../features/chat/error-message-banner.tsx | 22 +++++++++++++- frontend/src/i18n/translation.json | 30 +++++++++---------- 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/frontend/src/components/features/chat/chat-interface.tsx b/frontend/src/components/features/chat/chat-interface.tsx index fbcf31a400..9cc2c214bc 100644 --- a/frontend/src/components/features/chat/chat-interface.tsx +++ b/frontend/src/components/features/chat/chat-interface.tsx @@ -26,7 +26,6 @@ import { downloadTrajectory } from "#/utils/download-trajectory"; import { displayErrorToast } from "#/utils/custom-toast-handlers"; import { useOptimisticUserMessage } from "#/hooks/use-optimistic-user-message"; import { useWSErrorMessage } from "#/hooks/use-ws-error-message"; -import i18n from "#/i18n"; import { ErrorMessageBanner } from "./error-message-banner"; import { shouldRenderEvent } from "./event-content-helpers/should-render-event"; @@ -181,11 +180,7 @@ export function ChatInterface() { {!hitBottom && } - {errorMessage && ( - - )} + {errorMessage && } - {message} + {i18n.exists(message) ? ( + + link + + ), + }} + /> + ) : ( + message + )} ); } diff --git a/frontend/src/i18n/translation.json b/frontend/src/i18n/translation.json index 4af617a8ef..f2d01274c5 100644 --- a/frontend/src/i18n/translation.json +++ b/frontend/src/i18n/translation.json @@ -6400,20 +6400,20 @@ "uk": "Запит не вдалося виконати через внутрішню помилку сервера." }, "STATUS$ERROR_LLM_OUT_OF_CREDITS": { - "en": "You're out of OpenHands Credits", - "ja": "OpenHandsクレジットが不足しています", - "zh-CN": "您的OpenHands点数已用完", - "zh-TW": "您的OpenHands點數已用完", - "ko-KR": "OpenHands 크레딧이 소진되었습니다", - "no": "Du er tom for OpenHands-kreditter", - "it": "Hai esaurito i crediti OpenHands", - "pt": "Você está sem créditos OpenHands", - "es": "Te has quedado sin créditos de OpenHands", - "ar": "لقد نفدت رصيدك من OpenHands", - "fr": "Vous n'avez plus de crédits OpenHands", - "tr": "OpenHands kredileriniz tükendi", - "de": "Ihre OpenHands-Guthaben sind aufgebraucht", - "uk": "У вас закінчилися кредити OpenHands" + "en": "You're out of OpenHands Credits. Add funds", + "ja": "OpenHandsクレジットが不足しています。資金を追加", + "zh-CN": "您的OpenHands点数已用完。添加资金", + "zh-TW": "您的OpenHands點數已用完。添加資金", + "ko-KR": "OpenHands 크레딧이 소진되었습니다. 자금 추가", + "no": "Du er tom for OpenHands-kreditter. Legg til midler", + "it": "Hai esaurito i crediti OpenHands. Aggiungi fondi", + "pt": "Você está sem créditos OpenHands. Adicionar fundos", + "es": "Te has quedado sin créditos de OpenHands. Añadir fondos", + "ar": "لقد نفدت رصيدك من OpenHands. إضافة رصيد", + "fr": "Vous n'avez plus de crédits OpenHands. Ajouter des fonds", + "tr": "OpenHands kredileriniz tükendi. Bakiye ekle", + "de": "Ihre OpenHands-Guthaben sind aufgebraucht. Guthaben hinzufügen", + "uk": "У вас закінчилися кредити OpenHands. Додати кошти" }, "STATUS$ERROR_LLM_CONTENT_POLICY_VIOLATION": { "en": "Content policy violation. The output was blocked by content filtering policy.", @@ -8780,7 +8780,7 @@ "ar": "إرسال...", "fr": "Envoi...", "tr": "Gönderiliyor...", - "de": "Senden...", + "de": "Senden...", "uk": "Відправляємо..." }, "FEEDBACK$SUBMITTING_MESSAGE": {