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
a37b9c12
Commit
a37b9c12
authored
Jan 05, 2024
by
Timothy J. Baek
Browse files
refac
parent
47dc3b5f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
backend/apps/ollama/main.py
backend/apps/ollama/main.py
+4
-6
No files found.
backend/apps/ollama/main.py
View file @
a37b9c12
...
...
@@ -98,16 +98,17 @@ async def proxy(path: str, request: Request, user=Depends(get_current_user)):
print
(
data
)
response
.
raise_for_status
()
async
def
gen
():
async
def
gen
erate
():
async
for
line
in
response
.
content
:
yield
line
await
session
.
close
()
return
StreamingResponse
(
gen
(),
response
.
status
)
return
StreamingResponse
(
gen
erate
(),
response
.
status
)
except
Exception
as
e
:
print
(
e
)
error_detail
=
"Ollama WebUI: Server Connection Error"
if
response
is
not
None
:
try
:
res
=
await
response
.
json
()
...
...
@@ -117,11 +118,8 @@ async def proxy(path: str, request: Request, user=Depends(get_current_user)):
error_detail
=
f
"Ollama:
{
e
}
"
await
session
.
close
()
raise
HTTPException
(
status_code
=
response
.
status
if
response
else
500
,
detail
=
error_detail
,
)
# print(e)
# error_detail = "Ollama WebUI: Server Connection Error"
# return {"error": error_detail, "message": str(e)}
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