How I Built an AI Shopping Assistant for My Website
Rig Advisor is an AI shopping assistant on SimRacingCockpit that answers from my own buyer's guides and live product data. It's my experiment in improving the customer experience without relying on visitors' AI assistants.
On this page
- Why I put a chat on a sim racing site
- What Rig Advisor is, and what it runs on
- Stopping it making things up
- When it refused its own starter question
- Price sense, and a £76,673 simulator
- Caching the fan-out
- Going live on every page
- What it costs to run an AI chatbot on your own website
- Where it stands after 24 hours
- Retail, travel, car hire: the same shape
I have an opinion that there are new tools emerging for front-end and back-end web developers that change, or can potentially change, how a user interacts with your website, regardless of whether they're using a browser or they're using an AI agent. The main example of that is the one I cited in my WebMCP chatbot article. WebMCP is a way for a site to expose actions that a chat or an agent can drive. But I'm very keen to explore how ideas like this can actually make a commercial contribution and, critically, a UX customer experience improvement without hoping that they're visiting using their AI assistant.
SimRacingCockpit is a fantastic sandbox for me to experiment with getting these things right. And today, if you visit the site, you'll find what I call Rig Advisor, which is an AI-powered shopping assistant that makes product recommendations and opinionated, experience-based recommendations based on my prior writing. The experiment is live and in production. It's very difficult at a reasonable budget and response speed to get an accurate answer from two quite different types of data source.
Why I put a chat on a sim racing site
On 17 Nov I asked for a chat window on SimRacingCockpit (simracingcockpit.gg), my sim racing buyer's guide site. I wanted it to answer questions from the site content and the product data, technical questions included, with monetised affiliate links out. And I wanted it locked down to stay on topic, with read-only access. I want it to give my audience an accurate reflection of my opinion of the product at the time of writing, with current data on pricing and stock availability.
The risk is a chat that makes something up. Air Canada's website chatbot told a customer that bereavement fares could be claimed retroactively, and British Columbia's Civil Resolution Tribunal held the airline liable and ordered it to pay C$812.02. The tribunal's line was "It makes no difference whether the information comes from a static page or a chatbot." The ruling also recorded that the correct policy sat on a page the chatbot itself had linked to.
Pure retrieval, not WebMCP
My WebMCP chat for YubHub came first, and I asked for that prior work to be used as the baseline. Rig Advisor's prompt shape, output cleaning, limits and window layout were lifted from it. SimRacingCockpit isn't WebMCP-enabled, so Rig Advisor drives nothing on the page. This is pure corpus and information retrieval. Retrieval is finding the passages a model answers from. So this experiment is for the visitor in an ordinary browser, who isn't arriving through an AI assistant.
What Rig Advisor is, and what it runs on
Rig Advisor is one Cloudflare Worker that serves a small chat pop-up. A Cloudflare Worker is code that runs on Cloudflare's network, close to the visitor. The button that opens it, the launcher, reads "Ask Rig Advisor". Rig Advisor answers from data it holds, plus live products from the site's product API.
I asked for it to be self-contained and reusable. On a phone the chat is full screen, and on a desktop it takes about a third of the browser, styled to blend with the site. I also asked for little product results boxes with thumbnails, small, well presented and clean.
There are two kinds of data source. The first is the product feed from my own product data stack, which is the pipeline behind SimRacingCockpit's affiliate tables. The response rate from it is pretty good, and as long as the prompt understands the schema, the model can derive everything it needs from what is essentially deterministic data. It also has a nice template to serve buy links and prices. The second source is the guides, which are my opinion.
The models and the index
The chat model is GLM-4.7-Flash, which runs on Cloudflare Workers AI. Workers AI is the set of hosted models that Cloudflare lets a Worker call. Llama 3.1 8B is the guard, and it checks a question is on topic before the chat model answers. I set temperature 0 and seed 42, and capped most replies at 400 output tokens to keep them short.
I asked for the index to come from WordPress queries, to get a pure, noise-free corpus. The indexer pulls the published posts and pages from WordPress, not scraped pages. The index sits in D1, which is Cloudflare's SQL database. It's a full-text search table that holds 333 posts and pages, split into about 3,600 passages.
When it can't answer
When Rig Advisor can't answer, it says so in my wording, with the topic of the question filled in: "I can't help you with that query but we've logged it to be better next time. As your query was on the topic of {topic}, here are some equipment reviews and products you might be interested in." A question it can't answer is logged for further information retrieval.
Stopping it making things up
On 18 Nov I'd asked it about a product, and I sent this.
What's missing here is the opinion - my question was an enquiry about a product. There's nothing wrong with the answer except you're talking to a chat bot with access to an experience / opinionated / technical corpus. The goal for the llm is to provide information to help a purchase - tell me about a product, what do we think about it, what do you need to get started, useful settings and so on
The baseline, and strictness
The first test set was the baseline, run on 18 Nov with 36 questions. In its answers the chat stated specs, Nm ranges, PSU sizes and sims from memory. Nm is newton-metres, the torque a wheelbase puts out.
We need a strictness to the output and model prompt / settings so it can't just make things up
That strictness went into code, not only into the prompt. The general term for this is grounding, which means an answer may only state what the evidence in front of the model supports. The code that enforces it here is the claim check. A sentence that states a number with a unit, or a price, is dropped if that figure isn't in that turn's tool results or in the visitor's own words. A sentence naming a product that the evidence doesn't name is dropped too. A cut answer is retried once, with a note of what was cut. If the second attempt is cut as well, the visitor gets the fixed can't-answer reply.
Scoring it
After the baseline, I asked for Gemini's help with a buyer's journey question set, based on the chat's goal and its known limits. It has 42 questions. The questions were kept as Gemini wrote them, in a phone user's wording, and the expected answers were corrected. The set is scored out of 114 points. On its first run, on 18 Nov, it scored 50 (44%), and over three rounds it reached 86.5 (76%).
I also asked for Opus and Fable judges on how useful an answer is, and on the suggested questions that come next. Opus and Fable are two AI models. In rounds 4 to 6 they scored each round blind, and the Fable judge scored the voice as well. Then I said to carry on with the chat development until the improvements became marginal.
When it refused its own starter question
"Best first direct drive wheel base" was a question the chat itself offered, and in round 6 it got the can't-answer reply.
I went through the sentences the claim check had removed, and classified 87 of them. At most 57 were true, and they'd been cut because retrieval hadn't found the passages to support them. The other 30 were untrue.
A paraphrased corpus, not the whole article
After that refusal, on 1 Dec, I sent this message.
if we're storing an indexed opinion from a guide then we need to encode that opinion in a way that a) is correct and doesn't result in a "We don't know that, but here are some wheel bases you can look at." result, without latency - so a paraphrased corpus rather than storing an entire article.
We crawled and quite heavily compressed the key findings and takeaways from each guide, which reduces input context. It keeps us well within budget. That gave us a set of picks. Fourteen guides are encoded as 81 picks, and each pick holds the product, who it is for, the platforms and the guide's reason. Three Fable agents read the guides and wrote the picks. Every figure in a pick is tested against the passages it cites, and a staleness check lists the picks whose guide has changed. Re-encoding a stale pick is still a manual step.
The same question, answered from the picks
The same question is now answered from the picks, with no retrieval and no model call, in 1.7 to 2.7 s against 3.9 s before. The three cards are in one currency, where before one of them was in Canadian dollars. There's one link, to the direct drive guide, where there had been three with one of them off-topic. Across the test set's decision questions, 11 of 13 got a pick, up from 7 of 13.
Price sense, and a £76,673 simulator
I tried it on my phone. I asked "What cockpit suits the Moza CRP2?" and it showed three motion simulators at £21,280 to £76,673, for a $339 pedal set. The text said they "can mount a Moza CRP2", with nothing in the data it had been given to support it.
So I asked for a price range.
I think there needs to be some consideration on price range. An answer should present inside the typical low to high window or add a price modifier to fan out
The fan-out queries are the several product lookups that one question sets off.
The price window and the companion tier
The price window covers a question with no budget in it. Cards then have to sit inside the category's typical window, which runs from half the cheapest pick to twice the dearest. The companion tier covers a question like mine, where one product is named and a different kind of kit is wanted. It takes the price of the pedal set, works out where that price sits in the window for pedals, and searches the same part of the window for cockpits. The CRP2 at $339 gives cockpits from $205 to $698.
After the change, the same question showed the Sabelt S97 at $639, the Sabelt SIM LITE at $639 and the GT1 PRO base at $649.
Across the test set, cards over $5,000 went from 3 to 0, out of 305 cards. And a fit claim like "can mount" is only allowed now when the feed or the index says that about that product.
Caching the fan-out
Five parallel lookups from the Worker slowed the feed until cards timed out.
We should cache the fan out queries. Tell me, does the chat window come primed with suggested questions relevant to the page?
A shared cache and a cron
Only the three cards shown are looked up now, and every product-feed request goes through KV. KV is Cloudflare's key-value store, used here as a shared cache. Each entry is keyed on the request, kept for 10 minutes and shared by every Worker instance. I went with KV because Cloudflare's Cache API did nothing when I tried it on the test Worker's address.
Then there's a cron, which is a job that runs on a schedule. Every 15 minutes it fetches the listings for all 81 picks and stores them. The first run found a listing for 56 of the 81.
Caching the fan-out queries found us quite a lot of performance. The median reply from the picks went from 2,899 ms to 64 ms, and later to 28 ms. Across the whole test set, replies over 20 s went from 16 to 7.
Page starters
The chat didn't come primed with questions for the page, so round 8 added page starters. They're on 48 pages: 14 guides and 34 reviews.
Going live on every page
On 1 Dec I decided to ship it. My chief concern was excessive Workers AI requests.
If you have confidence then let's yolo it into production
The caps
A lot of questions never call the model at all. Fixed routes are set answers for things like a shown card's price, the sources, discount codes, and attempts to read or override the instructions. The picks don't call the model either.
The model can be called 3,000 times a day, and it can give 30 model replies a minute across all visitors, per location. Past either cap, a question that needs the model gets a busy reply, while the picks, starters, codes and fixed routes keep answering.
Every page, no WordPress change
Getting it onto the site needed no WordPress change. The site's proxy Worker adds the script to every front-end page on the way out, and the cached pages are unchanged. I checked 61 anonymous page loads across 31 URLs, and all 61 carried it. It isn't on logged-in pages, because I said we don't need it there.
On phones, the open chat now sits over the site's sticky bottom ad.
Security and tracking
On 1 Dec I asked for a check that we weren't leaking any dev URLs, and for a look at security. No dev URLs were leaking. The review did find that the chat's system prompt could be recited. The system prompt is the hidden instructions the model is given. Two prompts written to pull it out got the model reciting the start of it. Those requests now get a fixed line, and any reply that quotes the system prompt is replaced.
On the commercial side, I asked for click actions from the chat window to be tracked. Every click out of the chat to a product or a guide is tracked as a chat-exit event, and chat opens are tracked too. There are no click figures to report yet.
Page speed
On 2 Dec I asked whether the front end was optimised for page load speed, with render blocking limited. The script is a 13.7 KB download and it loads after the page's load event. On the pedals guide the launcher appears at about 2.2 s.
What it costs to run an AI chatbot on your own website
Cloudflare's free allocation for Workers AI is 10,000 neurons a day, on both the Free and Paid Workers plans. Neurons are Cloudflare's billing unit for Workers AI. Above the free allocation, Workers Paid charges $0.011 per 1,000 neurons. Cloudflare prices GLM-4.7-Flash at $0.060 in / $0.400 out per million tokens. Llama 3.1 8B FP8, the guard, is $0.152 in / $0.287 out per million tokens.
Almost zero, and why free shouldn't count
So it's running on almost zero budget once it's deployed to production. In terms of neuron use, it's barely scratching the surface of what Cloudflare give you for free on a daily basis.
The fact that it's free shouldn't really count for anything. It's the engineering discipline of making sure that it's running as efficiently as possible and as accurately as possible on the opinionated content.
I can't tell you what it costs at real traffic. I haven't measured it, because it has had very little use so far.
Where it stands after 24 hours
Rig Advisor has been live since 1 Dec. In that time I've been through the logs, done the full security shakedown and put in bot protection.
Bots found it within hours, probing for open AI endpoints and leaked files, and got nothing back.
Still open
The slow replies come from the model itself, in single calls of 18 to 38 s when I measured them on 1 Dec. Of the 81 picks, 25 have no shop listing, so they get no card.
Retail, travel, car hire: the same shape
I think the shape of the solution is exactly the same in just about every case. Product data is very easily mined and formed into a schema that a model can access very quickly. The combination of product data and reviews is a very tempting place to build an opinionated corpus on a product, and a transparent one if you're citing your sources. Travel data is very easily had on a travel website.
The user's challenge is quite different, of course. On flight search it would be: find me a flight from London to San Diego on the 1st of December, my budget is this, and I don't want any transfers, please.
So really, the use case itself is relatively trivial, in my opinion, compared to the underlying infrastructure build. And that's where I think chatbot companies might be at a disadvantage, because they aren't as close to this data as the owners themselves.
Managed retrieval, or your own data
Cloudflare has its own managed retrieval service, launched as AutoRAG and now called AI Search. As Cloudflare's blog describes it, it takes in your data, cuts it into passages and stores each one in a form that can be searched by meaning. It then retrieves the passages that match a question and generates a response from them. My own retrieval setup is a full-text search over passages.
What I've got, and what's next
Self-contained and reusable was my requirement from the start, which is why this is now a reusable component for me for my client work.
So I would advocate for self-hosted chatbot technology, or chatbot technology that the owner has control of, rather than handing control of this over to a basic catch-all software as a service.
Continue reading.
- Case StudiesTrade Pricing on Shopify Plus B2B, Native-First
- Buyer's GuidesEnterprise GPUs for AI: Which Pro Card to Buy
- Buyer's GuidesBest Computer for AI Agents: What Each Job Needs
- Local AIA Self-Hosted AI Share Trading Agent: Built With Claude, Run Locally for Free
- Local AIMSI PRO MAX EDGE AI+ review: local LLMs vs two 4090s
- MCPA WebMCP Chatbot That Drives the Website