Compare commits
5 Commits
13babde93f
...
a5469affaa
| Author | SHA1 | Date |
|---|---|---|
|
|
a5469affaa | |
|
|
41690f007e | |
|
|
9096fdfb6e | |
|
|
396c0ae3d9 | |
|
|
61ab14c08e |
16
README.md
16
README.md
|
|
@ -375,6 +375,7 @@ Authorization: Bearer <your_jwt_token>
|
||||||
```
|
```
|
||||||
|
|
||||||
- **检索规则**:
|
- **检索规则**:
|
||||||
|
- 匹配逻辑采用 `icontains` 与 `istartswith` 模式,大小写不敏感。
|
||||||
- `language = "fr"`:
|
- `language = "fr"`:
|
||||||
- 法语/拉丁字符输入:优先使用 `WordlistFr` 做前缀 + 包含匹配。
|
- 法语/拉丁字符输入:优先使用 `WordlistFr` 做前缀 + 包含匹配。
|
||||||
- 中文输入:回退到法语释义的中文字段做反查。
|
- 中文输入:回退到法语释义的中文字段做反查。
|
||||||
|
|
@ -544,8 +545,8 @@ Authorization: Bearer <your_jwt_token>
|
||||||
|
|
||||||
- **请求参数说明**:
|
- **请求参数说明**:
|
||||||
- `query`: 待翻译的文本
|
- `query`: 待翻译的文本
|
||||||
- `from_lang`: 源语言,支持值: `auto`(自动检测), `fra`(法语), `jp`(日语), `zh`(中文),默认为 `auto`
|
- `from_lang`: 源语言,支持值: `auto`(自动检测), `fr`(法语), `jp`(日语), `zh`(中文),默认为 `auto`
|
||||||
- `to_lang`: 目标语言,支持值: `fra`(法语), `jp`(日语), `zh`(中文),默认为 `zh`,不能为 `auto`
|
- `to_lang`: 目标语言,支持值: `fr`(法语), `jp`(日语), `zh`(中文),默认为 `zh`,不能为 `auto`
|
||||||
|
|
||||||
- **响应**:
|
- **响应**:
|
||||||
|
|
||||||
|
|
@ -1234,11 +1235,12 @@ curl -X GET "http://127.0.0.1:8000/api/test/pron/start?count=5&lang=fr-FR" \
|
||||||
|
|
||||||
### 15. 部署说明
|
### 15. 部署说明
|
||||||
|
|
||||||
1. 安装依赖:`uv pip install -r requirements.txt`(或使用 `pip install -r requirements.txt`)
|
1. 安装依赖: `pip install -r requirements.txt`
|
||||||
2. 配置环境:在项目根目录准备 `.env`,写入数据库、Redis、邮件、翻译等密钥(字段参考 `settings.Settings`)
|
2. 配置数据库连接 (settings.py)
|
||||||
3. 确保 MySQL 与 Redis 服务已启动并与 `.env` 中的连接信息匹配
|
3. 配置百度翻译API密钥 (BAIDU_APPID, BAIDU_APPKEY)
|
||||||
4. 初始化数据库(首次部署):`aerich upgrade`
|
4. 启动Redis服务
|
||||||
5. 启动服务:`uvicorn main:app --host 0.0.0.0 --port 8000`(开发环境可加 `--reload`)
|
5. 运行数据库迁移
|
||||||
|
6. 启动服务: `python main.py`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@ async def new_comment(
|
||||||
type = upload.report_part
|
type = upload.report_part
|
||||||
mail_text = upload.text
|
mail_text = upload.text
|
||||||
sender = "no-reply@lexiverse.com.cn"
|
sender = "no-reply@lexiverse.com.cn"
|
||||||
receivers = ["GodricTan@gmail.com"]
|
receivers = ["GodricTan@gmail.com", "3480039769@qq.com"]
|
||||||
|
|
||||||
if type == "dict_fr":
|
# if type == "dict_fr":
|
||||||
receivers.append("aurora@lexiverse.com.cn")
|
# receivers.append("3480039769@qq.com") # 3480039769@qq.com
|
||||||
|
|
||||||
content = f"""<!DOCTYPE html>
|
content = f"""<!DOCTYPE html>
|
||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class WordSearchResponse(BaseModel):
|
||||||
query: str
|
query: str
|
||||||
pos: list
|
pos: list
|
||||||
contents: Union[List[SearchItemFr], List[SearchItemJp]]
|
contents: Union[List[SearchItemFr], List[SearchItemJp]]
|
||||||
hiragana : str
|
hiragana : Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
class ProverbSearchResponse(BaseModel):
|
class ProverbSearchResponse(BaseModel):
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class User(Model):
|
||||||
pwd_hashed = fields.CharField(max_length=60, description="密码")
|
pwd_hashed = fields.CharField(max_length=60, description="密码")
|
||||||
portrait = fields.CharField(max_length=120, default='#', description="用户头像")
|
portrait = fields.CharField(max_length=120, default='#', description="用户头像")
|
||||||
email = fields.CharField(max_length=120, description="e-mail")
|
email = fields.CharField(max_length=120, description="e-mail")
|
||||||
encrypted_phone = fields.CharField(max_length=11, description="用户手机号", null=True)
|
encrypted_phone = fields.CharField(max_length=128, description="用户手机号", null=True)
|
||||||
language = fields.ForeignKeyField("models.Language", related_name="users", on_delete=fields.CASCADE)
|
language = fields.ForeignKeyField("models.Language", related_name="users", on_delete=fields.CASCADE)
|
||||||
is_admin = fields.BooleanField(default=False, description="管理员权限")
|
is_admin = fields.BooleanField(default=False, description="管理员权限")
|
||||||
token_usage = fields.IntField(default=0, description="AI答疑使用量")
|
token_usage = fields.IntField(default=0, description="AI答疑使用量")
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ et_xmlfile==2.0.0
|
||||||
fastapi==0.116.1
|
fastapi==0.116.1
|
||||||
ffprobe8-binaries==0.3
|
ffprobe8-binaries==0.3
|
||||||
fugashi==1.5.1
|
fugashi==1.5.1
|
||||||
|
gunicorn==23.0.0
|
||||||
h11==0.16.0
|
h11==0.16.0
|
||||||
httpcore==1.0.9
|
httpcore==1.0.9
|
||||||
httpx==0.28.1
|
httpx==0.28.1
|
||||||
|
|
@ -35,6 +36,7 @@ numpy==2.3.2
|
||||||
openai==2.6.1
|
openai==2.6.1
|
||||||
opencc-python-reimplemented==0.1.7
|
opencc-python-reimplemented==0.1.7
|
||||||
openpyxl==3.1.5
|
openpyxl==3.1.5
|
||||||
|
packaging==25.0
|
||||||
pandas==2.3.1
|
pandas==2.3.1
|
||||||
pandas-stubs==2.3.2.250827
|
pandas-stubs==2.3.2.250827
|
||||||
pillow==12.0.0
|
pillow==12.0.0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue