fix: fixed the type hints in server to use uuid, patched tests that used strings as dummy users

This commit is contained in:
cpacker
2024-01-15 14:01:06 -08:00
parent e7e27fed17
commit 41f9640364
4 changed files with 67 additions and 40 deletions

View File

@@ -1,6 +1,9 @@
import uuid
import memgpt.utils as utils
utils.DEBUG = True
from memgpt.config import MemGPTConfig
from memgpt.server.server import SyncServer
from .utils import wipe_config, wipe_memgpt_home
@@ -8,12 +11,13 @@ from .utils import wipe_config, wipe_memgpt_home
def test_server():
wipe_memgpt_home()
user_id = "NULL"
config = MemGPTConfig.load()
user_id = uuid.UUID(config.anon_clientid)
server = SyncServer()
try:
server.user_message(user_id=user_id, agent_id="agent no exist", message="Hello?")
fake_agent_id = uuid.uuid4()
server.user_message(user_id=user_id, agent_id=fake_agent_id, message="Hello?")
raise Exception("user_message call should have failed")
except (KeyError, ValueError) as e:
# Error is expected