first commit
This commit is contained in:
36
src/services/download_service.py
Normal file
36
src/services/download_service.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from fastapi.responses import FileResponse
|
||||
|
||||
from config.setting import DEFAULT_PROMPT_PATH, STRUCTURED_PROMPT_PATH, STRUCTURED_SCHEMA_PATH
|
||||
|
||||
|
||||
class DownloadService:
|
||||
@staticmethod
|
||||
def download_default_prompt():
|
||||
return FileResponse(
|
||||
DEFAULT_PROMPT_PATH,
|
||||
media_type="text/plain",
|
||||
filename="default_prompt.txt",
|
||||
headers=DownloadService._no_cache_headers(),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def download_structured_prompt():
|
||||
return FileResponse(
|
||||
STRUCTURED_PROMPT_PATH,
|
||||
media_type="text/plain",
|
||||
filename="structured_prompt.txt",
|
||||
headers=DownloadService._no_cache_headers(),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def download_structured_schema():
|
||||
return FileResponse(
|
||||
STRUCTURED_SCHEMA_PATH,
|
||||
media_type="application/json",
|
||||
filename="structured_schema.json",
|
||||
headers=DownloadService._no_cache_headers(),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _no_cache_headers():
|
||||
return {"Cache-Control": "no-store, no-cache, must-revalidate, max-age=0", "Pragma": "no-cache", "Expires": "0"}
|
||||
Reference in New Issue
Block a user