diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/ErrorMessage.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/ErrorMessage.tsx index 3d38b0b65..803669df6 100644 --- a/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/ErrorMessage.tsx +++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/ErrorMessage.tsx @@ -1,8 +1,8 @@ import { Spring } from "@follow/components/constants/spring.js" import { cn } from "@follow/utils" -import { ExceptionCodeMap } from "@follow-app/client-sdk" import { m } from "motion/react" import * as React from "react" +import { useTranslation } from "react-i18next" import { getErrorMessage, parseAIError } from "~/modules/ai-chat/utils/error" @@ -17,6 +17,7 @@ interface ErrorMessageProps { * Note: Rate limit errors are handled separately by RateLimitNotice component */ export const ErrorMessage: React.FC = ({ error, className }) => { + const { t } = useTranslation("ai") const parsedError = React.useMemo(() => parseAIError(error), [error]) if (parsedError.isRateLimitError) { @@ -36,20 +37,6 @@ export const ErrorMessage: React.FC = ({ error, className }) } } - const getErrorTitle = () => { - if (parsedError.isBusinessError) { - switch (errorCode) { - case ExceptionCodeMap.AIRateLimitExceeded: { - return "AI Rate Limit Exceeded" - } - default: { - return "Error occurred" - } - } - } - return "Error occurred" - } - const contextualInfo = getContextualInfo() return ( @@ -66,7 +53,9 @@ export const ErrorMessage: React.FC = ({ error, className }) {/* Header with subtle icon */}
- {getErrorTitle()} + + {t("chat.error.occurred")} +
{/* Error message - always visible but subtle */} diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/services/index.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/services/index.ts index 407d17d07..899e26767 100644 --- a/apps/desktop/layer/renderer/src/modules/ai-chat/services/index.ts +++ b/apps/desktop/layer/renderer/src/modules/ai-chat/services/index.ts @@ -266,7 +266,7 @@ class AIPersistServiceStatic { const referenceDate = timestamps?.updatedAt ?? timestamps?.createdAt ?? new Date() const formattedDateTime = this.formatDateTime(referenceDate, i18n.language) - return `${formattedDateTime} chat` + return i18n.t("chat.default_title.chat", { ns: "ai", time: formattedDateTime }) } const datePart = chatId.slice(prefix.length) @@ -287,7 +287,7 @@ class AIPersistServiceStatic { const formattedDateTime = this.formatDateTime(targetDate, i18n.language) - return `${formattedDateTime} timeline summary` + return i18n.t("chat.default_title.timeline_summary", { ns: "ai", time: formattedDateTime }) } private formatDateTime(date: Date, locale?: string): string { diff --git a/locales/ai/en.json b/locales/ai/en.json index f4a1af1a6..f74de218a 100644 --- a/locales/ai/en.json +++ b/locales/ai/en.json @@ -55,7 +55,10 @@ "chat.context.additional": "Additional Context", "chat.context.unread_only": "Unread Only", "chat.context.upload_files": "Upload Files", + "chat.default_title.chat": "{{time}} chat", + "chat.default_title.timeline_summary": "{{time}} timeline summary", "chat.error.description": "Don't worry! You can try again or reload the chat to continue your conversation.", + "chat.error.occurred": "Error occurred", "chat.error.reload_page": "Reload Page", "chat.error.stream_timeout": "The reply stopped arriving, so it was ended. Retry your message to try again.", "chat.error.title": "AI Chat Encountered an Error", diff --git a/locales/ai/fr-FR.json b/locales/ai/fr-FR.json index 1145cb744..7206fd860 100644 --- a/locales/ai/fr-FR.json +++ b/locales/ai/fr-FR.json @@ -55,7 +55,10 @@ "chat.context.additional": "Contexte supplémentaire", "chat.context.unread_only": "Non lus uniquement", "chat.context.upload_files": "Importer des fichiers", + "chat.default_title.chat": "Discussion du {{time}}", + "chat.default_title.timeline_summary": "Résumé de la chronologie du {{time}}", "chat.error.description": "Pas d'inquiétude ! Vous pouvez réessayer ou recharger la discussion pour poursuivre votre conversation.", + "chat.error.occurred": "Une erreur s'est produite", "chat.error.reload_page": "Recharger la page", "chat.error.stream_timeout": "La réponse a cessé d'arriver et a été interrompue. Réessayez votre message.", "chat.error.title": "La discussion IA a rencontré une erreur", diff --git a/locales/ai/ja.json b/locales/ai/ja.json index 7cea60b4a..6ce7ad530 100644 --- a/locales/ai/ja.json +++ b/locales/ai/ja.json @@ -55,7 +55,10 @@ "chat.context.additional": "その他のコンテキスト", "chat.context.unread_only": "未読のみ", "chat.context.upload_files": "ファイルをアップロード", + "chat.default_title.chat": "{{time}} のチャット", + "chat.default_title.timeline_summary": "{{time}} のタイムラインの要約", "chat.error.description": "ご安心ください。再試行するか、チャットを再読み込みすると会話を続けられます。", + "chat.error.occurred": "エラーが発生しました", "chat.error.reload_page": "ページを再読み込み", "chat.error.stream_timeout": "応答が途中で届かなくなったため終了しました。メッセージを再試行してください。", "chat.error.title": "AI チャットでエラーが発生しました", diff --git a/locales/ai/zh-CN.json b/locales/ai/zh-CN.json index abbf01b93..edcdecc8a 100644 --- a/locales/ai/zh-CN.json +++ b/locales/ai/zh-CN.json @@ -55,7 +55,10 @@ "chat.context.additional": "其他上下文", "chat.context.unread_only": "仅未读", "chat.context.upload_files": "上传文件", + "chat.default_title.chat": "{{time}} 对话", + "chat.default_title.timeline_summary": "{{time}} 时间线摘要", "chat.error.description": "别担心!您可以重试或重新加载对话,继续之前的交流。", + "chat.error.occurred": "出错了", "chat.error.reload_page": "重新加载页面", "chat.error.stream_timeout": "回复长时间没有新内容,已结束。请重试你的消息。", "chat.error.title": "AI 对话出错了", diff --git a/locales/ai/zh-TW.json b/locales/ai/zh-TW.json index d9755c8ea..a6224c0cf 100644 --- a/locales/ai/zh-TW.json +++ b/locales/ai/zh-TW.json @@ -55,7 +55,10 @@ "chat.context.additional": "其他上下文", "chat.context.unread_only": "僅未讀", "chat.context.upload_files": "上傳檔案", + "chat.default_title.chat": "{{time}} 對話", + "chat.default_title.timeline_summary": "{{time}} 時間軸摘要", "chat.error.description": "別擔心!您可以重試或重新載入對話,繼續先前的交流。", + "chat.error.occurred": "發生錯誤", "chat.error.reload_page": "重新載入頁面", "chat.error.stream_timeout": "回覆長時間沒有新內容,已結束。請重試你的訊息。", "chat.error.title": "AI 對話發生錯誤",