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
519e2797
"...resnet50_tensorflow.git" did not exist on "ded32f0500604928e52e27fd3f678e694e5133b7"
Commit
519e2797
authored
Feb 05, 2024
by
Timothy J. Baek
Browse files
refac
parent
1b040143
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
13 deletions
+0
-13
backend/apps/openai/main.py
backend/apps/openai/main.py
+0
-13
No files found.
backend/apps/openai/main.py
View file @
519e2797
...
@@ -81,9 +81,6 @@ async def speech(request: Request, user=Depends(get_current_user)):
...
@@ -81,9 +81,6 @@ async def speech(request: Request, user=Depends(get_current_user)):
body
=
await
request
.
body
()
body
=
await
request
.
body
()
print
(
body
)
print
(
type
(
body
))
name
=
hashlib
.
sha256
(
body
).
hexdigest
()
name
=
hashlib
.
sha256
(
body
).
hexdigest
()
SPEECH_CACHE_DIR
=
Path
(
CACHE_DIR
).
joinpath
(
"./audio/speech/"
)
SPEECH_CACHE_DIR
=
Path
(
CACHE_DIR
).
joinpath
(
"./audio/speech/"
)
...
@@ -91,8 +88,6 @@ async def speech(request: Request, user=Depends(get_current_user)):
...
@@ -91,8 +88,6 @@ async def speech(request: Request, user=Depends(get_current_user)):
file_path
=
SPEECH_CACHE_DIR
.
joinpath
(
f
"
{
name
}
.mp3"
)
file_path
=
SPEECH_CACHE_DIR
.
joinpath
(
f
"
{
name
}
.mp3"
)
file_body_path
=
SPEECH_CACHE_DIR
.
joinpath
(
f
"
{
name
}
.json"
)
file_body_path
=
SPEECH_CACHE_DIR
.
joinpath
(
f
"
{
name
}
.json"
)
print
(
file_path
)
# Check if the file already exists in the cache
# Check if the file already exists in the cache
if
file_path
.
is_file
():
if
file_path
.
is_file
():
return
FileResponse
(
file_path
)
return
FileResponse
(
file_path
)
...
@@ -110,8 +105,6 @@ async def speech(request: Request, user=Depends(get_current_user)):
...
@@ -110,8 +105,6 @@ async def speech(request: Request, user=Depends(get_current_user)):
stream
=
True
,
stream
=
True
,
)
)
print
(
r
)
r
.
raise_for_status
()
r
.
raise_for_status
()
# Save the streaming content to a file
# Save the streaming content to a file
...
@@ -125,12 +118,6 @@ async def speech(request: Request, user=Depends(get_current_user)):
...
@@ -125,12 +118,6 @@ async def speech(request: Request, user=Depends(get_current_user)):
# Return the saved file
# Return the saved file
return
FileResponse
(
file_path
)
return
FileResponse
(
file_path
)
# return StreamingResponse(
# r.iter_content(chunk_size=8192),
# status_code=r.status_code,
# headers=dict(r.headers),
# )
except
Exception
as
e
:
except
Exception
as
e
:
print
(
e
)
print
(
e
)
error_detail
=
"Ollama WebUI: Server Connection Error"
error_detail
=
"Ollama WebUI: Server Connection Error"
...
...
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