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
change
sglang
Commits
dff2860a
Unverified
Commit
dff2860a
authored
Sep 11, 2024
by
josephrocca
Committed by
GitHub
Sep 11, 2024
Browse files
Fix CORS compatibility with OpenAI, vLLM, TGI, LMDeploy (#1373)
Co-authored-by:
Yineng Zhang
<
me@zhyncs.com
>
parent
e72275cf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
python/sglang/srt/server.py
python/sglang/srt/server.py
+9
-0
No files found.
python/sglang/srt/server.py
View file @
dff2860a
...
@@ -37,6 +37,7 @@ import requests
...
@@ -37,6 +37,7 @@ import requests
import
uvicorn
import
uvicorn
import
uvloop
import
uvloop
from
fastapi
import
FastAPI
,
File
,
Form
,
Request
,
UploadFile
from
fastapi
import
FastAPI
,
File
,
Form
,
Request
,
UploadFile
from
fastapi.middleware.cors
import
CORSMiddleware
from
fastapi.responses
import
JSONResponse
,
Response
,
StreamingResponse
from
fastapi.responses
import
JSONResponse
,
Response
,
StreamingResponse
from
sglang.lang.backend.runtime_endpoint
import
RuntimeEndpoint
from
sglang.lang.backend.runtime_endpoint
import
RuntimeEndpoint
...
@@ -93,6 +94,14 @@ asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
...
@@ -93,6 +94,14 @@ asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
app
=
FastAPI
()
app
=
FastAPI
()
tokenizer_manager
=
None
tokenizer_manager
=
None
app
.
add_middleware
(
CORSMiddleware
,
allow_origins
=
[
"*"
],
allow_credentials
=
True
,
allow_methods
=
[
"*"
],
allow_headers
=
[
"*"
],
)
@
app
.
get
(
"/health"
)
@
app
.
get
(
"/health"
)
async
def
health
()
->
Response
:
async
def
health
()
->
Response
:
...
...
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