feat(ai-studio): add remote image loading helpers
This commit is contained in:
@@ -553,6 +553,23 @@ def mark_asset_status(asset_id, status, path=None, conn=None):
|
||||
return get_asset(asset_id, conn=database)
|
||||
|
||||
|
||||
def update_asset_local_path(asset_id, local_path, status=ASSET_STATUS_AVAILABLE, path=None, conn=None):
|
||||
if str(status) not in ASSET_STATUSES:
|
||||
raise db.DbError("AI工场资产状态必须是 available 或 missing")
|
||||
abs_local_path = os.path.abspath(local_path) if local_path else None
|
||||
with _connection(conn, path) as database:
|
||||
with database:
|
||||
database.execute(
|
||||
"""
|
||||
UPDATE image_studio_assets
|
||||
SET local_path = ?, status = ?, updated_at = ?
|
||||
WHERE id = ?
|
||||
""",
|
||||
(abs_local_path, str(status), _now(), int(asset_id)),
|
||||
)
|
||||
return get_asset(asset_id, conn=database)
|
||||
|
||||
|
||||
def create_job(
|
||||
project_id,
|
||||
*,
|
||||
|
||||
Reference in New Issue
Block a user