Set the language default value of the language based on the LANG envi… (#853)

…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):
This commit is contained in:
dashi6174 2024-05-21 11:05:41 +08:00 committed by GitHub
parent 25781113f9
commit 7e74546b73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,