feat(server): Add support for setting root_path. Closes #1420

This commit is contained in:
Andrei Betlen 2024-05-05 12:49:31 -04:00
parent 3666833107
commit 0318702cdc
2 changed files with 5 additions and 0 deletions

View file

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

View file

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