Register recipes with proper naming and tags

When auto-registering input assets from a run, detect recipes
and give them appropriate names (recipe-{hash}) and tags
(auto-registered, input, recipe) instead of generic input names.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-09 11:51:26 +00:00
parent 09c4d52aa3
commit a0d2328b01

View File

@@ -2071,14 +2071,20 @@ async def record_run(req: RecordRunRequest, user: User = Depends(get_required_us
# Register input assets (if not already on L2)
for inp in input_infos:
if not inp["existing_asset"]:
# Create new input asset
input_name = f"input-{inp['content_hash'][:16]}"
# Create new input asset with appropriate name based on type
media_type = inp["media_type"]
if media_type == "recipe":
input_name = f"recipe-{inp['content_hash'][:16]}"
tags = ["auto-registered", "input", "recipe"]
else:
input_name = f"input-{inp['content_hash'][:16]}"
tags = ["auto-registered", "input"]
input_asset = {
"name": input_name,
"content_hash": inp["content_hash"],
"ipfs_cid": inp["ipfs_cid"],
"asset_type": inp["media_type"],
"tags": ["auto-registered", "input"],
"asset_type": media_type,
"tags": tags,
"metadata": {"auto_registered_from_run": req.run_id},
"owner": user.username,
"created_at": now