feat: add convenience link to open ADE from server launch (#1986)

This commit is contained in:
Charles Packer 2024-11-06 10:21:43 -08:00 committed by GitHub
parent 9cf16b2cfd
commit 75b866fa86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,6 +8,7 @@ import uvicorn
from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware
from letta.__init__ import __version__
from letta.constants import ADMIN_PREFIX, API_PREFIX, OPENAI_API_PREFIX
from letta.schemas.letta_response import LettaResponse
from letta.server.constants import REST_DEFAULT_PORT
@ -66,6 +67,7 @@ def create_application() -> "FastAPI":
"""the application start routine"""
# global server
# server = SyncServer(default_interface_factory=lambda: interface())
print(f"\n[[ Letta server // v{__version__} ]]")
app = FastAPI(
swagger_ui_parameters={"docExpansion": "none"},
@ -78,6 +80,7 @@ def create_application() -> "FastAPI":
if "--ade" in sys.argv:
settings.cors_origins.append("https://app.letta.com")
print(f"▶ View using ADE at: https://app.letta.com/local-project/agents")
app.add_middleware(
CORSMiddleware,
@ -179,7 +182,7 @@ def start_server(
# Add the handler to the logger
server_logger.addHandler(stream_handler)
print(f"Running: uvicorn server:app --host {host or 'localhost'} --port {port or REST_DEFAULT_PORT}")
print(f"▶ Server running at: http://{host or 'localhost'}:{port or REST_DEFAULT_PORT}\n")
uvicorn.run(
app,
host=host or "localhost",