diff --git a/letta/cli/cli.py b/letta/cli/cli.py index c8c29216..0b1c56cf 100644 --- a/letta/cli/cli.py +++ b/letta/cli/cli.py @@ -302,6 +302,7 @@ def server( port: Annotated[Optional[int], typer.Option(help="Port to run the server on")] = None, host: Annotated[Optional[str], typer.Option(help="Host to run the server on (default to localhost)")] = None, debug: Annotated[bool, typer.Option(help="Turn debugging output on")] = False, + ade: Annotated[bool, typer.Option(help="Allows remote access")] = False, ): """Launch a Letta server process""" diff --git a/letta/server/rest_api/app.py b/letta/server/rest_api/app.py index af3fd2af..1b3fe88a 100644 --- a/letta/server/rest_api/app.py +++ b/letta/server/rest_api/app.py @@ -1,5 +1,6 @@ import json import logging +import sys from pathlib import Path from typing import Optional @@ -71,6 +72,10 @@ def create_application() -> "FastAPI": summary="Create LLM agents with long-term memory and custom tools 📚🦙", version="1.0.0", # TODO wire this up to the version in the package ) + + if "--ade" in sys.argv: + settings.cors_origins.append("https://app.letta.com") + app.add_middleware( CORSMiddleware, allow_origins=settings.cors_origins, diff --git a/letta/settings.py b/letta/settings.py index fb662cf5..cb0a8797 100644 --- a/letta/settings.py +++ b/letta/settings.py @@ -9,13 +9,15 @@ from letta.schemas.embedding_config import EmbeddingConfig from letta.schemas.llm_config import LLMConfig from letta.utils import printd +cors_origins = ["http://letta.localhost", "http://localhost:8283", "http://localhost:8083", "http://localhost:3000"] + class Settings(BaseSettings): model_config = SettingsConfigDict(env_prefix="letta_") letta_dir: Optional[Path] = Field(Path.home() / ".letta", env="LETTA_DIR") debug: Optional[bool] = False - cors_origins: Optional[list] = ["http://letta.localhost", "http://localhost:8283", "http://localhost:8083"] + cors_origins: Optional[list] = cors_origins # database configuration pg_db: Optional[str] = None