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
chenpangpang
open-webui
Commits
ed964260
Commit
ed964260
authored
Mar 16, 2024
by
Timothy J. Baek
Browse files
fix: openai urls issue
parent
a636e784
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
backend/apps/openai/main.py
backend/apps/openai/main.py
+6
-0
No files found.
backend/apps/openai/main.py
View file @
ed964260
...
@@ -111,6 +111,7 @@ async def speech(request: Request, user=Depends(get_verified_user)):
...
@@ -111,6 +111,7 @@ async def speech(request: Request, user=Depends(get_verified_user)):
headers
[
"Authorization"
]
=
f
"Bearer
{
app
.
state
.
OPENAI_API_KEYS
[
idx
]
}
"
headers
[
"Authorization"
]
=
f
"Bearer
{
app
.
state
.
OPENAI_API_KEYS
[
idx
]
}
"
headers
[
"Content-Type"
]
=
"application/json"
headers
[
"Content-Type"
]
=
"application/json"
r
=
None
try
:
try
:
r
=
requests
.
post
(
r
=
requests
.
post
(
url
=
f
"
{
app
.
state
.
OPENAI_API_BASE_URLS
[
idx
]
}
/audio/speech"
,
url
=
f
"
{
app
.
state
.
OPENAI_API_BASE_URLS
[
idx
]
}
/audio/speech"
,
...
@@ -218,6 +219,9 @@ async def get_models(url_idx: Optional[int] = None, user=Depends(get_current_use
...
@@ -218,6 +219,9 @@ async def get_models(url_idx: Optional[int] = None, user=Depends(get_current_use
return
models
return
models
else
:
else
:
url
=
app
.
state
.
OPENAI_API_BASE_URLS
[
url_idx
]
url
=
app
.
state
.
OPENAI_API_BASE_URLS
[
url_idx
]
r
=
None
try
:
try
:
r
=
requests
.
request
(
method
=
"GET"
,
url
=
f
"
{
url
}
/models"
)
r
=
requests
.
request
(
method
=
"GET"
,
url
=
f
"
{
url
}
/models"
)
r
.
raise_for_status
()
r
.
raise_for_status
()
...
@@ -290,6 +294,8 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
...
@@ -290,6 +294,8 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
headers
[
"Authorization"
]
=
f
"Bearer
{
key
}
"
headers
[
"Authorization"
]
=
f
"Bearer
{
key
}
"
headers
[
"Content-Type"
]
=
"application/json"
headers
[
"Content-Type"
]
=
"application/json"
r
=
None
try
:
try
:
r
=
requests
.
request
(
r
=
requests
.
request
(
method
=
request
.
method
,
method
=
request
.
method
,
...
...
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