mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-04-30 11:11:35 +00:00
API: Remove uvicorn signal handler injection
This causes spamming of warn statements on SIGINT. The message also gets printed on a normal shutdown (that isn't in the middle of a request). Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import pathlib
|
import pathlib
|
||||||
import signal
|
|
||||||
import uvicorn
|
import uvicorn
|
||||||
from contextlib import asynccontextmanager
|
|
||||||
from fastapi import FastAPI, Depends, HTTPException, Header, Request
|
from fastapi import FastAPI, Depends, HTTPException, Header, Request
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
from functools import partial
|
from functools import partial
|
||||||
@@ -19,7 +17,6 @@ from common.concurrency import (
|
|||||||
)
|
)
|
||||||
from common.logger import UVICORN_LOG_CONFIG
|
from common.logger import UVICORN_LOG_CONFIG
|
||||||
from common.networking import handle_request_error, run_with_request_disconnect
|
from common.networking import handle_request_error, run_with_request_disconnect
|
||||||
from common.signals import uvicorn_signal_handler
|
|
||||||
from common.templating import (
|
from common.templating import (
|
||||||
get_all_templates,
|
get_all_templates,
|
||||||
get_template_from_file,
|
get_template_from_file,
|
||||||
@@ -59,14 +56,6 @@ from endpoints.OAI.utils.completion import (
|
|||||||
from endpoints.OAI.utils.model import get_model_list, stream_model_load
|
from endpoints.OAI.utils.model import get_model_list, stream_model_load
|
||||||
from endpoints.OAI.utils.lora import get_lora_list
|
from endpoints.OAI.utils.lora import get_lora_list
|
||||||
|
|
||||||
|
|
||||||
@asynccontextmanager
|
|
||||||
async def lifespan(_: FastAPI):
|
|
||||||
uvicorn_signal_handler(signal.SIGINT)
|
|
||||||
uvicorn_signal_handler(signal.SIGTERM)
|
|
||||||
yield
|
|
||||||
|
|
||||||
|
|
||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
title="TabbyAPI",
|
title="TabbyAPI",
|
||||||
summary="An OAI compatible exllamav2 API that's both lightweight and fast",
|
summary="An OAI compatible exllamav2 API that's both lightweight and fast",
|
||||||
@@ -74,7 +63,6 @@ app = FastAPI(
|
|||||||
"This docs page is not meant to send requests! Please use a service "
|
"This docs page is not meant to send requests! Please use a service "
|
||||||
"like Postman or a frontend UI."
|
"like Postman or a frontend UI."
|
||||||
),
|
),
|
||||||
lifespan=lifespan,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# ALlow CORS requests
|
# ALlow CORS requests
|
||||||
|
|||||||
Reference in New Issue
Block a user