mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-22 05:41:39 +03:00
1ffeb8f25d
# 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):
31 lines
856 B
Python
31 lines
856 B
Python
from models.settings import get_supabase_client
|
|
from modules.assistant.entity.assistant import AssistantEntity
|
|
from modules.assistant.repository.assistant_interface import AssistantInterface
|
|
|
|
|
|
class Assistant(AssistantInterface):
|
|
def __init__(self):
|
|
supabase_client = get_supabase_client()
|
|
self.db = supabase_client
|
|
|
|
def get_all_assistants(self):
|
|
response = self.db.from_("assistants").select("*").execute()
|
|
|
|
if response.data:
|
|
return response.data
|
|
|
|
return []
|
|
|
|
def get_assistant_by_id(self, ingestion_id) -> AssistantEntity:
|
|
response = (
|
|
self.db.from_("assistants")
|
|
.select("*")
|
|
.filter("id", "eq", ingestion_id)
|
|
.execute()
|
|
)
|
|
|
|
if response.data:
|
|
return AssistantEntity(**response.data[0])
|
|
|
|
return None
|