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
d0d76e2a
Commit
d0d76e2a
authored
May 22, 2024
by
Timothy J. Baek
Browse files
refac
parent
98194d97
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
backend/apps/openai/main.py
backend/apps/openai/main.py
+4
-5
No files found.
backend/apps/openai/main.py
View file @
d0d76e2a
...
@@ -306,7 +306,6 @@ async def get_models(url_idx: Optional[int] = None, user=Depends(get_current_use
...
@@ -306,7 +306,6 @@ async def get_models(url_idx: Optional[int] = None, user=Depends(get_current_use
@
app
.
api_route
(
"/{path:path}"
,
methods
=
[
"GET"
,
"POST"
,
"PUT"
,
"DELETE"
])
@
app
.
api_route
(
"/{path:path}"
,
methods
=
[
"GET"
,
"POST"
,
"PUT"
,
"DELETE"
])
async
def
proxy
(
path
:
str
,
request
:
Request
,
user
=
Depends
(
get_verified_user
)):
async
def
proxy
(
path
:
str
,
request
:
Request
,
user
=
Depends
(
get_verified_user
)):
idx
=
0
idx
=
0
pipeline
=
False
body
=
await
request
.
body
()
body
=
await
request
.
body
()
# TODO: Remove below after gpt-4-vision fix from Open AI
# TODO: Remove below after gpt-4-vision fix from Open AI
...
@@ -319,11 +318,11 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
...
@@ -319,11 +318,11 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
idx
=
model
[
"urlIdx"
]
idx
=
model
[
"urlIdx"
]
if
"pipeline"
in
model
:
if
"pipeline"
in
model
and
model
.
get
(
"pipeline"
):
pipeline
=
model
.
get
(
"pipeline"
)
if
pipeline
:
body
[
"user"
]
=
{
"name"
:
user
.
name
,
"id"
:
user
.
id
}
body
[
"user"
]
=
{
"name"
:
user
.
name
,
"id"
:
user
.
id
}
body
[
"title"
]
=
(
True
if
body
[
"stream"
]
==
False
and
body
[
"max_tokens"
]
==
50
else
False
)
# Check if the model is "gpt-4-vision-preview" and set "max_tokens" to 4000
# Check if the model is "gpt-4-vision-preview" and set "max_tokens" to 4000
# This is a workaround until OpenAI fixes the issue with this model
# This is a workaround until OpenAI fixes the issue with this model
...
...
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