Now it is even easier. Cloudflare has a beta product called AI Search that implements most of these 160 lines of code