Integrating AI assistant (fastapi/react) on the main website(laravel).

I’m currently developing a chatbot using FastAPI, LangChain, and React and am looking to integrate it into my Laravel application. I initially tried placing the React app’s build folder into Laravel’s public directory and created a route for it. While this approach works, I’ve encountered an issue: when navigating between routes, the chatbot also refreshes. This results in users having to wait for the chatbot to reload every time they switch routes, which is not ideal. Is there a better way to ensure the chatbot remains loaded and accessible throughout the entire site without having to reload each time the route changes?
2 Replies
Eve
Eve4mo ago
No. PHP is server only. It does not, and cannot, run in the browser. Every page has to go back to the server to be rendered anew. If you want persistence in your client-side experience, you need some form of code running in the browser, be it a client-side framework or vanilla JS.
Hamza Ali Turi
Hamza Ali TuriOP4mo ago
Will do that. Thanks 👍.
Want results from more Discord servers?
Add your server