Open starweavingdream opened 3 weeks ago
To resolve the issue where the status
parameter does not exist in the audio_msg
object, you should ensure that the audio_msg
object is correctly instantiated and populated with the necessary attributes, including status
. The audio_msg
is expected to be an instance of AudioTrunk
, which should have a status
attribute.
Here's a relevant snippet from the code:
def _listen_audio_msg(self, publisher, task_id: str):
if not publisher:
return None
audio_msg: AudioTrunk = publisher.check_and_get_audio()
if audio_msg and audio_msg.status != "finish":
return MessageAudioStreamResponse(audio=audio_msg.audio, task_id=task_id)
return None
To fix the issue, you should:
check_and_get_audio()
method of the publisher
object returns an AudioTrunk
object with a status
attribute.AudioTrunk
class is defined with a status
attribute.The AudioTrunk
class is defined as follows:
class AudioTrunk:
def __init__(self, status: str, audio):
self.audio = audio
self.status = status
If the AudioTrunk
class is missing the status
attribute, you need to add it to the class definition. If the check_and_get_audio()
method is not returning an AudioTrunk
object, you need to adjust the method to ensure it returns the correct object type [1][2].
To continue talking to Dosu, mention @dosu.
Self Checks
Dify version
0.10.1
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
I am using the normal chat room function. After I configured the text-to-speech and speech recognition functions for the chat room, an error message appears when I conduct normal Q&A, indicating that the status parameter does not exist. The picture below shows the error location. In the object
audio_msg
,status
does not exist.This will then cause the entire output flow to be interrupted. The following picture is the error message:✔️ Expected Behavior
No response
❌ Actual Behavior
No response