From 8e44a32075de4aba2fc9877d4a2a34a0e7314c0d Mon Sep 17 00:00:00 2001 From: Radoslav Gerganov Date: Tue, 12 Dec 2023 03:47:11 +0200 Subject: [PATCH] Add support for running the server with SSL (#994) --- llama_cpp/server/__main__.py | 3 ++- llama_cpp/server/app.py | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/llama_cpp/server/__main__.py b/llama_cpp/server/__main__.py index a294ebf..45fc5a8 100644 --- a/llama_cpp/server/__main__.py +++ b/llama_cpp/server/__main__.py @@ -96,5 +96,6 @@ if __name__ == "__main__": app = create_app(settings=settings) uvicorn.run( - app, host=os.getenv("HOST", settings.host), port=int(os.getenv("PORT", settings.port)) + app, host=os.getenv("HOST", settings.host), port=int(os.getenv("PORT", settings.port)), + ssl_keyfile=settings.ssl_keyfile, ssl_certfile=settings.ssl_certfile ) diff --git a/llama_cpp/server/app.py b/llama_cpp/server/app.py index a2dad56..7138cf4 100644 --- a/llama_cpp/server/app.py +++ b/llama_cpp/server/app.py @@ -150,6 +150,13 @@ class Settings(BaseSettings): # Server Params host: str = Field(default="localhost", description="Listen address") port: int = Field(default=8000, description="Listen port") + # SSL Params + ssl_keyfile: Optional[str] = Field( + default=None, description="SSL key file for HTTPS" + ) + ssl_certfile: Optional[str] = Field( + default=None, description="SSL certificate file for HTTPS" + ) interrupt_requests: bool = Field( default=True, description="Whether to interrupt requests when a new request is received.",