Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -236,7 +236,18 @@ async def startup_event():
|
|
236 |
|
237 |
|
238 |
# --- Your Endpoints ---
|
239 |
-
@app.get("/files/{task_id}",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
async def get_task_file(task_id: str):
|
241 |
# ... (endpoint logic) ...
|
242 |
try:
|
|
|
236 |
|
237 |
|
238 |
# --- Your Endpoints ---
|
239 |
+
@app.get("/files/{task_id}",
|
240 |
+
summary="Get Associated File by Task ID",
|
241 |
+
description="Downloads the file associated with the given task_id, if one exists and is mapped.",
|
242 |
+
responses={
|
243 |
+
200: {
|
244 |
+
"description": "File content.",
|
245 |
+
"content": {"*/*": {}} # Indicates response can be any file type
|
246 |
+
},
|
247 |
+
403: {"model": ErrorResponse, "description": "Access denied (e.g., path traversal attempt)."},
|
248 |
+
404: {"model": ErrorResponse, "description": "Task ID not found, no file associated, or file missing on server."},
|
249 |
+
500: {"model": ErrorResponse, "description": "Server error reading file."}
|
250 |
+
})
|
251 |
async def get_task_file(task_id: str):
|
252 |
# ... (endpoint logic) ...
|
253 |
try:
|