🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
♻️ refactor(locales): split model-runtime errors into modelRuntime namespace (#15269)
Arvin Xu4c29515e4cc1
diff --git a/locales/en-US/error.json b/locales/en-US/error.jsonindex 74039d89d2f..973430efffe 100644--- a/locales/en-US/error.json+++ b/locales/en-US/error.json@@ -60,17 +60,7 @@"response.520": "We apologize, the server encountered an unexpected issue that prevented it from completing your request. Please try again later; we are working to resolve this issue.","response.522": "We apologize, the server connection timed out and was unable to respond to your request in a timely manner. This may be due to an unstable network or the server being temporarily inaccessible. Please try again later; we are working to restore service.","response.524": "We apologize, the server timed out while waiting for a response, possibly due to a slow reply. Please try again later.",- "response.AccountDeactivated": "Your account has been deactivated or suspended. This may be due to policy, security, or account review reasons. Please contact the provider support for assistance.",- "response.AgentRuntimeError": "Lobe language model runtime execution error. Please troubleshoot or retry based on the following information.",- "response.ComfyUIBizError": "An error occurred while requesting the ComfyUI service. Please troubleshoot using the information below or try again.",- "response.ComfyUIEmptyResult": "No image was generated by ComfyUI. Please check the model configuration or try again.",- "response.ComfyUIModelError": "Failed to load the ComfyUI model. Please ensure the model file exists.",- "response.ComfyUIServiceUnavailable": "Failed to connect to the ComfyUI service. Please ensure it is running properly and the service URL is correctly configured.",- "response.ComfyUIUploadFailed": "Failed to upload image to ComfyUI. Please check the server connection or try again.",- "response.ComfyUIWorkflowError": "ComfyUI workflow execution failed. Please verify the workflow configuration.",- "response.ConnectionCheckFailed": "The request returned empty. Please check if the API proxy address does not end with `/v1`.","response.CreateMessageError": "Sorry, the message could not be sent successfully. Please copy the content and try sending it again. This message will not be retained after refreshing the page.",- "response.ExceededContextWindow": "The current request content exceeds the length that the model can handle. Please reduce the amount of content and try again.","response.ExceededContextWindowCloud": "The conversation is too long to process. Please edit your last message to reduce input or delete some messages and try again.","response.FreePlanLimit": "You are currently a free user and cannot use this feature. Please upgrade to a paid plan to continue using it.","response.GoogleAIBlockReason.BLOCKLIST": "The content includes blocked terms. Please rephrase and try again.",@@ -83,21 +73,9 @@"response.GoogleAIBlockReason.SPII": "The content may include sensitive personal information (SPII). Please remove sensitive details and try again.","response.GoogleAIBlockReason.default": "The content was blocked ({{blockReason}}). Please adjust it and try again.","response.InsufficientBudgetForModel": "Your remaining credits are insufficient for this model. Please top up credits, upgrade your plan, or try a less expensive model.",- "response.InsufficientQuota": "Sorry, the quota for this key has been reached. Please check if your account balance is sufficient or try again after increasing the key's quota.","response.InvalidAccessCode": "Invalid access code or empty. Please enter the correct access code or add a custom API Key.",- "response.InvalidBedrockCredentials": "Bedrock authentication failed. Please check the AccessKeyId/SecretAccessKey and retry.",- "response.InvalidComfyUIArgs": "Invalid ComfyUI configuration. Please check the settings and try again.",- "response.InvalidGithubToken": "The GitHub Personal Access Token is incorrect or empty. Please check your GitHub Personal Access Token and try again.",- "response.InvalidOllamaArgs": "Invalid Ollama configuration, please check Ollama configuration and try again",- "response.InvalidProviderAPIKey": "{{provider}} API Key is incorrect or empty, please check your {{provider}} API Key and try again",- "response.InvalidVertexCredentials": "Vertex authentication failed. Please check your credentials and try again.","response.LobeHubModelDeprecated": "The model \"{{model}}\" is no longer available. Please pick a current model from the model selector.",- "response.LocationNotSupportError": "We're sorry, your current location does not support this model service. This may be due to regional restrictions or the service not being available. Please confirm if the current location supports using this service, or try using a different location.",- "response.ModelNotFound": "Sorry, the requested model could not be found. It may not exist or you may not have the necessary access permissions. Please try again after changing the API Key or adjusting your access permissions.","response.NoOpenAIAPIKey": "OpenAI API Key is empty, please add a custom OpenAI API Key",- "response.OllamaBizError": "Error requesting Ollama service, please troubleshoot or retry based on the following information",- "response.OllamaServiceUnavailable": "Ollama service is unavailable. Please check if Ollama is running properly or if the cross-origin configuration of Ollama is set correctly.",- "response.PermissionDenied": "Sorry, you do not have permission to access this service. Please check if your key has the necessary access rights.","response.PluginApiNotFound": "Sorry, the API does not exist in the skill's manifest. Please check if your request method matches the skill manifest API","response.PluginApiParamsError": "Sorry, the input parameter validation for the skill request failed. Please check if the input parameters match the API description","response.PluginFailToTransformArguments": "Sorry, the skill failed to parse the arguments. Please try regenerating the agent message or switch to a more powerful AI model with Tools Calling capability and try again",@@ -111,14 +89,11 @@"response.PluginOpenApiInitError": "Sorry, the OpenAPI client failed to initialize. Please check if the OpenAPI configuration information is correct.","response.PluginServerError": "Skill server request returned an error. Please check your skill manifest file, skill configuration, or server implementation based on the error information below","response.PluginSettingsInvalid": "This skill needs to be correctly configured before it can be used. Please check if your configuration is correct",- "response.ProviderBizError": "Error requesting {{provider}} service, please troubleshoot or retry based on the following information","response.ProviderContentModeration": "Content policy check failed. Revise your prompt and try again.","response.ProviderContentModerationWarning": "Repeated content policy rejections detected. Please revise your prompt before retrying.","response.ProviderImageContentModerationWarning": "Repeated image safety rejections detected. Similar prompts may temporarily pause image generation.",- "response.QuotaLimitReached": "Sorry, the token usage or request count has reached the quota limit for this key. Please increase the key's quota or try again later.","response.QuotaLimitReachedCloud": "The model service is currently under heavy load. Please try again later or switch to another model.","response.ServerAgentRuntimeError": "Sorry, the Agent service is currently unavailable. Please try again later or contact us via email for support.",- "response.StreamChunkError": "Error parsing the message chunk of the streaming request. Please check if the current API interface complies with the standard specifications, or contact your API provider for assistance.","response.SubscriptionKeyMismatch": "We apologize for the inconvenience. Due to a temporary system malfunction, your current subscription usage is inactive. Please click the button below to restore your subscription, or contact us via email for support.","response.SubscriptionPlanLimit": "Your subscription points have been exhausted, and you cannot use this feature. Please upgrade to a higher plan or configure a custom model API to continue using it.","response.SubscriptionPlanLimitUltimate": "Your subscription points have been exhausted, and you cannot use this feature. Please top up credits or configure a custom model API to continue using it.",diff --git a/locales/en-US/modelRuntime.json b/locales/en-US/modelRuntime.jsonnew file mode 100644index 00000000000..4604c90a1a8--- /dev/null+++ b/locales/en-US/modelRuntime.json@@ -0,0 +1,36 @@+{+ "AccountDeactivated": "Your account has been deactivated or suspended. This may be due to policy, security, or account review reasons. Please contact the provider support for assistance.",+ "AgentRuntimeError": "Lobe language model runtime execution error. Please troubleshoot or retry based on the following information.",+ "CapabilityNotSupported": "Sorry, this model does not support the requested capability (such as vision input or tool calling). Please switch to a model that supports it.",+ "ComfyUIBizError": "An error occurred while requesting the ComfyUI service. Please troubleshoot using the information below or try again.",+ "ComfyUIEmptyResult": "No image was generated by ComfyUI. Please check the model configuration or try again.",+ "ComfyUIModelError": "Failed to load the ComfyUI model. Please ensure the model file exists.",+ "ComfyUIServiceUnavailable": "Failed to connect to the ComfyUI service. Please ensure it is running properly and the service URL is correctly configured.",+ "ComfyUIUploadFailed": "Failed to upload image to ComfyUI. Please check the server connection or try again.",+ "ComfyUIWorkflowError": "ComfyUI workflow execution failed. Please verify the workflow configuration.",+ "ConnectionCheckFailed": "The request returned empty. Please check if the API proxy address does not end with `/v1`.",+ "ContentModeration": "Sorry, the content was rejected by the upstream safety filter. Please revise your prompt and try again.",+ "ExceededContextWindow": "The current request content exceeds the length that the model can handle. Please reduce the amount of content and try again.",+ "InsufficientQuota": "Sorry, the quota for this key has been reached. Please check if your account balance is sufficient or try again after increasing the key's quota.",+ "InvalidBedrockCredentials": "Bedrock authentication failed. Please check the AccessKeyId/SecretAccessKey and retry.",+ "InvalidComfyUIArgs": "Invalid ComfyUI configuration. Please check the settings and try again.",+ "InvalidGithubToken": "The GitHub Personal Access Token is incorrect or empty. Please check your GitHub Personal Access Token and try again.",+ "InvalidOllamaArgs": "Invalid Ollama configuration, please check Ollama configuration and try again",+ "InvalidProviderAPIKey": "{{provider}} API Key is incorrect or empty, please check your {{provider}} API Key and try again",+ "InvalidRequestFormat": "Sorry, the upstream provider rejected the request as malformed. Please check the input or try a different model.",+ "InvalidVertexCredentials": "Vertex authentication failed. Please check your credentials and try again.",+ "LocationNotSupportError": "We're sorry, your current location does not support this model service. This may be due to regional restrictions or the service not being available. Please confirm if the current location supports using this service, or try using a different location.",+ "ModelNotFound": "Sorry, the requested model could not be found. It may not exist or you may not have the necessary access permissions. Please try again after changing the API Key or adjusting your access permissions.",+ "NoAvailableChannel": "Sorry, the proxy or router has no available channel for the requested model. Please switch the channel/key configuration or try again later.",+ "OllamaBizError": "Error requesting Ollama service, please troubleshoot or retry based on the following information",+ "OllamaServiceUnavailable": "Ollama service is unavailable. Please check if Ollama is running properly or if the cross-origin configuration of Ollama is set correctly.",+ "OperationInactivityTimeout": "The agent operation was idle for too long and was terminated. Please retry the request.",+ "PermissionDenied": "Sorry, you do not have permission to access this service. Please check if your key has the necessary access rights.",+ "ProviderBizError": "Error requesting {{provider}} service, please troubleshoot or retry based on the following information",+ "ProviderNetworkError": "Connection to the provider timed out or was dropped. Please check your network and try again.",+ "ProviderServiceUnavailable": "The provider is temporarily overloaded or unavailable. Please try again shortly.",+ "QuotaLimitReached": "Sorry, the token usage or request count has reached the quota limit for this key. Please increase the key's quota or try again later.",+ "RateLimitExceeded": "Sorry, the token usage or request count has reached the rate limit for this key. Please try again later or increase the key's quota.",+ "StreamChunkError": "Error parsing the message chunk of the streaming request. Please check if the current API interface complies with the standard specifications, or contact your API provider for assistance.",+ "UserConfigError": "Provider configuration is invalid (incorrect base URL, missing environment variable, virtual-key restriction, etc.). Please review the provider settings."+}diff --git a/src/features/Conversation/Error/index.tsx b/src/features/Conversation/Error/index.tsxindex cff6bc4de8e..f5d7b5c56af 100644--- a/src/features/Conversation/Error/index.tsx+++ b/src/features/Conversation/Error/index.tsx@@ -19,6 +19,7 @@ import HeterogeneousAgentStatusGuide from '@/features/Electron/HeterogeneousAgenimport { useProviderName } from '@/hooks/useProviderName';import dynamic from '@/libs/next/dynamic';import { serverConfigSelectors, useServerConfigStore } from '@/store/serverConfig';+import { getRuntimeErrorMessage } from '@/utils/locale/runtimeErrorMessage';import ChatInvalidAPIKey from './ChatInvalidApiKey';@@ -135,7 +136,7 @@ const getErrorAlertConfig = (};export const useErrorContent = (error: any) => {- const { t } = useTranslation('error');+ const { t } = useTranslation(['error', 'modelRuntime']);const providerName = useProviderName(error?.body?.provider || '');const businessAlertConfig = useBusinessErrorAlertConfig(error?.type);const { errorType: businessErrorType, hideMessage } = useBusinessErrorContent(error?.type);@@ -161,7 +162,7 @@ export const useErrorContent = (error: any) => {const finalErrorType = businessErrorType ?? messageError.type;const translatedMessage = hideMessage? undefined- : t(`response.${finalErrorType}` as any, { provider: providerName });+ : getRuntimeErrorMessage(t, finalErrorType, { provider: providerName });return {message: translatedMessage || rawErrorMessage,diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/ErrorResponse.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/ErrorResponse.tsxindex c2926aeefe8..22b3bd2251a 100644--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/ErrorResponse.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/ErrorResponse.tsx@@ -4,6 +4,8 @@ import { createStaticStyles } from 'antd-style';import { memo } from 'react';import { useTranslation } from 'react-i18next';+import { getRuntimeErrorMessage } from '@/utils/locale/runtimeErrorMessage';+import PluginSettings from './PluginSettings';const styles = createStaticStyles(({ css }) => ({@@ -18,7 +20,7 @@ interface ErrorResponseProps extends ChatMessageError {}const ErrorResponse = memo<ErrorResponseProps>(({ id, type, body, message, plugin }) => {- const { t } = useTranslation('error');+ const { t } = useTranslation(['error', 'modelRuntime']);if (type === 'PluginSettingsInvalid') {return <PluginSettings id={id} plugin={plugin} />;}@@ -26,7 +28,7 @@ const ErrorResponse = memo<ErrorResponseProps>(({ id, type, body, message, plugireturn (<AlertshowIcon- title={t(`response.${type}` as any)}+ title={getRuntimeErrorMessage(t, type)}type={'secondary'}extra={<Flexbox className={styles.errorResponseExtra}>diff --git a/src/locales/default/error.ts b/src/locales/default/error.tsindex 105cf887ede..48507e3dd93 100644--- a/src/locales/default/error.ts+++ b/src/locales/default/error.ts@@ -86,22 +86,6 @@ export default {'We apologize, the server connection timed out and was unable to respond to your request in a timely manner. This may be due to an unstable network or the server being temporarily inaccessible. Please try again later; we are working to restore service.','response.524':'We apologize, the server timed out while waiting for a response, possibly due to a slow reply. Please try again later.',- 'response.AgentRuntimeError':- 'Lobe language model runtime execution error. Please troubleshoot or retry based on the following information.',- 'response.ComfyUIBizError':- 'An error occurred while requesting the ComfyUI service. Please troubleshoot using the information below or try again.',- 'response.ComfyUIEmptyResult':- 'No image was generated by ComfyUI. Please check the model configuration or try again.',- 'response.ComfyUIModelError':- 'Failed to load the ComfyUI model. Please ensure the model file exists.',- 'response.ComfyUIServiceUnavailable':- 'Failed to connect to the ComfyUI service. Please ensure it is running properly and the service URL is correctly configured.',- 'response.ComfyUIUploadFailed':- 'Failed to upload image to ComfyUI. Please check the server connection or try again.',- 'response.ComfyUIWorkflowError':- 'ComfyUI workflow execution failed. Please verify the workflow configuration.',- 'response.ConnectionCheckFailed':- 'The request returned empty. Please check if the API proxy address does not end with `/v1`.','response.CreateMessageError':'Sorry, the message could not be sent successfully. Please copy the content and try sending it again. This message will not be retained after refreshing the page.','exceededContext.compact': 'Compact Context',@@ -114,10 +98,6 @@ export default {'unknownError.retry': 'Retry','unknownError.title': 'Oops, the request took a nap',- 'response.AccountDeactivated':- 'Your account has been deactivated or suspended. This may be due to policy, security, or account review reasons. Please contact the provider support for assistance.',- 'response.ExceededContextWindow':- 'The current request content exceeds the length that the model can handle. Please reduce the amount of content and try again.','response.ExceededContextWindowCloud':'The conversation is too long to process. Please edit your last message to reduce input or delete some messages and try again.','response.QuotaLimitReachedCloud':@@ -144,33 +124,9 @@ export default {'The content may include sensitive personal information (SPII). Please remove sensitive details and try again.','response.GoogleAIBlockReason.default':'The content was blocked ({{blockReason}}). Please adjust it and try again.',- 'response.InsufficientQuota':- "Sorry, the quota for this key has been reached. Please check if your account balance is sufficient or try again after increasing the key's quota.",'response.InvalidAccessCode':'Invalid access code or empty. Please enter the correct access code or add a custom API Key.',- 'response.InvalidBedrockCredentials':- 'Bedrock authentication failed. Please check the AccessKeyId/SecretAccessKey and retry.',- 'response.InvalidComfyUIArgs':- 'Invalid ComfyUI configuration. Please check the settings and try again.',- 'response.InvalidGithubToken':- 'The GitHub Personal Access Token is incorrect or empty. Please check your GitHub Personal Access Token and try again.',- 'response.InvalidOllamaArgs':- 'Invalid Ollama configuration, please check Ollama configuration and try again',- 'response.InvalidProviderAPIKey':- '{{provider}} API Key is incorrect or empty, please check your {{provider}} API Key and try again',- 'response.InvalidVertexCredentials':- 'Vertex authentication failed. Please check your credentials and try again.',- 'response.LocationNotSupportError':- "We're sorry, your current location does not support this model service. This may be due to regional restrictions or the service not being available. Please confirm if the current location supports using this service, or try using a different location.",- 'response.ModelNotFound':- 'Sorry, the requested model could not be found. It may not exist or you may not have the necessary access permissions. Please try again after changing the API Key or adjusting your access permissions.','response.NoOpenAIAPIKey': 'OpenAI API Key is empty, please add a custom OpenAI API Key',- 'response.OllamaBizError':- 'Error requesting Ollama service, please troubleshoot or retry based on the following information',- 'response.OllamaServiceUnavailable':- 'Ollama service is unavailable. Please check if Ollama is running properly or if the cross-origin configuration of Ollama is set correctly.',- 'response.PermissionDenied':- 'Sorry, you do not have permission to access this service. Please check if your key has the necessary access rights.','response.PluginApiNotFound':"Sorry, the API does not exist in the skill's manifest. Please check if your request method matches the skill manifest API",'response.PluginApiParamsError':@@ -197,22 +153,14 @@ export default {'Skill server request returned an error. Please check your skill manifest file, skill configuration, or server implementation based on the error information below','response.PluginSettingsInvalid':'This skill needs to be correctly configured before it can be used. Please check if your configuration is correct',- 'response.ProviderBizError':- 'Error requesting {{provider}} service, please troubleshoot or retry based on the following information','response.ProviderContentModeration':'Content policy check failed. Revise your prompt and try again.','response.ProviderContentModerationWarning':'Repeated content policy rejections detected. Please revise your prompt before retrying.','response.ProviderImageContentModerationWarning':'Repeated image safety rejections detected. Similar prompts may temporarily pause image generation.',- 'response.QuotaLimitReached':- "Sorry, the token usage or request count has reached the quota limit for this key. Please increase the key's quota or try again later.",- 'response.RateLimitExceeded':- "Sorry, the token usage or request count has reached the rate limit for this key. Please try again later or increase the key's quota.",'response.ServerAgentRuntimeError':'Sorry, the Agent service is currently unavailable. Please try again later or contact us via email for support.',- 'response.StreamChunkError':- 'Error parsing the message chunk of the streaming request. Please check if the current API interface complies with the standard specifications, or contact your API provider for assistance.','response.SubscriptionKeyMismatch':'We apologize for the inconvenience. Due to a temporary system malfunction, your current subscription usage is inactive. Please click the button below to restore your subscription, or contact us via email for support.','response.SubscriptionPlanLimit':@@ -225,22 +173,6 @@ export default {'The model "{{model}}" is no longer available. Please pick a current model from the model selector.','response.UnknownChatFetchError':'Sorry, an unknown request error occurred. Please check the information below or try again.',- 'response.CapabilityNotSupported':- 'Sorry, this model does not support the requested capability (such as vision input or tool calling). Please switch to a model that supports it.',- 'response.ContentModeration':- 'Sorry, the content was rejected by the upstream safety filter. Please revise your prompt and try again.',- 'response.InvalidRequestFormat':- 'Sorry, the upstream provider rejected the request as malformed. Please check the input or try a different model.',- 'response.NoAvailableChannel':- 'Sorry, the proxy or router has no available channel for the requested model. Please switch the channel/key configuration or try again later.',- 'response.OperationInactivityTimeout':- 'The agent operation was idle for too long and was terminated. Please retry the request.',- 'response.ProviderNetworkError':- 'Connection to the provider timed out or was dropped. Please check your network and try again.',- 'response.ProviderServiceUnavailable':- 'The provider is temporarily overloaded or unavailable. Please try again shortly.',- 'response.UserConfigError':- 'Provider configuration is invalid (incorrect base URL, missing environment variable, virtual-key restriction, etc.). Please review the provider settings.','stt.responseError': 'Service request failed, please check the configuration or try again','supervisor.decisionFailed':'The group host is unable to function. Please check your host configuration to ensure the correct model, API Key, and API endpoint are set.',diff --git a/src/locales/default/index.ts b/src/locales/default/index.tsindex 6a96815e899..149f2635320 100644--- a/src/locales/default/index.ts+++ b/src/locales/default/index.ts@@ -25,6 +25,7 @@ import messenger from './messenger';import metadata from './metadata';import migration from './migration';import modelProvider from './modelProvider';+import modelRuntime from './modelRuntime';import models from './models';import notification from './notification';import oauth from './oauth';@@ -74,6 +75,7 @@ const resources = {metadata,migration,modelProvider,+ modelRuntime,models,notification,oauth,diff --git a/src/locales/default/modelRuntime.ts b/src/locales/default/modelRuntime.tsnew file mode 100644index 00000000000..f323a7a1912--- /dev/null+++ b/src/locales/default/modelRuntime.ts@@ -0,0 +1,68 @@+export default {+ AccountDeactivated:+ 'Your account has been deactivated or suspended. This may be due to policy, security, or account review reasons. Please contact the provider support for assistance.',+ AgentRuntimeError:+ 'Lobe language model runtime execution error. Please troubleshoot or retry based on the following information.',+ CapabilityNotSupported:+ 'Sorry, this model does not support the requested capability (such as vision input or tool calling). Please switch to a model that supports it.',+ ComfyUIBizError:+ 'An error occurred while requesting the ComfyUI service. Please troubleshoot using the information below or try again.',+ ComfyUIEmptyResult:+ 'No image was generated by ComfyUI. Please check the model configuration or try again.',+ ComfyUIModelError: 'Failed to load the ComfyUI model. Please ensure the model file exists.',+ ComfyUIServiceUnavailable:+ 'Failed to connect to the ComfyUI service. Please ensure it is running properly and the service URL is correctly configured.',+ ComfyUIUploadFailed:+ 'Failed to upload image to ComfyUI. Please check the server connection or try again.',+ ComfyUIWorkflowError:+ 'ComfyUI workflow execution failed. Please verify the workflow configuration.',+ ConnectionCheckFailed:+ 'The request returned empty. Please check if the API proxy address does not end with `/v1`.',+ ContentModeration:+ 'Sorry, the content was rejected by the upstream safety filter. Please revise your prompt and try again.',+ ExceededContextWindow:+ 'The current request content exceeds the length that the model can handle. Please reduce the amount of content and try again.',+ InsufficientQuota:+ "Sorry, the quota for this key has been reached. Please check if your account balance is sufficient or try again after increasing the key's quota.",+ InvalidBedrockCredentials:+ 'Bedrock authentication failed. Please check the AccessKeyId/SecretAccessKey and retry.',+ InvalidComfyUIArgs: 'Invalid ComfyUI configuration. Please check the settings and try again.',+ InvalidGithubToken:+ 'The GitHub Personal Access Token is incorrect or empty. Please check your GitHub Personal Access Token and try again.',+ InvalidOllamaArgs:+ 'Invalid Ollama configuration, please check Ollama configuration and try again',+ InvalidProviderAPIKey:+ '{{provider}} API Key is incorrect or empty, please check your {{provider}} API Key and try again',+ InvalidRequestFormat:+ 'Sorry, the upstream provider rejected the request as malformed. Please check the input or try a different model.',+ InvalidVertexCredentials:+ 'Vertex authentication failed. Please check your credentials and try again.',+ LocationNotSupportError:+ "We're sorry, your current location does not support this model service. This may be due to regional restrictions or the service not being available. Please confirm if the current location supports using this service, or try using a different location.",+ ModelNotFound:+ 'Sorry, the requested model could not be found. It may not exist or you may not have the necessary access permissions. Please try again after changing the API Key or adjusting your access permissions.',+ NoAvailableChannel:+ 'Sorry, the proxy or router has no available channel for the requested model. Please switch the channel/key configuration or try again later.',+ OllamaBizError:+ 'Error requesting Ollama service, please troubleshoot or retry based on the following information',+ OllamaServiceUnavailable:+ 'Ollama service is unavailable. Please check if Ollama is running properly or if the cross-origin configuration of Ollama is set correctly.',+ OperationInactivityTimeout:+ 'The agent operation was idle for too long and was terminated. Please retry the request.',+ PermissionDenied:+ 'Sorry, you do not have permission to access this service. Please check if your key has the necessary access rights.',+ ProviderBizError:+ 'Error requesting {{provider}} service, please troubleshoot or retry based on the following information',+ ProviderNetworkError:+ 'Connection to the provider timed out or was dropped. Please check your network and try again.',+ ProviderServiceUnavailable:+ 'The provider is temporarily overloaded or unavailable. Please try again shortly.',+ QuotaLimitReached:+ "Sorry, the token usage or request count has reached the quota limit for this key. Please increase the key's quota or try again later.",+ RateLimitExceeded:+ "Sorry, the token usage or request count has reached the rate limit for this key. Please try again later or increase the key's quota.",+ StreamChunkError:+ 'Error parsing the message chunk of the streaming request. Please check if the current API interface complies with the standard specifications, or contact your API provider for assistance.',+ UserConfigError:+ 'Provider configuration is invalid (incorrect base URL, missing environment variable, virtual-key restriction, etc.). Please review the provider settings.',+};diff --git a/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ErrorState.test.tsx b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ErrorState.test.tsxindex 936099f6b34..34705a68492 100644--- a/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ErrorState.test.tsx+++ b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ErrorState.test.tsx@@ -27,13 +27,17 @@ vi.mock('./styles', () => ({}));vi.mock('react-i18next', () => ({- useTranslation: (namespace: string) => ({+ useTranslation: (namespace: string | string[]) => ({t: (key: string) => {- if (namespace === 'error' && key === 'response.ProviderImageContentModerationWarning') {+ const namespaces = Array.isArray(namespace) ? namespace : [namespace];+ if (+ namespaces.includes('error') &&+ key === 'response.ProviderImageContentModerationWarning'+ ) {return 'Translated image moderation warning';}- if (namespace === 'error' && key === 'response.ProviderContentModeration') {+ if (namespaces.includes('error') && key === 'response.ProviderContentModeration') {return 'Translated generic moderation';}diff --git a/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ErrorState.tsx b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ErrorState.tsxindex c02c6752bf8..af51bb5056b 100644--- a/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ErrorState.tsx+++ b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ErrorState.tsx@@ -1,6 +1,5 @@'use client';-import { AgentRuntimeErrorType } from '@lobechat/model-runtime';import { Block, Center, Icon, Text } from '@lobehub/ui';import { cssVar } from 'antd-style';import { ImageOffIcon } from 'lucide-react';@@ -9,6 +8,7 @@ import { useTranslation } from 'react-i18next';import defaultErrorLocale from '@/locales/default/error';import { AsyncTaskErrorType } from '@/types/asyncTask';+import { getRuntimeErrorMessage } from '@/utils/locale/runtimeErrorMessage';import { ActionButtons } from './ActionButtons';import { styles } from './styles';@@ -30,7 +30,7 @@ const providerContentModerationKeyByDefaultMessage = new Map<export const ErrorState = memo<ErrorStateProps>(({ generation, generationBatch, aspectRatio, onDelete, onCopyError }) => {const { t } = useTranslation('image');- const { t: tError } = useTranslation('error');+ const { t: tError } = useTranslation(['error', 'modelRuntime']);const errorMessage = useMemo(() => {if (!generation.task.error) return '';@@ -64,16 +64,15 @@ export const ErrorState = memo<ErrorStateProps>(return translateErrorKey(defaultMessageTranslationKey) || errorBody;}- // Check if the error body is an AgentRuntimeErrorType that needs translation- const knownErrorTypes = Object.values(AgentRuntimeErrorType);+ // Try the unified ERROR_CODE_SPECS-driven lookup (routes to either the+ // new `modelRuntime` namespace or legacy `error.response.<X>`).+ const runtimeMessage = getRuntimeErrorMessage(tError, errorBody);if (- knownErrorTypes.includes(- errorBody as (typeof AgentRuntimeErrorType)[keyof typeof AgentRuntimeErrorType],- )+ runtimeMessage &&+ runtimeMessage !== `modelRuntime:${errorBody}` &&+ runtimeMessage !== `response.${errorBody}`) {- // Use localized error message - ComfyUI errors are under 'response' namespace- const translationKey = `response.${errorBody}`;- return translateErrorKey(translationKey, errorBody) || errorBody;+ return runtimeMessage;}}diff --git a/src/routes/(main)/(create)/video/features/GenerationFeed/VideoErrorItem.tsx b/src/routes/(main)/(create)/video/features/GenerationFeed/VideoErrorItem.tsxindex 785f1f6650b..3ca57707b42 100644--- a/src/routes/(main)/(create)/video/features/GenerationFeed/VideoErrorItem.tsx+++ b/src/routes/(main)/(create)/video/features/GenerationFeed/VideoErrorItem.tsx@@ -1,6 +1,5 @@'use client';-import { AgentRuntimeErrorType } from '@lobechat/model-runtime';import { Block, Center, Icon, Text } from '@lobehub/ui';import { cssVar } from 'antd-style';import { VideoOffIcon } from 'lucide-react';@@ -11,6 +10,7 @@ import { ActionButtons } from '@/routes/(main)/(create)/image/features/Generatioimport { styles } from '@/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/styles';import { AsyncTaskErrorType } from '@/types/asyncTask';import type { Generation } from '@/types/generation';+import { getRuntimeErrorMessage } from '@/utils/locale/runtimeErrorMessage';interface VideoErrorItemProps {aspectRatio?: string;@@ -22,7 +22,7 @@ interface VideoErrorItemProps {const VideoErrorItem = memo<VideoErrorItemProps>(({ generation, aspectRatio, onDelete, onCopyError }) => {const { t } = useTranslation('video');- const { t: tError } = useTranslation('error');+ const { t: tError } = useTranslation(['error', 'modelRuntime']);const errorMessage = useMemo(() => {if (!generation.task.error) return '';@@ -31,28 +31,18 @@ const VideoErrorItem = memo<VideoErrorItemProps>(const errorBody = typeof error.body === 'string' ? error.body : error.body?.detail;if (errorBody) {- const knownErrorTypes = Object.values(AgentRuntimeErrorType);+ const translated = getRuntimeErrorMessage(tError, errorBody);if (- knownErrorTypes.includes(- errorBody as (typeof AgentRuntimeErrorType)[keyof typeof AgentRuntimeErrorType],- )+ translated &&+ translated !== `modelRuntime:${errorBody}` &&+ translated !== `response.${errorBody}`) {- const translationKey = `response.${errorBody}`;- const translated = tError(translationKey as any);-- if (translated === translationKey || (translated as string).startsWith('response.')) {- const directTranslated = tError(errorBody as any);- if (directTranslated !== errorBody) {- return directTranslated as string;- }- return errorBody;- }-- return translated as string;+ return translated;}+ return errorBody;}- return errorBody || error.name || 'Unknown error';+ return error.name || 'Unknown error';}, [generation.task.error, tError]);const isProviderContentModerationError =diff --git a/src/routes/(main)/settings/provider/features/ProviderConfig/Checker.tsx b/src/routes/(main)/settings/provider/features/ProviderConfig/Checker.tsxindex 3613594d8d2..122abfc74c7 100644--- a/src/routes/(main)/settings/provider/features/ProviderConfig/Checker.tsx+++ b/src/routes/(main)/settings/provider/features/ProviderConfig/Checker.tsx@@ -15,6 +15,7 @@ import { useTranslation } from 'react-i18next';import { useProviderName } from '@/hooks/useProviderName';import { chatService } from '@/services/chat';import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';+import { getRuntimeErrorMessage } from '@/utils/locale/runtimeErrorMessage';const styles = createStaticStyles(({ css }) => ({popup: css`@@ -22,14 +23,14 @@ const styles = createStaticStyles(({ css }) => ({`,}));const Error = memo<{ error: ChatMessageError }>(({ error }) => {- const { t } = useTranslation('error');+ const { t } = useTranslation(['error', 'modelRuntime']);const providerName = useProviderName(error.body?.provider);return (<Flexbox gap={8} style={{ maxWidth: 600, width: '100%' }}><AlertshowIcon- title={t(`response.${error.type}` as any, { provider: providerName })}+ title={getRuntimeErrorMessage(t, error.type, { provider: providerName })}type={'error'}extra={<Flexbox paddingBlock={8} paddingInline={16}>@@ -134,7 +135,7 @@ const Checker = memo<ConnectionCheckerProps>(setPass(false);setError({body: value,- message: t('response.ConnectionCheckFailed', { ns: 'error' }),+ message: getRuntimeErrorMessage(t, 'ConnectionCheckFailed'),type: 'ConnectionCheckFailed',});}diff --git a/src/utils/locale/runtimeErrorMessage.ts b/src/utils/locale/runtimeErrorMessage.tsnew file mode 100644index 00000000000..4c8d2e58e8e--- /dev/null+++ b/src/utils/locale/runtimeErrorMessage.ts@@ -0,0 +1,33 @@+import { getErrorCodeSpec } from '@lobechat/model-runtime';++/**+ * Loose `t` shape that accepts any key / vars — the type-safe key inference in+ * `i18next.CustomTypeOptions` doesn't help here because we look up dynamically.+ */+type LooseT = (key: string, vars?: Record<string, unknown>) => string;++/**+ * Resolve the localized message for an error type, routing between the new+ * `modelRuntime` namespace (one key per `AgentRuntimeErrorType`) and the legacy+ * `error.response.<X>` map.+ *+ * - If `code` is a known runtime code (present in `ERROR_CODE_SPECS`), the+ * message lives under `modelRuntime:<code>`.+ * - Otherwise (HTTP status code, Plugin*, Cloud-only ChatErrorType, etc.) it+ * stays in the legacy `error.response.<X>` location.+ *+ * The caller should pre-load both namespaces:+ * `useTranslation(['error', 'modelRuntime'])`.+ */+export const getRuntimeErrorMessage = (+ t: unknown,+ code: string | number | undefined,+ vars?: Record<string, unknown>,+): string => {+ if (code === undefined || code === null || code === '') return '';+ const key =+ typeof code === 'string' && getErrorCodeSpec(code)+ ? `modelRuntime:${code}`+ : `response.${code}`;+ return (t as LooseT)(key, vars);+};