法语翻译修复

This commit is contained in:
Miyamizu-MitsuhaSang 2025-11-08 22:35:24 +08:00
parent 294b1353cc
commit 9d46299f8f
2 changed files with 3 additions and 3 deletions

View File

@ -544,8 +544,8 @@ Authorization: Bearer <your_jwt_token>
- **请求参数说明**:
- `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`
- **响应**:

View File

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