Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

chore: allow app.letta.com access to local if user grants permission (#1830)

Shubham Naik8fc504cb9ff0
diff --git a/letta/cli/cli.py b/letta/cli/cli.py
index c8c292162..0b1c56cfb 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 af3fd2af3..1b3fe88a5 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 fb662cf5b..cb0a87978 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