quivr/backend/modules/knowledge/repository/storage.py
Antoine Dewez 8d3bc79a7e
feat(analytics): added analytics page (#2416)
# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
2024-04-10 02:20:21 -07:00

28 lines
780 B
Python

from logger import get_logger
from models.settings import get_supabase_client
from modules.knowledge.repository.storage_interface import StorageInterface
logger = get_logger(__name__)
class Storage(StorageInterface):
def __init__(self):
supabase_client = get_supabase_client()
self.db = supabase_client
def upload_file(self, file_name: str):
"""
Upload file to storage
"""
self.db.storage.from_("quivr").download(file_name)
def remove_file(self, file_name: str):
"""
Remove file from storage
"""
try:
response = self.db.storage.from_("quivr").remove([file_name])
return response
except Exception as e:
logger.error(e)
# raise e