There are a few ways. I built something similar huckai.com on top of vectara.com. They have open sourced their versions https://github.com/vectara
You can also do this on AWS now fairly easily. https://medium.com/data-reply-it-datatech/how-to-build-a-cus...
The lablab.ai Discord community is a pretty good place to learn how this product category is evolving.