Record L2 share when publishing runs from UI

When ui_publish_run publishes a run to L2, now properly records the
share in the local database so the UI can display the L2 badge and
published status.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-09 03:51:36 +00:00
parent e88f9812a6
commit 5ba66ed11e

View File

@@ -3623,9 +3623,20 @@ async def ui_publish_run(run_id: str, request: Request, output_name: str = Form(
resp.raise_for_status()
result = resp.json()
# Pin the output
# Pin the output and record L2 share
if run.output_hash:
await database.update_item_metadata(run.output_hash, ctx.actor_id, pinned=True, pin_reason="published")
# Record L2 share so UI shows published status
cache_path = get_cache_path(run.output_hash)
media_type = detect_media_type(cache_path) if cache_path else "image"
content_type = "video" if media_type == "video" else "image"
await database.save_l2_share(
content_hash=run.output_hash,
actor_id=ctx.actor_id,
l2_server=l2_server,
asset_name=result["asset"]["name"],
content_type=content_type
)
# Pin the inputs (for provenance)
for input_hash in run.inputs: