Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jerrrrry
infinilm
Commits
cfc8b598
Commit
cfc8b598
authored
Jun 25, 2025
by
Pan Zezhong
Browse files
handle client abort
parent
dcd6693f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
scripts/launch_server.py
scripts/launch_server.py
+9
-1
No files found.
scripts/launch_server.py
View file @
cfc8b598
...
...
@@ -66,7 +66,9 @@ def chunk_json(id_, content=None, role=None, finish_reason=None):
MAX_BATCH
=
3
print
(
f
"Using MAX_BATCH=
{
MAX_BATCH
}
. Try reduce this value if out of memory error occurs."
)
print
(
f
"Using MAX_BATCH=
{
MAX_BATCH
}
. Try reduce this value if out of memory error occurs."
)
@
contextlib
.
asynccontextmanager
...
...
@@ -180,6 +182,9 @@ async def chat_stream(id_, request_data, request: Request):
except
Exception
as
e
:
print
(
f
"[Error] ID :
{
id_
}
Exception:
{
e
}
"
)
finally
:
if
infer_task
.
finish_reason
is
None
:
infer_task
.
finish_reason
=
"cancel"
async
def
chat
(
id_
,
request_data
,
request
:
Request
):
...
...
@@ -215,6 +220,9 @@ async def chat(id_, request_data, request: Request):
except
Exception
as
e
:
print
(
f
"[Error] ID:
{
id_
}
Exception:
{
e
}
"
)
return
JSONResponse
(
content
=
{
"error"
:
str
(
e
)},
status_code
=
500
)
finally
:
if
infer_task
.
finish_reason
is
None
:
infer_task
.
finish_reason
=
"cancel"
@
App
.
post
(
"/chat/completions"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment