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