Increase security and reformat
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import time
|
||||
|
||||
from asgiref.sync import sync_to_async
|
||||
|
||||
@@ -56,8 +55,7 @@ async def _translate_text(user, text: str, source_lang: str, target_lang: str) -
|
||||
},
|
||||
]
|
||||
return str(
|
||||
await ai_runner.run_prompt(prompt, ai_obj, operation="translation")
|
||||
or ""
|
||||
await ai_runner.run_prompt(prompt, ai_obj, operation="translation") or ""
|
||||
).strip()
|
||||
|
||||
|
||||
@@ -130,7 +128,9 @@ async def process_inbound_translation(message: Message):
|
||||
log_row.status = "failed"
|
||||
log_row.error = str(exc)
|
||||
log.warning("translation forward failed bridge=%s: %s", bridge.id, exc)
|
||||
await sync_to_async(log_row.save)(update_fields=["status", "error", "updated_at"])
|
||||
await sync_to_async(log_row.save)(
|
||||
update_fields=["status", "error", "updated_at"]
|
||||
)
|
||||
|
||||
|
||||
def apply_translation_origin(meta: dict | None, origin_tag: str) -> dict:
|
||||
|
||||
Reference in New Issue
Block a user