Skip to content

Commit

Permalink
fix: return uuid stored in config (#1092)
Browse files Browse the repository at this point in the history
Co-authored-by: cpacker <[email protected]>
  • Loading branch information
goetzrobin and cpacker authored Mar 5, 2024
1 parent e00a988 commit ccecea3
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions memgpt/server/server.py
Original file line number Diff line number Diff line change
@@ -1,49 +1,41 @@
from abc import abstractmethod
from typing import Union, Callable, Optional, List
from datetime import datetime
import uuid
import json
import logging
from threading import Lock
import uuid
from abc import abstractmethod
from functools import wraps
from threading import Lock
from typing import Union, Callable, Optional, List

from fastapi import HTTPException

from memgpt.config import MemGPTConfig
from memgpt.credentials import MemGPTCredentials
from memgpt.constants import JSON_LOADS_STRICT, JSON_ENSURE_ASCII
from memgpt.agent import Agent, save_agent
import memgpt.system as system
import memgpt.constants as constants
import memgpt.presets.presets as presets
import memgpt.server.utils as server_utils
import memgpt.system as system
from memgpt.agent import Agent, save_agent
from memgpt.agent_store.storage import StorageConnector, TableType

# from memgpt.llm_api_tools import openai_get_model_list, azure_openai_get_model_list, smart_urljoin
from memgpt.cli.cli_config import get_model_options
from memgpt.config import MemGPTConfig
from memgpt.constants import JSON_LOADS_STRICT, JSON_ENSURE_ASCII
from memgpt.credentials import MemGPTCredentials
from memgpt.data_sources.connectors import DataConnector, load_data
from memgpt.agent_store.storage import StorageConnector, TableType
from memgpt.metadata import MetadataStore
import memgpt.presets.presets as presets
import memgpt.utils as utils
import memgpt.server.utils as server_utils
from memgpt.data_types import (
User,
Source,
Passage,
AgentState,
LLMConfig,
EmbeddingConfig,
Message,
ToolCall,
LLMConfig,
EmbeddingConfig,
Message,
ToolCall,
Token,
Preset,
)

from memgpt.interface import AgentInterface # abstract

# TODO use custom interface
from memgpt.interface import CLIInterface # for printing to terminal
from memgpt.interface import AgentInterface # abstract
from memgpt.metadata import MetadataStore

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -1014,7 +1006,7 @@ def delete_agent(self, user_id: uuid.UUID, agent_id: uuid.UUID):

def authenticate_user(self) -> uuid.UUID:
# TODO: Implement actual authentication to enable multi user setup
return uuid.UUID(int=uuid.getnode())
return uuid.UUID(MemGPTConfig.load().anon_clientid)

def api_key_to_user(self, api_key: str) -> uuid.UUID:
"""Decode an API key to a user"""
Expand Down

0 comments on commit ccecea3

Please sign in to comment.