From 0318702cdc860999ee70f277425edbbfe0e60419 Mon Sep 17 00:00:00 2001 From: Andrei Betlen Date: Sun, 5 May 2024 12:49:31 -0400 Subject: [PATCH] feat(server): Add support for setting root_path. Closes #1420 --- llama_cpp/server/app.py | 1 + llama_cpp/server/settings.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/llama_cpp/server/app.py b/llama_cpp/server/app.py index b6ed9b1..4cf10d1 100644 --- a/llama_cpp/server/app.py +++ b/llama_cpp/server/app.py @@ -132,6 +132,7 @@ def create_app( middleware=middleware, title="🦙 llama.cpp Python API", version=llama_cpp.__version__, + root_path=server_settings.root_path, ) app.add_middleware( CORSMiddleware, diff --git a/llama_cpp/server/settings.py b/llama_cpp/server/settings.py index ed05a88..a3e1850 100644 --- a/llama_cpp/server/settings.py +++ b/llama_cpp/server/settings.py @@ -215,6 +215,10 @@ class ServerSettings(BaseSettings): default=False, description="Disable EventSource pings (may be needed for some clients).", ) + root_path: str = Field( + default="", + description="The root path for the server. Useful when running behind a reverse proxy.", + ) class Settings(ServerSettings, ModelSettings):