Skip to content

Commit

Permalink
fix: hotfix for server test (#1753)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpacker authored Sep 13, 2024
1 parent 220658f commit bba1a73
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion memgpt/client/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def delete_key(self, api_key: str) -> APIKey:

def create_user(self, name: Optional[str] = None) -> User:
request = UserCreate(name=name)
print("YYYYY Pinging", f"{self.base_url}/{self.api_prefix}/admin/users")
response = requests.post(f"{self.base_url}/{self.api_prefix}/admin/users", headers=self.headers, json=request.model_dump())
if response.status_code != 200:
raise HTTPError(response.json())
Expand Down
10 changes: 6 additions & 4 deletions memgpt/server/rest_api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
# TODO(ethan)
# NOTE(charles): @ethan I had to add this to get the global as the bottom to work
interface: StreamingServerInterface = StreamingServerInterface
server: SyncServer = None
# global server
# server: SyncServer = None
server = SyncServer(default_interface_factory=lambda: interface())

# TODO(ethan): eventuall remove
if password := settings.server_pass:
Expand All @@ -57,8 +59,8 @@

def create_application() -> "FastAPI":
"""the application start routine"""
global server
server = SyncServer(default_interface_factory=lambda: interface())
# global server
# server = SyncServer(default_interface_factory=lambda: interface())

app = FastAPI(
swagger_ui_parameters={"docExpansion": "none"},
Expand Down Expand Up @@ -136,7 +138,7 @@ def on_startup():
def on_shutdown():
global server
server.save_agents()
server = None
# server = None

return app

Expand Down
2 changes: 1 addition & 1 deletion memgpt/server/rest_api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def get_memgpt_server() -> SyncServer:
# Check if a global server is already instantiated
from memgpt.server.rest_api.app import server

assert isinstance(server, SyncServer)
# assert isinstance(server, SyncServer)
return server


Expand Down

0 comments on commit bba1a73

Please sign in to comment.