Original Discord Post by sofiafc | 2024-10-09 21:54:22
Hello, I’m building a demo using RPM-Lipsync repo, preserving the original components and adding components upon. The demo includes webcam recording and communicates with a Python Flask REST API. I’m facing errors, only in some situations. Here’s what I know so far:
No errors on Microsoft Edge (normal and incognito);
No errors on Google Chrome incognito
No errors, if we remove ChatBubble from App.jsx.
No errors, when we include ChatBubble, while removing the API key and ID from the client (on App.jsx).
I don’t know if it’s related, but the character often forgets the script and say “Hi, how can I assist you today?”.
The pictures show console errors on normal Google Chrome, when including ChatBubble and client API key and ID.
Is this familiar for any of you? Thanks in advance
Reply by saurav0037 | 2024-10-11 17:23:22
<@1063549978582188154> if it forgets the script then its a new session id created. Which can happen if a new instance of ConvaiClient gets created
Reply by sofiafc | 2024-10-13 18:27:47
hum… do you have any idea about what may be causing the new session creation? can that be caused by new useEffect hooks, even if in another component?
Reply by saurav0037 | 2024-10-11 17:24:17
The error is from localstorage after reset I think
Reply by sofiafc | 2024-10-13 18:34:21
I noticed the transcript is being saved to localStorage, on ChatBubble component. Is it possible to still get the transcript if I remove ChatBubble component from App.jsx? I just needed the NPC transcript, not the user
No if you remove chatbubble it wont use localstorage nor will it show chat ui. You can get all the npc chat from client returned from useconvaiclient hook
Reply by saurav0037 | 2024-10-15 17:17:02
No if you remove chatbubble it wont use localstorage nor will it show chat ui. You can get all the npc chat from client returned from useconvaiclient hook
Reply by saurav0037 | 2024-10-15 17:17:02
No if you remove chatbubble it wont use localstorage nor will it show chat ui. You can get all the npc chat from client returned from useconvaiclient hook
Reply by sofiafc | 2024-10-16 11:16:07
Thanks a lot Saurav, your suggestion really helped a lot! I managed to successfully get the npcText updating on other components, using useEffect. I’m sharing what I’ve added to my code, in case someone has the same question:
export default function Results({client}) {
const [npcText, setNpcText] = useState(client.npcText);
useEffect(() => {
setNpcText(client.npcText);
}, [client]);
// Rest of my code
useEffect(() => {
// handle final results
// check if npcText contains "here are your results"
if (npcText.includes("Here are your results")) {
setEvaluation(npcText)
handleFinalResults();
}
}
, [npcText]);
return (...)};