Skip to content

Commit

Permalink
feat: add convenience link to open ADE from server launch (#1986)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpacker authored Nov 6, 2024
1 parent 9cf16b2 commit 75b866f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion letta/server/rest_api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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
Expand Down Expand Up @@ -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"},
Expand All @@ -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,
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 75b866f

Please sign in to comment.