Skip to content

Commit 33e3102

Browse files
committed
feat: Add Api Docs
1 parent 2952c87 commit 33e3102

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

backend/apps/swagger/i18n.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from pathlib import Path
66
from typing import Dict
77

8+
i18n_list = ["en", "zh"]
9+
810
# placeholder prefix(trans key prefix)
911
PLACEHOLDER_PREFIX = "PLACEHOLDER_"
1012

backend/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from alembic import command
1717
from apps.api import api_router
18-
from apps.swagger.i18n import PLACEHOLDER_PREFIX, tags_metadata
18+
from apps.swagger.i18n import PLACEHOLDER_PREFIX, tags_metadata, i18n_list
1919
from apps.swagger.i18n import get_translation, DEFAULT_LANG
2020
from apps.system.crud.aimodel_manage import async_model_info
2121
from apps.system.crud.assistant import init_dynamic_cors
@@ -100,7 +100,7 @@ def replace_placeholders_in_schema(schema: Dict[str, Any], trans: Dict[str, str]
100100
def get_language_from_request(request: Request) -> str:
101101
# get param from query ?lang=zh
102102
lang = request.query_params.get("lang")
103-
if lang in ["en", "zh"]:
103+
if lang in i18n_list:
104104
return lang
105105
# get lang from Accept-Language Header
106106
accept_lang = request.headers.get("accept-language", "")

0 commit comments

Comments
 (0)