38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
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"
|
|
} |