API: Let the user know if a disconnect occurred
If a user disconnects from a request, log this in the console. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
parent
c77259bfbb
commit
a69ee976f0
1 changed files with 2 additions and 0 deletions
2
main.py
2
main.py
|
|
@ -522,6 +522,7 @@ async def generate_completion(request: Request, data: CompletionRequest):
|
|||
)
|
||||
for generation in new_generation:
|
||||
if await request.is_disconnected():
|
||||
logger.error("Completion generation cancelled by user.")
|
||||
break
|
||||
|
||||
response = create_completion_response(generation, model_path.name)
|
||||
|
|
@ -620,6 +621,7 @@ async def generate_chat_completion(request: Request, data: ChatCompletionRequest
|
|||
)
|
||||
for generation in new_generation:
|
||||
if await request.is_disconnected():
|
||||
logger.error("Chat completion generation cancelled by user.")
|
||||
break
|
||||
|
||||
response = create_chat_completion_stream_chunk(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue