Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
00f4e6ec
Unverified
Commit
00f4e6ec
authored
Jan 23, 2024
by
takatost
Committed by
GitHub
Jan 23, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add ffmpeg faq link in missing ffmpeg error (#2146)
parent
6355e61e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
tts.py
api/core/model_runtime/model_providers/openai/tts/tts.py
+13
-5
No files found.
api/core/model_runtime/model_providers/openai/tts/tts.py
View file @
00f4e6ec
...
@@ -22,7 +22,9 @@ class OpenAIText2SpeechModel(_CommonOpenAI, TTSModel):
...
@@ -22,7 +22,9 @@ class OpenAIText2SpeechModel(_CommonOpenAI, TTSModel):
"""
"""
Model class for OpenAI Speech to text model.
Model class for OpenAI Speech to text model.
"""
"""
def
_invoke
(
self
,
model
:
str
,
credentials
:
dict
,
content_text
:
str
,
streaming
:
bool
,
user
:
Optional
[
str
]
=
None
)
->
any
:
def
_invoke
(
self
,
model
:
str
,
credentials
:
dict
,
content_text
:
str
,
streaming
:
bool
,
user
:
Optional
[
str
]
=
None
)
->
any
:
"""
"""
_invoke text2speech model
_invoke text2speech model
...
@@ -102,7 +104,8 @@ class OpenAIText2SpeechModel(_CommonOpenAI, TTSModel):
...
@@ -102,7 +104,8 @@ class OpenAIText2SpeechModel(_CommonOpenAI, TTSModel):
raise
InvokeBadRequestError
(
str
(
ex
))
raise
InvokeBadRequestError
(
str
(
ex
))
# Todo: To improve the streaming function
# Todo: To improve the streaming function
def
_tts_invoke_streaming
(
self
,
model
:
str
,
credentials
:
dict
,
content_text
:
str
,
user
:
Optional
[
str
]
=
None
)
->
any
:
def
_tts_invoke_streaming
(
self
,
model
:
str
,
credentials
:
dict
,
content_text
:
str
,
user
:
Optional
[
str
]
=
None
)
->
any
:
"""
"""
_tts_invoke_streaming text2speech model
_tts_invoke_streaming text2speech model
...
@@ -128,7 +131,8 @@ class OpenAIText2SpeechModel(_CommonOpenAI, TTSModel):
...
@@ -128,7 +131,8 @@ class OpenAIText2SpeechModel(_CommonOpenAI, TTSModel):
except
Exception
as
ex
:
except
Exception
as
ex
:
raise
InvokeBadRequestError
(
str
(
ex
))
raise
InvokeBadRequestError
(
str
(
ex
))
def
_get_model_voice
(
self
,
model
:
str
,
credentials
:
dict
)
->
Literal
[
"alloy"
,
"echo"
,
"fable"
,
"onyx"
,
"nova"
,
"shimmer"
]:
def
_get_model_voice
(
self
,
model
:
str
,
credentials
:
dict
)
->
Literal
[
"alloy"
,
"echo"
,
"fable"
,
"onyx"
,
"nova"
,
"shimmer"
]:
"""
"""
Get voice for given tts model
Get voice for given tts model
...
@@ -230,6 +234,10 @@ class OpenAIText2SpeechModel(_CommonOpenAI, TTSModel):
...
@@ -230,6 +234,10 @@ class OpenAIText2SpeechModel(_CommonOpenAI, TTSModel):
if
"ffmpeg version"
in
output
.
decode
(
"utf-8"
):
if
"ffmpeg version"
in
output
.
decode
(
"utf-8"
):
return
True
return
True
else
:
else
:
raise
InvokeBadRequestError
(
"ffmpeg is not installed"
)
raise
InvokeBadRequestError
(
"ffmpeg is not installed, "
"details: https://docs.dify.ai/getting-started/install-self-hosted"
"/install-faq#id-14.-what-to-do-if-this-error-occurs-in-text-to-speech"
)
except
Exception
:
except
Exception
:
raise
InvokeBadRequestError
(
"ffmpeg is not installed"
)
raise
InvokeBadRequestError
(
"ffmpeg is not installed, "
"details: https://docs.dify.ai/getting-started/install-self-hosted"
"/install-faq#id-14.-what-to-do-if-this-error-occurs-in-text-to-speech"
)
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