mirror of
https://github.com/cpacker/MemGPT.git
synced 2025-06-03 04:30:22 +00:00
feat: add convenience link to open ADE from server launch (#1986)
This commit is contained in:
parent
9cf16b2cfd
commit
75b866fa86
@ -8,6 +8,7 @@ import uvicorn
|
|||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
from starlette.middleware.cors import CORSMiddleware
|
from starlette.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
|
from letta.__init__ import __version__
|
||||||
from letta.constants import ADMIN_PREFIX, API_PREFIX, OPENAI_API_PREFIX
|
from letta.constants import ADMIN_PREFIX, API_PREFIX, OPENAI_API_PREFIX
|
||||||
from letta.schemas.letta_response import LettaResponse
|
from letta.schemas.letta_response import LettaResponse
|
||||||
from letta.server.constants import REST_DEFAULT_PORT
|
from letta.server.constants import REST_DEFAULT_PORT
|
||||||
@ -66,6 +67,7 @@ def create_application() -> "FastAPI":
|
|||||||
"""the application start routine"""
|
"""the application start routine"""
|
||||||
# global server
|
# global server
|
||||||
# server = SyncServer(default_interface_factory=lambda: interface())
|
# server = SyncServer(default_interface_factory=lambda: interface())
|
||||||
|
print(f"\n[[ Letta server // v{__version__} ]]")
|
||||||
|
|
||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
swagger_ui_parameters={"docExpansion": "none"},
|
swagger_ui_parameters={"docExpansion": "none"},
|
||||||
@ -78,6 +80,7 @@ def create_application() -> "FastAPI":
|
|||||||
|
|
||||||
if "--ade" in sys.argv:
|
if "--ade" in sys.argv:
|
||||||
settings.cors_origins.append("https://app.letta.com")
|
settings.cors_origins.append("https://app.letta.com")
|
||||||
|
print(f"▶ View using ADE at: https://app.letta.com/local-project/agents")
|
||||||
|
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
CORSMiddleware,
|
CORSMiddleware,
|
||||||
@ -179,7 +182,7 @@ def start_server(
|
|||||||
# Add the handler to the logger
|
# Add the handler to the logger
|
||||||
server_logger.addHandler(stream_handler)
|
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(
|
uvicorn.run(
|
||||||
app,
|
app,
|
||||||
host=host or "localhost",
|
host=host or "localhost",
|
||||||
|
Loading…
Reference in New Issue
Block a user