Add IPFS CID support for asset lookup
- Upload endpoint returns both CID and content_hash - Cache manager handles both SHA3-256 hashes and IPFS CIDs - get_by_cid() fetches from IPFS if not cached locally - Execute tasks support :cid in addition to :hash Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -209,9 +209,9 @@ async def upload_content(
|
||||
ctx: UserContext = Depends(require_auth),
|
||||
cache_service: CacheService = Depends(get_cache_service),
|
||||
):
|
||||
"""Upload content to cache."""
|
||||
"""Upload content to cache and IPFS."""
|
||||
content = await file.read()
|
||||
content_hash, error = await cache_service.upload_content(
|
||||
content_hash, ipfs_cid, error = await cache_service.upload_content(
|
||||
content=content,
|
||||
filename=file.filename,
|
||||
actor_id=ctx.actor_id,
|
||||
@@ -221,7 +221,8 @@ async def upload_content(
|
||||
raise HTTPException(400, error)
|
||||
|
||||
return {
|
||||
"content_hash": content_hash,
|
||||
"cid": ipfs_cid,
|
||||
"content_hash": content_hash, # Legacy, for backwards compatibility
|
||||
"filename": file.filename,
|
||||
"size": len(content),
|
||||
"uploaded": True,
|
||||
|
||||
Reference in New Issue
Block a user