fix(translate): pipeline 写库用 service 返回的 engine(之前写死 tencent)
pipeline.translate_article 调 translation_service.translate() 后, 自己写 engine_label='tencent',忽略 service 实际返回的 engine。 效果:即使 service 内部按 spark 优先链路跑成功了, DB 里 translation_engine 也只显示 tencent。 修法: 改用 tr_title.engine(or 默认 tencent 兜底)。 附带: deploy_pull.py 加 sys.stdout.reconfigure(encoding='utf-8'), Windows GBK 终端下 Unicode 字符不会再 UnicodeEncodeError。
This commit is contained in:
@@ -182,7 +182,8 @@ async def translate_article(article_id: int) -> None:
|
||||
translated_chunks.append(tr.text)
|
||||
tr_body = "\n\n".join(translated_chunks)
|
||||
|
||||
engine_label = "tencent"
|
||||
# 用 service 返回的 engine 标签(spark / tencent / tencent_maas / agnes / nllb / cache)
|
||||
engine_label = tr_title.engine or "tencent"
|
||||
status = "ok" if (tr_title.text and tr_body) else "partial"
|
||||
except Exception as e:
|
||||
logger.exception("translate article %s failed: %s", article_id, e)
|
||||
|
||||
Reference in New Issue
Block a user