fix: stabilize Shopee cover replacement

This commit is contained in:
chengma
2026-07-01 08:35:46 +08:00
parent f7ea9ec0fa
commit 483bec427c
18 changed files with 782 additions and 330 deletions
+3 -12
View File
@@ -12,9 +12,9 @@ import urllib.error
import urllib.request
import uuid
from . import appconfig, db, diagnostics
from . import appconfig, db, diagnostics, image_paths
from . import prompts as prompt_module
from .config import make_slug
class AIError(RuntimeError):
@@ -390,16 +390,7 @@ def _account_name(task, account_by_alias):
def _new_cover_path(task, account_by_alias, image_root):
alias = str(getattr(task, "alias", "") or "").strip()
account = account_by_alias.get(alias)
slug = getattr(account, "slug", None) if account is not None else None
if not slug:
slug = make_slug(alias or getattr(task, "account_name", "") or "unknown")
return os.path.abspath(
os.path.join(
image_root,
slug,
"%s_new.jpg" % getattr(task, "item_id", ""),
)
)
return image_paths.task_image_path(image_root, task, account, "new")
def _mark_generate_failed(task, exc, db_path, on_task_update):