diff --git a/memgpt/server/rest_api/auth/index.py b/memgpt/server/rest_api/auth/index.py index 30d748114b..bc014735ff 100644 --- a/memgpt/server/rest_api/auth/index.py +++ b/memgpt/server/rest_api/auth/index.py @@ -1,5 +1,4 @@ from typing import Optional -from uuid import UUID from fastapi import APIRouter from pydantic import BaseModel, Field @@ -12,8 +11,9 @@ router = APIRouter() +# TODO: remove these and add them to schemas? class AuthResponse(BaseModel): - uuid: UUID = Field(..., description="UUID of the user") + user_id: str = Field(..., description="ID of the user") is_admin: Optional[bool] = Field(None, description="Whether the user is an admin") @@ -28,16 +28,17 @@ def authenticate_user(request: AuthRequest) -> AuthResponse: """ Authenticates the user and sends response with User related data. - Currently, this is a placeholder that simply returns a UUID placeholder """ interface.clear() is_admin = False if request.password != password: - response = server.api_key_to_user(api_key=request.password) + user_id = server.api_key_to_user(api_key=request.password) + return user_id else: is_admin = True - response = server.authenticate_user() - return AuthResponse(uuid=response, is_admin=is_admin) + user_id = server.authenticate_user() + return None + return AuthResponse(user_id=user_id, is_admin=is_admin) return router diff --git a/memgpt/server/server.py b/memgpt/server/server.py index 3e15d7477f..1491ba279c 100644 --- a/memgpt/server/server.py +++ b/memgpt/server/server.py @@ -1409,7 +1409,8 @@ def delete_agent(self, user_id: str, agent_id: str): def authenticate_user(self) -> str: # TODO: Implement actual authentication to enable multi user setup - return str(MemGPTConfig.load().anon_clientid) + # NOTE: THIS IS NASTY, GET RID OF IT SOON + return "user-" + str(MemGPTConfig.load().anon_clientid) def api_key_to_user(self, api_key: str) -> str: """Decode an API key to a user"""