added memgpt server command (#611)

* added memgpt server command

* added the option to specify a port (rest default 8283, ws default 8282)

* fixed import in test

* added agent saving on shutdown

* added basic locking mechanism (assumes only one server.py is running at the same time)

* remove 'STOP' from buffer when converting to list for the non-streaming POST resposne

* removed duplicate on_event (redundant to lifespan)

* added GET agents/memory route

* added GET agent config

* added GET server config

* added PUT route for modifying agent core memory

* refactored to put server loop in separate function called via main
This commit is contained in:
Charles Packer
2023-12-13 00:41:40 -08:00
committed by GitHub
parent b3f1f50a6c
commit 2048ba179b
10 changed files with 372 additions and 23 deletions

View File

@@ -4,7 +4,7 @@ import json
import websockets
import pytest
from memgpt.server.constants import DEFAULT_PORT
from memgpt.server.constants import WS_DEFAULT_PORT
from memgpt.server.ws_api.server import WebSocketServer
from memgpt.config import AgentConfig
@@ -30,7 +30,7 @@ async def test_websocket_server():
# )
test_config = {}
uri = f"ws://{host}:{DEFAULT_PORT}"
uri = f"ws://{host}:{WS_DEFAULT_PORT}"
try:
async with websockets.connect(uri) as websocket:
# Initialize the server with a test config