make get signed_url requests async in get_agent_task_step_artifacts api (#192)
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import asyncio
|
||||||
from typing import Annotated, Any
|
from typing import Annotated, Any
|
||||||
|
|
||||||
import structlog
|
import structlog
|
||||||
@@ -400,8 +401,9 @@ async def get_agent_task_step_artifacts(
|
|||||||
organization_id=current_org.organization_id,
|
organization_id=current_org.organization_id,
|
||||||
)
|
)
|
||||||
if SettingsManager.get_settings().ENV != "local":
|
if SettingsManager.get_settings().ENV != "local":
|
||||||
for artifact in artifacts:
|
signed_urls = await asyncio.gather(*[app.ARTIFACT_MANAGER.get_share_link(artifact) for artifact in artifacts])
|
||||||
artifact.signed_url = await app.ARTIFACT_MANAGER.get_share_link(artifact)
|
for i, artifact in enumerate(artifacts):
|
||||||
|
artifact.signed_url = signed_urls[i]
|
||||||
return ORJSONResponse([artifact.model_dump() for artifact in artifacts])
|
return ORJSONResponse([artifact.model_dump() for artifact in artifacts])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user