MCPcopy
hub / github.com/AstrBotDevs/AstrBot / get_file

Function get_file

astrbot/dashboard/api/files.py:94–103  ·  view source on GitHub ↗
(
    attachment_id: str,
    _auth: AuthContext = Depends(require_file_scope),
    service: ChatService = Depends(get_chat_service),
)

Source from the content-addressed store, hash-verified

92@router.get("/files/{attachment_id}")
93@router.get("/files/{attachment_id}/content")
94async def get_file(
95 attachment_id: str,
96 _auth: AuthContext = Depends(require_file_scope),
97 service: ChatService = Depends(get_chat_service),
98):
99 result = await _run_file(lambda: service.resolve_attachment_file(attachment_id))
100 if isinstance(result, dict) and result.get("status") == "error":
101 return result
102 file_path, mimetype = result
103 return _file_response(file_path, mimetype)
104
105
106@router.delete("/files/{attachment_id}")

Callers

nothing calls this directly

Calls 4

_run_fileFunction · 0.85
_file_responseFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected