From c2531c33f008c8d489a01d1f6aa4c09522e7557c Mon Sep 17 00:00:00 2001 From: ParkMinsu Date: Sat, 27 Sep 2025 21:26:05 +0900 Subject: [PATCH] korean update --- backend/apps/chat/task/llm.py | 11 +- backend/apps/datasource/crud/datasource.py | 3 +- backend/apps/system/api/user.py | 2 +- backend/apps/system/schemas/system_schema.py | 6 +- backend/common/core/config.py | 1 - backend/locales/ko-KR.json | 54 +++++++ .../components/Language-selector/index.vue | 28 ++-- frontend/src/components/layout/Person.vue | 15 +- frontend/src/i18n/en.json | 4 +- frontend/src/i18n/index.ts | 18 ++- frontend/src/i18n/ko-KR.json | 140 ++++++++++++++++++ frontend/src/i18n/zh-CN.json | 2 + frontend/src/stores/user.ts | 6 +- 13 files changed, 260 insertions(+), 30 deletions(-) create mode 100644 backend/locales/ko-KR.json create mode 100644 frontend/src/i18n/ko-KR.json diff --git a/backend/apps/chat/task/llm.py b/backend/apps/chat/task/llm.py index 9dce46a4..bcffdc11 100644 --- a/backend/apps/chat/task/llm.py +++ b/backend/apps/chat/task/llm.py @@ -418,7 +418,7 @@ class LLMService: full_thinking_text = '' full_text = '' if not ignore_auto_select: - if settings.TABLE_EMBEDDING_ENABLED: + if settings.EMBEDDING_ENABLED: ds = get_ds_embedding(self.session, self.current_user, _ds_list, self.out_ds_instance, self.chat_question.question, self.current_assistant) yield {'content': '{"id":' + str(ds.get('id')) + '}'} @@ -508,7 +508,7 @@ class LLMService: except Exception as e: _error = e - if not ignore_auto_select and not settings.TABLE_EMBEDDING_ENABLED: + if not ignore_auto_select and not settings.EMBEDDING_ENABLED: self.record = save_select_datasource_answer(session=self.session, record_id=self.record.id, answer=orjson.dumps({'content': full_text}).decode(), datasource=_datasource, @@ -1443,6 +1443,11 @@ def process_stream(res: Iterator[BaseMessageChunk], def get_lang_name(lang: str): - if lang and lang == 'en': + if not lang: + return '简体中文' + normalized = lang.lower() + if normalized.startswith('en'): return '英文' + if normalized.startswith('ko'): + return '韩语' return '简体中文' diff --git a/backend/apps/datasource/crud/datasource.py b/backend/apps/datasource/crud/datasource.py index c541a152..1ec08079 100644 --- a/backend/apps/datasource/crud/datasource.py +++ b/backend/apps/datasource/crud/datasource.py @@ -13,7 +13,6 @@ from apps.datasource.utils.utils import aes_decrypt from apps.db.constant import DB from apps.db.db import get_tables, get_fields, exec_sql, check_connection from apps.db.engine import get_engine_config, get_engine_conn -from common.core.config import settings from common.core.deps import SessionDep, CurrentUser, Trans from common.utils.utils import deepcopy_ignore_extra from .table import get_tables_by_ds_id @@ -403,7 +402,7 @@ def get_table_schema(session: SessionDep, current_user: CurrentUser, ds: CoreDat all_tables.append(t_obj) # do table embedding - if embedding and tables and settings.TABLE_EMBEDDING_ENABLED: + if embedding and tables: tables = get_table_embedding(session, current_user, tables, question) # splice schema if tables: diff --git a/backend/apps/system/api/user.py b/backend/apps/system/api/user.py index d6f33cda..7453e94e 100644 --- a/backend/apps/system/api/user.py +++ b/backend/apps/system/api/user.py @@ -193,7 +193,7 @@ async def batch_del(session: SessionDep, id_list: list[int]): @clear_cache(namespace=CacheNamespace.AUTH_INFO, cacheName=CacheName.USER_INFO, keyExpression="current_user.id") async def langChange(session: SessionDep, current_user: CurrentUser, trans: Trans, language: UserLanguage): lang = language.language - if lang not in ["zh-CN", "en"]: + if lang not in ["zh-CN", "en", "ko-KR"]: raise Exception(trans('i18n_user.language_not_support', key = lang)) db_user: UserModel = get_db_user(session=session, user_id=current_user.id) db_user.language = lang diff --git a/backend/apps/system/schemas/system_schema.py b/backend/apps/system/schemas/system_schema.py index 728ca480..6505e8fd 100644 --- a/backend/apps/system/schemas/system_schema.py +++ b/backend/apps/system/schemas/system_schema.py @@ -31,7 +31,7 @@ class BaseUser(BaseModel): class BaseUserDTO(BaseUser, BaseCreatorDTO): - language: str = Field(pattern=r"^(zh-CN|en)$", default="zh-CN", description="用户语言") + language: str = Field(pattern=r"^(zh-CN|en|ko-KR)$", default="zh-CN", description="用户语言") password: str status: int = 1 @@ -44,8 +44,8 @@ class BaseUserDTO(BaseUser, BaseCreatorDTO): @field_validator("language") def validate_language(cls, lang: str) -> str: - if not re.fullmatch(r"^(zh-CN|en)$", lang): - raise ValueError("Language must be 'zh-CN' or 'en'") + if not re.fullmatch(r"^(zh-CN|en|ko-KR)$", lang): + raise ValueError("Language must be 'zh-CN', 'en', or 'ko-KR'") return lang diff --git a/backend/common/core/config.py b/backend/common/core/config.py index ca0468b8..e528d1cf 100644 --- a/backend/common/core/config.py +++ b/backend/common/core/config.py @@ -105,7 +105,6 @@ class Settings(BaseSettings): PG_POOL_RECYCLE: int = 3600 PG_POOL_PRE_PING: bool = True - TABLE_EMBEDDING_ENABLED: bool = False TABLE_EMBEDDING_COUNT: int = 10 diff --git a/backend/locales/ko-KR.json b/backend/locales/ko-KR.json new file mode 100644 index 00000000..59f56189 --- /dev/null +++ b/backend/locales/ko-KR.json @@ -0,0 +1,54 @@ +{ + "i18n_default_workspace": "기본 워크스페이스", + "i18n_ds_name_exist": "이미 존재하는 이름입니다", + "i18n_concat_admin": "관리자에게 문의해 주세요!", + "i18n_exist": "{msg}이(가) 이미 존재합니다!", + "i18n_name": "이름", + "i18n_not_exist": "{msg}을(를) 찾을 수 없습니다", + "i18n_error": "{key} 오류!", + "i18n_miss_args": "{key} 매개변수가 없습니다!", + "i18n_format_invalid": "{key} 형식이 올바르지 않습니다!", + "i18n_login": { + "account_pwd_error": "계정 또는 비밀번호가 올바르지 않습니다!", + "no_associated_ws": "연결된 워크스페이스가 없습니다. {msg}", + "user_disable": "계정이 비활성화되었습니다. {msg}" + }, + "i18n_user": { + "account": "계정", + "email": "이메일", + "password": "비밀번호", + "language_not_support": "[{key}] 언어는 지원하지 않습니다!", + "ws_miss": "현재 사용자는 워크스페이스 [{ws}]에 속해 있지 않습니다!" + }, + "i18n_ws": { + "title": "워크스페이스" + }, + "i18n_permission": { + "only_admin": "관리자만 호출할 수 있습니다!", + "no_permission": "{url}{msg}에 접근 권한이 없습니다", + "authenticate_invalid": "인증이 실패했습니다 [{msg}]", + "token_expired": "토큰이 만료되었습니다" + }, + "i18n_llm": { + "validate_error": "검증에 실패했습니다 [{msg}]", + "delete_default_error": "기본 모델 [{key}]은 삭제할 수 없습니다!", + "miss_default": "기본 LLM이 아직 설정되지 않았습니다" + }, + "i18n_ds_invalid": "데이터 소스가 유효하지 않습니다", + "i18n_embedded": { + "invalid_origin": "도메인 검증에 실패했습니다 [{origin}]" + }, + "i18n_terminology": { + "terminology_not_exists": "용어를 찾을 수 없습니다", + "cannot_be_repeated": "용어 이름과 동의어는 중복될 수 없습니다", + "exists_in_db": "용어 이름 또는 동의어가 이미 존재합니다" + }, + "i18n_data_training": { + "datasource_cannot_be_none": "데이터 소스를 선택해 주세요", + "data_training_not_exists": "예제가 존재하지 않습니다", + "exists_in_db": "질문이 이미 존재합니다" + }, + "i18n_excel_export": { + "data_is_empty": "양식 데이터가 없어 내보낼 수 없습니다" + } +} \ No newline at end of file diff --git a/frontend/src/components/Language-selector/index.vue b/frontend/src/components/Language-selector/index.vue index 5ab19f0a..7d9ee8d1 100644 --- a/frontend/src/components/Language-selector/index.vue +++ b/frontend/src/components/Language-selector/index.vue @@ -1,21 +1,20 @@