MCPcopy Index your code
hub / github.com/dataease/SQLBot / picture

Function picture

backend/apps/system/api/assistant.py:96–110  ·  view source on GitHub ↗
(file_id: str = Path(description="file_id"))

Source from the content-addressed store, hash-verified

94
95@router.get('/picture/{file_id}', summary=f"{PLACEHOLDER_PREFIX}assistant_picture_api", description=f"{PLACEHOLDER_PREFIX}assistant_picture_api")
96async def picture(file_id: str = Path(description="file_id")):
97 file_path = SQLBotFileUtils.get_file_path(file_id=file_id)
98 if not os.path.exists(file_path):
99 raise HTTPException(status_code=404, detail="File not found")
100
101 if file_id.lower().endswith(".svg"):
102 media_type = "image/svg+xml"
103 else:
104 media_type = "image/jpeg"
105
106 def iterfile():
107 with open(file_path, mode="rb") as f:
108 yield from f
109
110 return StreamingResponse(iterfile(), media_type=media_type)
111
112
113@router.patch('/ui', summary=f"{PLACEHOLDER_PREFIX}assistant_ui_api", description=f"{PLACEHOLDER_PREFIX}assistant_ui_api")

Callers

nothing calls this directly

Calls 2

iterfileFunction · 0.85
existsMethod · 0.45

Tested by

no test coverage detected