lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
45.42k stars 10.2k forks source link

[Bug] "Auto Generate" fields sometimes outputs in Chinese #4622

Open darxreborn opened 3 weeks ago

darxreborn commented 3 weeks ago

📦 Environment

Docker

📌 Version

1.28.0

💻 Operating System

Windows, macOS, Ubuntu, Other Linux

🌐 Browser

Chrome, Edge, Safari, Firefox, Other

🐛 Bug Description

When creating a new assistant and providing a role setting, within the assistant setting ("Assistant Info") the button "Auto Generate" sometimes outputs/fills in the data in Chinese rather than the user's language.

📷 Recurrence Steps

Example:

  1. image
  2. image

🚦 Expected Behavior

The output should be in English (example): image

📝 Additional Information

The generate in Chinese text is quite random; so everytime the button is clicked the output will be written in Chinese more often that in English. User setting is set to English:

image
lobehubbot commented 3 weeks ago

👀 @ggatesdew

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

dosubot[bot] commented 3 weeks ago

Hey there, @ggatesdew! I'm here to help you with any bugs, questions, or contributions. Let's tackle this issue together!

The issue you're experiencing with the "Auto Generate" feature outputting in Chinese instead of the user's preferred language might be related to how the language preference is being detected or applied. Here are a few areas to investigate:

  1. Language Detection and Preference: Ensure that the language detection mechanism is correctly identifying and applying the user's language preference. The application uses the createI18nNext function with the i18next library and LanguageDetector plugin to determine the user's language preference, which is stored in cookies [1].

  2. Fallback Mechanism: Check if the fallback mechanism is inadvertently defaulting to Chinese. The system should fall back to a default language if the preferred language is not available. This default is determined by the DEFAULT_LANG constant, which should be set correctly to avoid unexpected language outputs [2].

  3. Translation Files: Verify that the translation files for the preferred language (e.g., English) are complete and correctly configured. Any discrepancies in these files could lead to incorrect language output.

  4. Code Logic: Review the logic in the AutoGenerateInput.tsx file to ensure that the translation function t is being used correctly to fetch the appropriate language strings [3].

By checking these areas, you might identify the root cause of the issue. If the problem persists, consider reviewing recent changes in the codebase that might have affected language handling.

To continue talking to Dosu, mention @dosu.