Skip to content

Commit

Permalink
fix: langgenius#8843 event: tts_message_end always return in api stre…
Browse files Browse the repository at this point in the history
…aming resp… (langgenius#8846)
  • Loading branch information
ic-xu authored and cuiks committed Oct 8, 2024
1 parent 19a545b commit 1dc8355
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion api/core/app/apps/advanced_chat/generate_task_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ def _wrapper_process_stream_response(
except Exception as e:
logger.error(e)
break
yield MessageAudioEndStreamResponse(audio="", task_id=task_id)
if tts_publisher:
yield MessageAudioEndStreamResponse(audio="", task_id=task_id)

def _process_stream_response(
self,
Expand Down
3 changes: 2 additions & 1 deletion api/core/app/apps/workflow/generate_task_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ def _wrapper_process_stream_response(
except Exception as e:
logger.error(e)
break
yield MessageAudioEndStreamResponse(audio="", task_id=task_id)
if tts_publisher:
yield MessageAudioEndStreamResponse(audio="", task_id=task_id)

def _process_stream_response(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ def _wrapper_process_stream_response(
else:
start_listener_time = time.time()
yield MessageAudioStreamResponse(audio=audio.audio, task_id=task_id)
yield MessageAudioEndStreamResponse(audio="", task_id=task_id)
if publisher:
yield MessageAudioEndStreamResponse(audio="", task_id=task_id)

def _process_stream_response(
self, publisher: AppGeneratorTTSPublisher, trace_manager: Optional[TraceQueueManager] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
)

if TYPE_CHECKING:
from pydantic_core.core_schema import LiteralSchema, ModelField, ModelFieldsSchema
from pydantic_core.core_schema import ModelField

__all__ = ["BaseModel", "GenericModel"]
_BaseModelT = TypeVar("_BaseModelT", bound="BaseModel")
Expand Down

0 comments on commit 1dc8355

Please sign in to comment.