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

Co-authored-by: Shubham Naik <shub@memgpt.ai>
This commit is contained in:
Shubham Naik
2024-10-04 16:45:04 -07:00
committed by GitHub
parent c04e5dbd9a
commit 8fc504cb9f
3 changed files with 9 additions and 1 deletions

View File

@@ -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"""

View File

@@ -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,

View File

@@ -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