Fix _handle_send_text to use default options if not provided
This commit is contained in:
committed by
Mattie Ruth
parent
d8a2a917a2
commit
cad3104d56
@@ -614,8 +614,8 @@ class RTVIAppendToContextData(BaseModel):
|
|||||||
Contains the role, content, and whether to run the message immediately.
|
Contains the role, content, and whether to run the message immediately.
|
||||||
|
|
||||||
.. deprecated:: 0.0.85
|
.. deprecated:: 0.0.85
|
||||||
The RTVI message, append-to-context, has been deprecated. Use send-text
|
The RTVI message, append-to-context, has been deprecated. Use send-text
|
||||||
or custom client and server messages instead.
|
or custom client and server messages instead.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
role: Literal["user", "assistant"] | str
|
role: Literal["user", "assistant"] | str
|
||||||
@@ -1601,17 +1601,18 @@ class RTVIProcessor(FrameProcessor):
|
|||||||
|
|
||||||
async def _handle_send_text(self, data: RTVISendTextData):
|
async def _handle_send_text(self, data: RTVISendTextData):
|
||||||
"""Handle a send-text message from the client."""
|
"""Handle a send-text message from the client."""
|
||||||
if data.options.run_immediately:
|
opts = data.options if data.options is not None else RTVISendTextOptions()
|
||||||
|
if opts.run_immediately:
|
||||||
await self.interrupt_bot()
|
await self.interrupt_bot()
|
||||||
cur_skip_tts = self._skip_tts
|
cur_skip_tts = self._skip_tts
|
||||||
should_skip_tts = not data.options.audio_response
|
should_skip_tts = not opts.audio_response
|
||||||
toggle_skip_tts = cur_skip_tts != should_skip_tts
|
toggle_skip_tts = cur_skip_tts != should_skip_tts
|
||||||
if toggle_skip_tts:
|
if toggle_skip_tts:
|
||||||
output_frame = LLMConfigureOutputFrame(skip_tts=should_skip_tts)
|
output_frame = LLMConfigureOutputFrame(skip_tts=should_skip_tts)
|
||||||
await self.push_frame(output_frame)
|
await self.push_frame(output_frame)
|
||||||
text_frame = LLMMessagesAppendFrame(
|
text_frame = LLMMessagesAppendFrame(
|
||||||
messages=[{"role": "user", "content": data.content}],
|
messages=[{"role": "user", "content": data.content}],
|
||||||
run_llm=data.options.run_immediately,
|
run_llm=opts.run_immediately,
|
||||||
)
|
)
|
||||||
await self.push_frame(text_frame)
|
await self.push_frame(text_frame)
|
||||||
if toggle_skip_tts:
|
if toggle_skip_tts:
|
||||||
|
|||||||
Reference in New Issue
Block a user