quivr/backend/repository/files/generate_file_signed_url.py
Zineb El Bachiri d2b4ef4aff
feat: knowledge tab list (#1222)
*  get all knowledge utils

*  add remove knowledge and update router

*  new knowledge provider

* 🚨 remove eslint -disable

*  new useKnowledgeApi

*  set up KnowledgeItem

*  add KnowledgeTable component in knowledge tab

* 🔥 remove DocumentData replaced by KnowledgeItem

* 🐛 fix weird characters instead of '/'

* 💄 truncate knowledge name

*  add DownloadUploadedKnowledge component

* ⚰️ unused code

* 🏷️ introduce UploadedKnowledge and CrawledKnowledge types

* 💄 remove thread

* 💄 bin for delete knowledge

* 🌐 update wording for knowledge tab

* 🔇 remove logs and comments
2023-09-22 16:06:04 +02:00

27 lines
676 B
Python

from multiprocessing import get_logger
from models import get_supabase_client
from supabase.client import Client
logger = get_logger()
SIGNED_URL_EXPIRATION_PERIOD_IN_SECONDS = 600
def generate_file_signed_url(path):
supabase_client: Client = get_supabase_client()
try:
response = supabase_client.storage.from_("quivr").create_signed_url(
path,
SIGNED_URL_EXPIRATION_PERIOD_IN_SECONDS,
options={
"download": True,
"transform": None,
},
)
logger.info("RESPONSE SIGNED URL", response)
return response
except Exception as e:
logger.error(e)