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
963d9b60
Unverified
Commit
963d9b60
authored
Feb 16, 2024
by
crazywoola
Committed by
GitHub
Feb 16, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature/display selected info for tts (#2454)
parent
b2ee738b
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
339 additions
and
592 deletions
+339
-592
index.tsx
...components/app/configuration/base/feature-panel/index.tsx
+5
-8
param-config-content.tsx
...s/app/configuration/config-voice/param-config-content.tsx
+3
-13
index.tsx
...onfiguration/features/chat-group/text-to-speech/index.tsx
+9
-2
common.en.ts
web/i18n/lang/common.en.ts
+4
-0
common.pt.ts
web/i18n/lang/common.pt.ts
+4
-0
common.zh.ts
web/i18n/lang/common.zh.ts
+4
-0
language.ts
web/utils/language.ts
+38
-30
yarn.lock
web/yarn.lock
+272
-539
No files found.
web/app/components/app/configuration/base/feature-panel/index.tsx
View file @
963d9b60
...
@@ -43,14 +43,11 @@ const FeaturePanel: FC<IFeaturePanelProps> = ({
...
@@ -43,14 +43,11 @@ const FeaturePanel: FC<IFeaturePanelProps> = ({
{
headerIcon
&&
<
div
className=
'flex items-center justify-center w-6 h-6'
>
{
headerIcon
}
</
div
>
}
{
headerIcon
&&
<
div
className=
'flex items-center justify-center w-6 h-6'
>
{
headerIcon
}
</
div
>
}
<
div
className=
'text-sm font-semibold text-gray-800'
>
{
title
}
</
div
>
<
div
className=
'text-sm font-semibold text-gray-800'
>
{
title
}
</
div
>
</
div
>
</
div
>
<
div
>
<
div
className=
'flex gap-2 items-center'
>
{
isShowTextToSpeech
{
headerRight
&&
<
div
>
{
headerRight
}
</
div
>
}
?
(
{
isShowTextToSpeech
&&
<
div
className=
'flex items-center'
>
<
div
className=
'flex items-center'
>
<
ParamsConfig
/>
<
ParamsConfig
/>
</
div
>
</
div
>
}
)
:
headerRight
}
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
web/app/components/app/configuration/config-voice/param-config-content.tsx
View file @
963d9b60
...
@@ -13,29 +13,19 @@ import ConfigContext from '@/context/debug-configuration'
...
@@ -13,29 +13,19 @@ import ConfigContext from '@/context/debug-configuration'
import
{
fetchAppVoices
}
from
'@/service/apps'
import
{
fetchAppVoices
}
from
'@/service/apps'
import
Tooltip
from
'@/app/components/base/tooltip'
import
Tooltip
from
'@/app/components/base/tooltip'
import
{
HelpCircle
}
from
'@/app/components/base/icons/src/vender/line/general'
import
{
HelpCircle
}
from
'@/app/components/base/icons/src/vender/line/general'
import
{
languages
}
from
'@/utils/language'
const
VoiceParamConfig
:
FC
=
()
=>
{
const
VoiceParamConfig
:
FC
=
()
=>
{
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
pathname
=
usePathname
()
const
pathname
=
usePathname
()
const
matched
=
pathname
.
match
(
/
\/
app
\/([^/]
+
)
/
)
const
matched
=
pathname
.
match
(
/
\/
app
\/([^/]
+
)
/
)
const
appId
=
(
matched
?.
length
&&
matched
[
1
])
?
matched
[
1
]
:
''
const
appId
=
(
matched
?.
length
&&
matched
[
1
])
?
matched
[
1
]
:
''
const
LanguageItems
=
[
{
value
:
'zh-Hans'
,
name
:
'Chinese'
},
{
value
:
'en-US'
,
name
:
'English'
},
{
value
:
'de-DE'
,
name
:
'German'
},
{
value
:
'fr-FR'
,
name
:
'French'
},
{
value
:
'es-ES'
,
name
:
'Spanish'
},
{
value
:
'it-IT'
,
name
:
'Italian'
},
{
value
:
'th-TH'
,
name
:
'Thai'
},
{
value
:
'id-ID'
,
name
:
'Indonesian'
},
]
const
{
const
{
textToSpeechConfig
,
textToSpeechConfig
,
setTextToSpeechConfig
,
setTextToSpeechConfig
,
}
=
useContext
(
ConfigContext
)
}
=
useContext
(
ConfigContext
)
const
languageItem
=
LanguageItem
s
.
find
(
item
=>
item
.
value
===
textToSpeechConfig
.
language
)
const
languageItem
=
language
s
.
find
(
item
=>
item
.
value
===
textToSpeechConfig
.
language
)
const
localLanguagePlaceholder
=
languageItem
?.
name
||
t
(
'common.placeholder.select'
)
const
localLanguagePlaceholder
=
languageItem
?.
name
||
t
(
'common.placeholder.select'
)
const
voiceItems
=
useSWR
({
url
:
`/apps/
${
appId
}
/text-to-audio/voices?language=
${
languageItem
?
languageItem
.
value
:
'en-US'
}
`
},
fetchAppVoices
).
data
const
voiceItems
=
useSWR
({
url
:
`/apps/
${
appId
}
/text-to-audio/voices?language=
${
languageItem
?
languageItem
.
value
:
'en-US'
}
`
},
fetchAppVoices
).
data
...
@@ -87,7 +77,7 @@ const VoiceParamConfig: FC = () => {
...
@@ -87,7 +77,7 @@ const VoiceParamConfig: FC = () => {
>
>
<
Listbox
.
Options
className=
"absolute z-10 mt-1 px-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg border-gray-200 border-[0.5px] focus:outline-none sm:text-sm"
>
<
Listbox
.
Options
className=
"absolute z-10 mt-1 px-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg border-gray-200 border-[0.5px] focus:outline-none sm:text-sm"
>
{
LanguageItem
s
.
map
((
item
:
Item
)
=>
(
{
language
s
.
map
((
item
:
Item
)
=>
(
<
Listbox
.
Option
<
Listbox
.
Option
key=
{
item
.
value
}
key=
{
item
.
value
}
className=
{
({
active
})
=>
className=
{
({
active
})
=>
...
...
web/app/components/app/configuration/features/chat-group/text-to-speech/index.tsx
View file @
963d9b60
'use client'
'use client'
import
React
,
{
type
FC
}
from
'react'
import
React
,
{
type
FC
}
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
{
useTranslation
}
from
'react-i18next'
import
{
useContext
}
from
'use-context-selector'
import
Panel
from
'@/app/components/app/configuration/base/feature-panel'
import
Panel
from
'@/app/components/app/configuration/base/feature-panel'
import
{
Speaker
}
from
'@/app/components/base/icons/src/vender/solid/mediaAndDevices'
import
{
Speaker
}
from
'@/app/components/base/icons/src/vender/solid/mediaAndDevices'
import
ConfigContext
from
'@/context/debug-configuration'
import
{
languages
}
from
'@/utils/language'
const
TextToSpeech
:
FC
=
()
=>
{
const
TextToSpeech
:
FC
=
()
=>
{
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
{
textToSpeechConfig
,
}
=
useContext
(
ConfigContext
)
return
(
return
(
<
Panel
<
Panel
title=
{
title=
{
...
@@ -16,7 +21,9 @@ const TextToSpeech: FC = () => {
...
@@ -16,7 +21,9 @@ const TextToSpeech: FC = () => {
}
}
headerIcon=
{
<
Speaker
className=
'w-4 h-4 text-[#7839EE]'
/>
}
headerIcon=
{
<
Speaker
className=
'w-4 h-4 text-[#7839EE]'
/>
}
headerRight=
{
headerRight=
{
<
div
className=
'text-xs text-gray-500'
>
{
t
(
'appDebug.feature.textToSpeech.resDes'
)
}
</
div
>
<
div
className=
'text-xs text-gray-500'
>
{
languages
.
find
(
i
=>
i
.
value
===
textToSpeechConfig
.
language
)?.
name
}
{
textToSpeechConfig
.
voice
}
</
div
>
}
}
noBodySpacing
noBodySpacing
isShowTextToSpeech=
{
true
}
isShowTextToSpeech=
{
true
}
...
...
web/i18n/lang/common.en.ts
View file @
963d9b60
...
@@ -49,6 +49,10 @@ const translation = {
...
@@ -49,6 +49,10 @@ const translation = {
itIT
:
'Italian'
,
itIT
:
'Italian'
,
thTH
:
'Thai.'
,
thTH
:
'Thai.'
,
idID
:
'Indonesian'
,
idID
:
'Indonesian'
,
jaJP
:
'Japanese'
,
koKR
:
'Korean'
,
ptBR
:
'Portuguese'
,
ruRU
:
'Russian'
,
},
},
},
},
unit
:
{
unit
:
{
...
...
web/i18n/lang/common.pt.ts
View file @
963d9b60
...
@@ -63,6 +63,10 @@ const translation = {
...
@@ -63,6 +63,10 @@ const translation = {
itIT
:
'italiano'
,
itIT
:
'italiano'
,
thTH
:
'tailandês'
,
thTH
:
'tailandês'
,
idID
:
'indonésio'
,
idID
:
'indonésio'
,
jaJP
:
'japonês'
,
koKR
:
'coreano'
,
ptBR
:
'português'
,
ruRU
:
'russo'
,
},
},
},
},
anthropicHosted
:
{
anthropicHosted
:
{
...
...
web/i18n/lang/common.zh.ts
View file @
963d9b60
...
@@ -49,6 +49,10 @@ const translation = {
...
@@ -49,6 +49,10 @@ const translation = {
itIT
:
'意大利语'
,
itIT
:
'意大利语'
,
thTH
:
'泰语'
,
thTH
:
'泰语'
,
idID
:
'印尼语'
,
idID
:
'印尼语'
,
jaJP
:
'日语'
,
koKR
:
'韩语'
,
ptBR
:
'葡萄牙语'
,
ruRU
:
'俄语'
,
},
},
},
},
unit
:
{
unit
:
{
...
...
web/utils/language.ts
View file @
963d9b60
...
@@ -3,8 +3,8 @@ export type Item = {
...
@@ -3,8 +3,8 @@ export type Item = {
name
:
string
name
:
string
}
}
export
const
LanguagesSupported
=
[
'en-US'
,
'zh-Hans'
,
'pt-BR'
,
'es-ES'
,
'fr-FR'
,
'de-DE'
,
'ja-JP'
,
'ko-KR'
,
'ru-RU'
,
'it-IT'
]
export
const
LanguagesSupported
=
[
'en-US'
,
'zh-Hans'
,
'pt-BR'
,
'es-ES'
,
'fr-FR'
,
'de-DE'
,
'ja-JP'
,
'ko-KR'
,
'ru-RU'
,
'it-IT'
,
'th-TH'
,
'id-ID'
]
export
const
LanguagesSupportedUnderscore
=
[
'en_US'
,
'zh_Hans'
,
'pt_BR'
,
'es_ES'
,
'fr_FR'
,
'de_DE'
,
'ja_JP'
,
'ko_KR'
,
'ru_RU'
,
'it_IT'
]
export
const
LanguagesSupportedUnderscore
=
[
'en_US'
,
'zh_Hans'
,
'pt_BR'
,
'es_ES'
,
'fr_FR'
,
'de_DE'
,
'ja_JP'
,
'ko_KR'
,
'ru_RU'
,
'it_IT'
,
'th_TH'
,
'id_ID'
]
export
const
languages
=
[
export
const
languages
=
[
{
{
...
@@ -19,34 +19,42 @@ export const languages = [
...
@@ -19,34 +19,42 @@ export const languages = [
value
:
'pt-BR'
,
value
:
'pt-BR'
,
name
:
'Português(Brasil)'
,
name
:
'Português(Brasil)'
,
},
},
// {
{
// value: 'es-ES',
value
:
'es-ES'
,
// name: 'Español(España)',
name
:
'Español(España)'
,
// },
},
// {
{
// value: 'fr-FR',
value
:
'fr-FR'
,
// name: 'Français(France)',
name
:
'Français(France)'
,
// },
},
// {
{
// value: 'de-DE',
value
:
'de-DE'
,
// name: 'Deutsch(Deutschland)',
name
:
'Deutsch(Deutschland)'
,
// },
},
// {
{
// value: 'ja-JP',
value
:
'ja-JP'
,
// name: '日本語(日本)',
name
:
'日本語(日本)'
,
// },
},
// {
{
// value: 'ko-KR',
value
:
'ko-KR'
,
// name: '한국어(대한민국)',
name
:
'한국어(대한민국)'
,
// },
},
// {
{
// value: 'ru-RU',
value
:
'ru-RU'
,
// name: 'Русский(Россия)',
name
:
'Русский(Россия)'
,
// },
},
// {
{
// value: 'it-IT',
value
:
'it-IT'
,
// name: 'Italiano(Italia)',
name
:
'Italiano(Italia)'
,
// },
},
{
value
:
'th-TH'
,
name
:
'ไทย(ประเทศไทย)'
,
},
{
value
:
'id-ID'
,
name
:
'Bahasa Indonesia'
,
},
]
]
export
const
getModelRuntimeSupported
=
(
locale
:
string
)
=>
{
export
const
getModelRuntimeSupported
=
(
locale
:
string
)
=>
{
...
...
web/yarn.lock
View file @
963d9b60
This diff is collapsed.
Click to expand it.
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