diff --git a/README.md b/README.md index 798ebc9..6909626 100644 --- a/README.md +++ b/README.md @@ -544,8 +544,8 @@ Authorization: Bearer - **请求参数说明**: - `query`: 待翻译的文本 - - `from_lang`: 源语言,支持值: `auto`(自动检测), `fr`(法语), `jp`(日语), `zh`(中文),默认为 `auto` - - `to_lang`: 目标语言,支持值: `fr`(法语), `jp`(日语), `zh`(中文),默认为 `zh`,不能为 `auto` + - `from_lang`: 源语言,支持值: `auto`(自动检测), `fra`(法语), `jp`(日语), `zh`(中文),默认为 `auto` + - `to_lang`: 目标语言,支持值: `fra`(法语), `jp`(日语), `zh`(中文),默认为 `zh`,不能为 `auto` - **响应**: diff --git a/app/schemas/trans_schemas.py b/app/schemas/trans_schemas.py index edec1b9..a345325 100644 --- a/app/schemas/trans_schemas.py +++ b/app/schemas/trans_schemas.py @@ -11,7 +11,7 @@ class TransRequest(BaseModel): @field_validator('from_lang', 'to_lang') @classmethod def validate_lang(cls, v): - allowed_langs = {'auto', 'fr', 'jp', 'zh', 'en'} + allowed_langs = {'auto', 'fra', 'jp', 'zh', 'en'} if v not in allowed_langs: raise ValueError(f'Unsupported language: {v}') return v