From 7e74546b73b98fb7ed8b50a5092c74aad0fecf05 Mon Sep 17 00:00:00 2001 From: dashi6174 Date: Tue, 21 May 2024 11:05:41 +0800 Subject: [PATCH] =?UTF-8?q?Set=20the=20language=20default=20value=20of=20t?= =?UTF-8?q?he=20language=20based=20on=20the=20LANG=20envi=E2=80=A6=20(#853?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …ronment variable at the initial creation. 1. Set the User's default language based on LANG; 2. Set the Knowledgebase's default language based on LANG; 3. Set the default language of the Dialog based on LANG; ### What problem does this PR solve? _Briefly describe what this PR aims to solve. Include background context that will help reviewers understand the purpose of the PR._ ### Type of change - [ ] Bug Fix (non-breaking change which fixes an issue) - [ ] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Other (please describe): --- api/db/db_models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/db/db_models.py b/api/db/db_models.py index 13571703..69a27716 100644 --- a/api/db/db_models.py +++ b/api/db/db_models.py @@ -386,7 +386,7 @@ class User(DataBaseModel, UserMixin): max_length=32, null=True, help_text="English|Chinese", - default="English") + default="Chinese" if "zh_CN" in os.getenv("LANG", "") else "English")      color_schema = CharField( max_length=32, null=True, @@ -578,7 +578,7 @@ class Knowledgebase(DataBaseModel): language = CharField( max_length=32, null=True, - default="English", + default="Chinese" if "zh_CN" in os.getenv("LANG", "") else "English", help_text="English|Chinese") description = TextField(null=True, help_text="KB description") embd_id = CharField( @@ -755,7 +755,7 @@ class Dialog(DataBaseModel): language = CharField( max_length=32, null=True, - default="Chinese", + default="Chinese" if "zh_CN" in os.getenv("LANG", "") else "English", help_text="English|Chinese") llm_id = CharField(max_length=128, null=False, help_text="default llm ID") llm_setting = JSONField(null=False, default={"temperature": 0.1, "top_p": 0.3, "frequency_penalty": 0.7,