feat(ai): generate covers without new titles
This commit is contained in:
@@ -973,6 +973,29 @@ def set_generated(task_id, new_title, new_cover_path, path=None, conn=None) -> N
|
||||
(new_title, new_cover_path, now, now, int(task_id)),
|
||||
)
|
||||
|
||||
|
||||
def set_generated_cover(task_id, new_cover_path, path=None, conn=None) -> None:
|
||||
"""Persist an AI-generated cover without changing the generated title."""
|
||||
|
||||
now = _now()
|
||||
with _connection(conn, path) as database:
|
||||
with database:
|
||||
database.execute(
|
||||
"""
|
||||
UPDATE tasks
|
||||
SET new_cover_path = ?,
|
||||
stage = 'generated',
|
||||
status = 'success',
|
||||
last_error = NULL,
|
||||
generate_attempts = generate_attempts + 1,
|
||||
generated_at = ?,
|
||||
updated_at = ?
|
||||
WHERE id = ?
|
||||
""",
|
||||
(new_cover_path, now, now, int(task_id)),
|
||||
)
|
||||
|
||||
|
||||
def update_generated_title(task_id, new_title, path=None, conn=None) -> None:
|
||||
"""Update a generated title manually without touching Shopee or local cover files."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user