Text2speech auto play cannot work #5205

Closed
opened 2026-02-21 18:09:51 -05:00 by yindo · 6 comments
Owner

Originally created by @YangXuepei on GitHub (Aug 25, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.7.1

Cloud or Self Hosted

Cloud

Steps to reproduce

In the text2speech setting, auto play is switched open.
Run the workflow or chat-assistant.
The assistant message can not be play automatically.

✔️ Expected Behavior

When the auto play is switched open,

Actual Behavior

No response

Originally created by @YangXuepei on GitHub (Aug 25, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.7.1 ### Cloud or Self Hosted Cloud ### Steps to reproduce In the text2speech setting, auto play is switched open. Run the workflow or chat-assistant. The assistant message can not be play automatically. ### ✔️ Expected Behavior When the auto play is switched open, ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:09:51 -05:00
yindo closed this issue 2026-02-21 18:09:51 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 25, 2024):

@YangXuepei Hello there! I'm here to assist you with any bugs, questions, or contributions. Let's see how we can resolve the issue you've encountered.

I found a similar unsolved discussion regarding the text2speech auto play feature not working when enabled. You can check it out here [1].

For the issue you're facing with Dify version 0.7.1, the text2speech auto play feature might not be working due to the textToSpeechConfig.autoPlay value not being correctly set or updated. Ensure that the textToSpeechConfig.autoPlay is correctly set to TtsAutoPlay.enabled when the auto play feature is enabled. Here is the relevant part of the code:

<RadioGroup
  className='space-x-3'
  options={[
    {
      label: t('appDebug.voice.voiceSettings.autoPlayEnabled'),
      value: TtsAutoPlay.enabled,
    },
    {
      label: t('appDebug.voice.voiceSettings.autoPlayDisabled'),
      value: TtsAutoPlay.disabled,
    },
  ]}
  value={text2speech?.autoPlay ? text2speech?.autoPlay : TtsAutoPlay.disabled}
  onChange={(value: TtsAutoPlay) => {
    handleChange({
      autoPlay: value,
    })
  }}
/>

Make sure that the handleChange function is correctly updating the text2speech state with the new autoPlay value. The handleChange function is defined as follows:

const handleChange = (value: Record<string, string>) => {
  const {
    features,
    setFeatures,
  } = featuresStore!.getState()
  const newFeatures = produce(features, (draft) => {
    draft.text2speech = {
      ...draft.text2speech,
      ...value,
    }
  })

  setFeatures(newFeatures)
  if (onChange)
    onChange(newFeatures)
}

Additionally, ensure that the features_dict in the generate_task_pipeline.py is correctly configured. The text_to_speech feature should be enabled and the autoPlay property should be set to 'enabled' for the auto play functionality to work:

features_dict = self._workflow.features_dict
if features_dict.get('text_to_speech') and features_dict['text_to_speech'].get('enabled') and features_dict['text_to_speech'].get('autoPlay') == 'enabled':
    publisher = AppGeneratorTTSPublisher(tenant_id, features_dict['text_to_speech'].get('voice'))

Ensure that the features_dict is correctly populated and that the autoPlay property is set to 'enabled' in the configuration. This will ensure that the text2speech auto play feature works as expected [2][3][4].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Aug 25, 2024): <!-- Greeting --> @YangXuepei Hello there! I'm here to assist you with any bugs, questions, or contributions. Let's see how we can resolve the issue you've encountered. <!-- Answer --> I found a similar unsolved discussion regarding the text2speech auto play feature not working when enabled. You can check it out [here](https://github.com/langgenius/dify/discussions/3950) <sup>[[1]](https://github.com/langgenius/dify/discussions/3950)</sup>. For the issue you're facing with Dify version 0.7.1, the text2speech auto play feature might not be working due to the `textToSpeechConfig.autoPlay` value not being correctly set or updated. Ensure that the `textToSpeechConfig.autoPlay` is correctly set to `TtsAutoPlay.enabled` when the auto play feature is enabled. Here is the relevant part of the code: ```tsx <RadioGroup className='space-x-3' options={[ { label: t('appDebug.voice.voiceSettings.autoPlayEnabled'), value: TtsAutoPlay.enabled, }, { label: t('appDebug.voice.voiceSettings.autoPlayDisabled'), value: TtsAutoPlay.disabled, }, ]} value={text2speech?.autoPlay ? text2speech?.autoPlay : TtsAutoPlay.disabled} onChange={(value: TtsAutoPlay) => { handleChange({ autoPlay: value, }) }} /> ``` Make sure that the `handleChange` function is correctly updating the `text2speech` state with the new `autoPlay` value. The `handleChange` function is defined as follows: ```tsx const handleChange = (value: Record<string, string>) => { const { features, setFeatures, } = featuresStore!.getState() const newFeatures = produce(features, (draft) => { draft.text2speech = { ...draft.text2speech, ...value, } }) setFeatures(newFeatures) if (onChange) onChange(newFeatures) } ``` Additionally, ensure that the `features_dict` in the `generate_task_pipeline.py` is correctly configured. The `text_to_speech` feature should be enabled and the `autoPlay` property should be set to 'enabled' for the auto play functionality to work: ```py features_dict = self._workflow.features_dict if features_dict.get('text_to_speech') and features_dict['text_to_speech'].get('enabled') and features_dict['text_to_speech'].get('autoPlay') == 'enabled': publisher = AppGeneratorTTSPublisher(tenant_id, features_dict['text_to_speech'].get('voice')) ``` Ensure that the `features_dict` is correctly populated and that the `autoPlay` property is set to 'enabled' in the configuration. This will ensure that the text2speech auto play feature works as expected <sup>[[2]](https://github.com/langgenius/dify/blob/main/web/app/components/app/configuration/config-voice/param-config-content.tsx)</sup><sup>[[3]](https://github.com/langgenius/dify/blob/main/web/app/components/base/features/feature-panel/text-to-speech/param-config-content.tsx)</sup><sup>[[4]](https://github.com/langgenius/dify/blob/main/api/core/app/apps/advanced_chat/generate_task_pipeline.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@YangXuepei commented on GitHub (Aug 25, 2024):

@dosu I'm using cloud. Thanks a lot but this is not helping : )

@YangXuepei commented on GitHub (Aug 25, 2024): @dosu I'm using cloud. Thanks a lot but this is not helping : )
Author
Owner

@dosubot[bot] commented on GitHub (Aug 25, 2024):

This is a tough nut to crack, could really use your help on this, @takatost.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Aug 25, 2024): <!-- Answer --> This is a tough nut to crack, could really use your help on this, @takatost. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Aug 25, 2024):

We have several similar issues here. Close as duplicated https://github.com/langgenius/dify/issues/6997

@crazywoola commented on GitHub (Aug 25, 2024): We have several similar issues here. Close as duplicated https://github.com/langgenius/dify/issues/6997
Author
Owner

@YangXuepei commented on GitHub (Aug 26, 2024):

@crazywoola On cloud, not self-hosted as #6997 .

@YangXuepei commented on GitHub (Aug 26, 2024): @crazywoola On cloud, not self-hosted as #6997 .
Author
Owner

@YangXuepei commented on GitHub (Aug 26, 2024):

@takatost

@YangXuepei commented on GitHub (Aug 26, 2024): @takatost
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5205