Skip to content

Commit

Permalink
feat: Filter out 'thought' messages in DevBot component (#60)
Browse files Browse the repository at this point in the history
The code changes in `DevBot.tsx` add a conditional check to filter out messages of type 'thought' before adding them to the list of messages. This ensures there is only one thought message.
  • Loading branch information
kanak8278 authored Aug 29, 2024
1 parent aa27b95 commit e766d97
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion studio/src/components/Chat/DevBot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,15 @@ export const devBot = (props:props) => {
console.log(error);
}
}
addMessages((messages: any) => [lastJsonMessage, ...messages])
if (lastJsonMessage.type === 'thought') {
addMessages((messages: any) => {
const filteredMessages = messages.filter((msg: any) => msg.type !== 'thought');
return [lastJsonMessage, ...filteredMessages];
});
}
else{
addMessages((messages: any) => [lastJsonMessage, ...messages])
}
scrollChatToBottom();
}
}, [lastJsonMessage, addMessages]);
Expand Down

0 comments on commit e766d97

Please sign in to comment.