建置階段的 AI:我們如何在沒有伺服器的情況下,跨 8 種語言驗證 5,000 多項價格
Build-Time AI: How We Validate 5,000 Prices Across 8 Languages Without a Server
摩洛哥接送預訂網站 navetteforyou.com 建立 AI 輔助的建置時價格驗證流程,在部署前檢查 8 種語言的價格,並阻止低於最低價格的版本上線。流程核對了 641 個頁面的 17,113 項金額,沒有價格錯誤進入正式環境,建置時間增加約 4 秒;價格檢查使用模式比對,而非 LLM 推理。
The problem
We run a transport booking site in Morocco — navetteforyou.com. Eight languages, 641 pages, thousands of prices. One wrong number and a customer books a ride expecting 300 MAD when it costs 600.
Manual QA across 5,000+ price points in eight languages is not viable. So we built an AI-assisted build-time validation pipeline.
The pipeline
Every deployment runs three checks before it goes live:
1. Static price extraction
A TypeScript script crawls every generated HTML page and extracts anything that looks like a price: numbers followed by MAD, €, or other currency markers, plus any structured data (JSON-LD offers).
2. Floor price enforcement
Every extracted price is compared against a floor. If any price drops below the minimum — even by one dirham — the build fails. No deploy, no exception.
641 pages × 8 languages
17,113 amounts checked
PASS: no amount under 600 MAD
3. Cross-language consistency
If the English page says a route costs 800 MAD but the French page says 700 MAD, that is a bug. The pipeline flags cross-language price mismatches as warnings.
Why build-time, not runtime
Runtime validation means the error is already live. Build-time validation means the error never ships. The CI pipeline is the last gate before production — if prices are wrong, the deploy is blocked.
This matters more for small businesses than large ones. A large OTA has a customer service team to handle pricing errors. We have five cars and a WhatsApp number.
The AI component
Where does AI fit in? Three places:
Translation draft generation: AI generates initial translations for new content. Human reviewers approve. This is where most cross-language pricing bugs would originate — a model might translate "starting from 800 MAD" as "à partir de 600 MAD" if not constrained.
Structured data generation: AI extracts Schema.org markup from natural-language descriptions. Morocco has no standardized address system, so "the riad near the blue gate in the medina" needs to become machine-readable.
Content validation: The price check script itself uses pattern matching, not LLM inference. But the patterns it validates were originally defined with AI assistance — identifying all the ways a price might appear across eight languages.
Results
Since deploying the pipeline:
- Zero pricing errors have reached production
- Build time added: ~4 seconds
- False positives: 0 (the patterns are deterministic)
The takeaway
AI in production does not have to mean chatbots or recommendation engines. Sometimes it means a 200-line TypeScript script that runs at build time and catches the mistake that would cost you a customer.
navetteforyou.com — Private airport transfers and day trips across Morocco. WhatsApp: +212 701 664 704
來源:DEV Community · dev.to