Increase security and reformat

This commit is contained in:
2026-03-07 20:52:13 +00:00
parent 10588a18b9
commit bca4d6898f
144 changed files with 6735 additions and 3960 deletions

View File

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