diff --git a/r2r/base/api/models/__init__.py b/r2r/base/api/models/__init__.py index 8ed0a0664..9944d0fb7 100644 --- a/r2r/base/api/models/__init__.py +++ b/r2r/base/api/models/__init__.py @@ -8,7 +8,6 @@ from .management.responses import ( AnalyticsResponse, AppSettingsResponse, - DeleteResponse, DocumentChunkResponse, DocumentOverviewResponse, GroupOverviewResponse, @@ -61,7 +60,6 @@ "AppSettingsResponse", "ScoreCompletionResponse", "UserOverviewResponse", - "DeleteResponse", "DocumentOverviewResponse", "DocumentChunkResponse", "KnowledgeGraphResponse", diff --git a/r2r/main/api/client/auth.py b/r2r/main/api/client/auth.py index c697da55f..63c0aa8de 100644 --- a/r2r/main/api/client/auth.py +++ b/r2r/main/api/client/auth.py @@ -11,24 +11,26 @@ async def register(client, email: str, password: str) -> UserResponse: data = {"email": email, "password": password} return await client._make_request("POST", "register", json=data) - async def verify_email(client, verification_code: str) -> dict: + async def verify_email(self, client, verification_code: str) -> dict: return await client._make_request( "POST", "verify_email", json={"verification_code": verification_code}, ) - async def login(client, email: str, password: str) -> dict[str, Token]: + async def login( + self, client, email: str, password: str + ) -> dict[str, Token]: data = {"username": email, "password": password} response = await client._make_request("POST", "login", data=data) client.access_token = response["results"]["access_token"]["token"] client._refresh_token = response["results"]["refresh_token"]["token"] return response["results"] - async def user(client) -> UserResponse: + async def user(self, client) -> UserResponse: return await client._make_request("GET", "user") - async def refresh_access_token(client) -> dict[str, Token]: + async def refresh_access_token(self, client) -> dict[str, Token]: data = {"refresh_token": client._refresh_token} response = await client._make_request( "POST", "refresh_access_token", json=data @@ -38,7 +40,7 @@ async def refresh_access_token(client) -> dict[str, Token]: return response["results"] async def change_password( - client, current_password: str, new_password: str + self, client, current_password: str, new_password: str ) -> dict: data = { "current_password": current_password, @@ -46,27 +48,30 @@ async def change_password( } return await client._make_request("POST", "change_password", json=data) - async def request_password_reset(client, email: str) -> dict: + async def request_password_reset(self, client, email: str) -> dict: return await client._make_request( "POST", "request_password_reset", json={"email": email} ) async def confirm_password_reset( - client, reset_token: str, new_password: str + self, client, reset_token: str, new_password: str ) -> dict: data = {"reset_token": reset_token, "new_password": new_password} return await client._make_request("POST", "reset_password", json=data) - async def logout(client) -> dict: + async def logout(self, client) -> dict: response = await client._make_request("POST", "logout") client.access_token = None client._refresh_token = None return response - async def get_user_profile(client, user_id: uuid.UUID) -> UserResponse: + async def get_user_profile( + self, client, user_id: uuid.UUID + ) -> UserResponse: return await client._make_request("GET", f"user/{user_id}") async def update_user( + self, client, email: Optional[str] = None, name: Optional[str] = None, @@ -83,7 +88,7 @@ async def update_user( return await client._make_request("PUT", "user", json=data) async def delete_user( - client, user_id: uuid.UUID, password: Optional[str] = None + self, client, user_id: uuid.UUID, password: Optional[str] = None ) -> dict: data = {"user_id": str(user_id), "password": password} response = await client._make_request("DELETE", "user", json=data) diff --git a/r2r/main/api/client/ingestion.py b/r2r/main/api/client/ingestion.py index 5e85e8304..9a2514cca 100644 --- a/r2r/main/api/client/ingestion.py +++ b/r2r/main/api/client/ingestion.py @@ -163,36 +163,6 @@ async def update_files( "POST", "update_files", data=data, files=files ) - @staticmethod - async def get_document_info(client, document_id: str) -> dict: - """ - Retrieve information about a specific document. - - Args: - document_id (str): The ID of the document to retrieve information for. - - Returns: - dict: Document information including metadata, status, and version. - """ - return await client._make_request( - "GET", f"document_info/{document_id}" - ) - - @staticmethod - async def delete_document(client, document_id: str) -> dict: - """ - Delete a specific document from the system. - - Args: - document_id (str): The ID of the document to delete. - - Returns: - dict: Confirmation of document deletion. - """ - return await client._make_request( - "DELETE", f"delete_document/{document_id}" - ) - @staticmethod async def list_documents( client, diff --git a/r2r/main/api/client/management.py b/r2r/main/api/client/management.py index b056c6034..dac614bb9 100644 --- a/r2r/main/api/client/management.py +++ b/r2r/main/api/client/management.py @@ -14,8 +14,11 @@ async def update_prompt( client, name: str, template: Optional[str] = None, - input_types: Optional[dict[str, str]] = {}, + input_types: Optional[dict[str, str]] = None, ) -> dict: + if input_types is None: + input_types = {} + data = { "name": name, "template": template,