T
TanStack3y ago
ratty-blush

Chatbot with React Query - does it make sense?

Hey folks! I am building a chatbot feature in my application and I was wondering if it makes sense to use React Query for that? The flow will look something like this: - main app calls the /initialise endpoint with the user id and some additional data - chatbot api passes back a session id - for the remainder of the session main app calls the /transactions endpoint with the session id and the text input - as a response, it receives plain text answer and some additional data, basically the guides for next possible question/action My intuition is that I wouldn't necessarily benefit from using RQ for this since it doesn't make much sense for me to cache any responses. I'm leaning towards a solution where after each successful response from /transactions endpoint, I push the message to the messages array kept in Zustand store for example or even plain old React state. This messages array would be a representation of the entire conversation. On the other hand, maybe it's worth using RQ just for loading and error state handling? What are your thoughts, how would you apporach this? Thank you upfront!
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?