Eli 全球化與後端加固:48 小時開發紀錄
Soul in Motion — 6:33 PM | 2026-10-27
Eli 新增巴西、葡萄牙及拉丁美洲西班牙語地區的緊急求助熱線,並為 TTS 加入德語和波蘭語語音模型。後端新增每小時執行的網站健康檢查,並將支出上限和工作階段延遲記錄到資料庫,另設交易記錄及 PDF 收據生成。開發者亦調整 API 限流,以減少流量高峯時出現 429 錯誤。
TL;DR
- Added localized emergency helplines for Brazil, Portugal, and Latin America; voice models for German & Polish.
- Built an hourly “robot” to monitor the live site’s front door, ensuring security and responsiveness.
- Overhauled financial tracking: real‑time spending limits, session latency metrics, and auto‑generated printable receipts.
- Balanced intense debugging with media breaks (crime dramas, cricket highlights) to stay productive.
Going Global and Locking the Front Door: 48 Hours in the Trenches
Two days of nonstop code, configuration, and a dash of binge‑watching. Building a companion app from scratch forces you to juggle database tuning, UI polish, and the nitty‑gritty of production readiness. Below is a raw look at what that looks like behind the screen.
Prepping Eli for the World Stage
The first priority was making sure Eli could speak and help people in the places where help is most needed. I spent the bulk of the day:
-
Localized Emergency Support
- Integrated real‑world emergency helplines for Brazil, Portugal, and Spanish‑speaking Latin America.
- Stored the numbers in a
helplinestable withcountry_code,language, andnumbercolumns, exposing them via a simple REST endpoint.
-
Voice Models
- Added German and Polish voice models to the TTS pipeline.
- Updated the
voice_config.yamlto reference the new model IDs and adjusted thesynthesize_audiofunction to fall back to English if a locale is unsupported.
-
Recursive UX Feedback
- Ran Eli through the very UI we’re building for him.
- Logged widget placement suggestions and layout preferences directly from the LLM, then iterated on the design in Figma.
- This loop is a bit meta—Eli is both the product and the tester.
# voice_config.yaml
languages:
en: "tts-en"
de: "tts-de"
pl: "tts-pl"
Patrolling the Backend
With the frontend expanding, the backend had to keep pace. Two key changes:
-
Hourly Site‑Health Robot
- Deployed a Cloud Scheduler job that triggers a lightweight
health_checkscript every hour. - The script pings the front‑door endpoint, verifies TLS certs, and logs latency to Cloud Monitoring.
- Deployed a Cloud Scheduler job that triggers a lightweight
# health_check.sh
curl -s -o /dev/null -w "%{http_code}\n" https://live.example.com/health
-
Financial Tracking Overhaul
- Moved spending limits and session latencies into the database for atomicity.
- Added a
transactionstable withuser_id,amount,timestamp, andreceipt_generatedflag. - Triggered a receipt generation job that creates a PDF in the user’s workspace folder.
CREATE TABLE transactions (
id SERIAL PRIMARY KEY,
user_id INT NOT NULL,
amount NUMERIC(10,2) NOT NULL,
timestamp TIMESTAMP DEFAULT NOW(),
receipt_generated BOOLEAN DEFAULT FALSE
);
The result: real‑time accuracy, no accidental over‑spending, and a printable receipt for every user.
Cricket, Crime, and Cloud Billing
Debugging on Google Cloud can be a marathon. To keep my sanity:
-
Media Breaks
- Watched Manhunt and Under the Banner of Heaven for intense crime thrills.
- Balanced with nostalgic palate cleansers like Taare Zameen Par and old Rishi Kapoor interviews.
- During downtime, tuned into Cricbuzz highlights from the India vs. South Africa and West Indies vs. Bangladesh Champions matches—high‑energy distraction that kept my focus sharp.
-
Billing & Rate‑Limiting
- Monitored Cloud Billing dashboards for any sudden spikes.
- Adjusted rate‑limit scripts to throttle API calls during peak traffic, preventing 429 errors.
# rate_limit.yaml
max_requests_per_minute: 120
The Takeaway
Building this ecosystem is a grind, but seeing the pieces lock together—from global helplines to secure database limits—makes every late‑night session worth it. The backend is solid; tomorrow I’ll focus on making the frontend shine.
來源:DEV Community · dev.to