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
74ed74f1
Unverified
Commit
74ed74f1
authored
Jun 03, 2024
by
mindspawn
Committed by
GitHub
Jun 03, 2024
Browse files
Enable http_proxy use for ollama calls.
parent
94ebf027
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
backend/apps/ollama/main.py
backend/apps/ollama/main.py
+3
-3
No files found.
backend/apps/ollama/main.py
View file @
74ed74f1
...
@@ -134,7 +134,7 @@ async def update_ollama_api_url(form_data: UrlUpdateForm, user=Depends(get_admin
...
@@ -134,7 +134,7 @@ async def update_ollama_api_url(form_data: UrlUpdateForm, user=Depends(get_admin
async
def
fetch_url
(
url
):
async
def
fetch_url
(
url
):
timeout
=
aiohttp
.
ClientTimeout
(
total
=
5
)
timeout
=
aiohttp
.
ClientTimeout
(
total
=
5
)
try
:
try
:
async
with
aiohttp
.
ClientSession
(
timeout
=
timeout
)
as
session
:
async
with
aiohttp
.
ClientSession
(
timeout
=
timeout
,
trust_env
=
True
)
as
session
:
async
with
session
.
get
(
url
)
as
response
:
async
with
session
.
get
(
url
)
as
response
:
return
await
response
.
json
()
return
await
response
.
json
()
except
Exception
as
e
:
except
Exception
as
e
:
...
@@ -156,7 +156,7 @@ async def cleanup_response(
...
@@ -156,7 +156,7 @@ async def cleanup_response(
async
def
post_streaming_url
(
url
:
str
,
payload
:
str
):
async
def
post_streaming_url
(
url
:
str
,
payload
:
str
):
r
=
None
r
=
None
try
:
try
:
session
=
aiohttp
.
ClientSession
()
session
=
aiohttp
.
ClientSession
(
trust_env
=
True
)
r
=
await
session
.
post
(
url
,
data
=
payload
)
r
=
await
session
.
post
(
url
,
data
=
payload
)
r
.
raise_for_status
()
r
.
raise_for_status
()
...
@@ -1045,7 +1045,7 @@ async def download_file_stream(
...
@@ -1045,7 +1045,7 @@ async def download_file_stream(
timeout
=
aiohttp
.
ClientTimeout
(
total
=
600
)
# Set the timeout
timeout
=
aiohttp
.
ClientTimeout
(
total
=
600
)
# Set the timeout
async
with
aiohttp
.
ClientSession
(
timeout
=
timeout
)
as
session
:
async
with
aiohttp
.
ClientSession
(
timeout
=
timeout
,
trust_env
=
True
)
as
session
:
async
with
session
.
get
(
file_url
,
headers
=
headers
)
as
response
:
async
with
session
.
get
(
file_url
,
headers
=
headers
)
as
response
:
total_size
=
int
(
response
.
headers
.
get
(
"content-length"
,
0
))
+
current_size
total_size
=
int
(
response
.
headers
.
get
(
"content-length"
,
0
))
+
current_size
...
...
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