get observer cruise API (#1447)

This commit is contained in:
Shuchang Zheng
2024-12-30 12:20:47 -08:00
committed by GitHub
parent b2fdb187fa
commit d5dacd9918
2 changed files with 16 additions and 0 deletions

View File

@@ -1097,3 +1097,15 @@ async def observer_cruise(
max_iterations_override=x_max_iterations_override,
)
return observer_cruise
@base_router.get("/cruise/{observer_cruise_id}")
@base_router.get("/cruise/{observer_cruise_id}/", include_in_schema=False)
async def get_observer_cruise(
observer_cruise_id: str,
organization: Organization = Depends(org_auth_service.get_current_org),
) -> ObserverCruise:
observer_cruise = await observer_service.get_observer_cruise(observer_cruise_id, organization.organization_id)
if not observer_cruise:
raise HTTPException(status_code=404, detail=f"Observer cruise {observer_cruise_id} not found")
return observer_cruise

View File

@@ -919,3 +919,7 @@ async def _record_thought_screenshot(observer_thought: ObserverThought, workflow
artifact_type=ArtifactType.SCREENSHOT_LLM,
data=screenshot,
)
async def get_observer_cruise(observer_cruise_id: str, organization_id: str | None = None) -> ObserverCruise | None:
return await app.DATABASE.get_observer_cruise(observer_cruise_id, organization_id=organization_id)