mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
fix: add type check for lastMessage.text in TTS useEffect (#10431)
fix: add type check for lastMessage.text before calling startsWith Fixes #10430 The TTS useEffect was calling .startsWith() on lastMessage.text after only checking if it was truthy. If text was a non-string truthy value (array, object, or number), this would crash with "Q.text.startsWith is not a function". Changed the truthy check to an explicit type check: typeof lastMessage.text === "string" Co-authored-by: Roo Code <roomote@roocode.com>
This commit is contained in:
parent
3074ccc278
commit
586cf47fb2
1 changed files with 1 additions and 1 deletions
|
|
@ -1016,7 +1016,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
|
|||
// labeled as `user_feedback`.
|
||||
if (lastMessage && messages.length > 1) {
|
||||
if (
|
||||
lastMessage.text && // has text
|
||||
typeof lastMessage.text === "string" && // has text (must be string for startsWith)
|
||||
(lastMessage.say === "text" || lastMessage.say === "completion_result") && // is a text message
|
||||
!lastMessage.partial && // not a partial message
|
||||
!lastMessage.text.startsWith("{") // not a json object
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue