From 0acc49ee85e137015a7f3f2c2633b9ce55bc2fa9 Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Sun, 12 Apr 2026 13:58:27 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E9=85=8D=E6=96=B9=E4=B8=AD=E6=96=87=E5=90=8D=E6=97=B6=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E9=87=8D=E6=96=B0=E7=BF=BB=E8=AF=91=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 改名但没手动指定英文名时,自动用 auto_translate 重新生成。 Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/main.py b/backend/main.py index b07511b..e727656 100644 --- a/backend/main.py +++ b/backend/main.py @@ -858,6 +858,9 @@ def update_recipe(recipe_id: int, update: RecipeUpdate, user=Depends(get_current if update.name is not None: c.execute("UPDATE recipes SET name = ? WHERE id = ?", (update.name, recipe_id)) + # Re-translate en_name if name changed and no explicit en_name provided + if update.en_name is None: + c.execute("UPDATE recipes SET en_name = ? WHERE id = ?", (auto_translate(update.name), recipe_id)) if update.note is not None: c.execute("UPDATE recipes SET note = ? WHERE id = ?", (update.note, recipe_id)) if update.en_name is not None: