fix: preserve user-provided title in blog generation + price floor validation

- blog/generate now uses caller title when provided; falls back to template
- Migration 027: hard price floor by speed class in verification function
  (no medians, no estimates — only real prices above minimum thresholds)
- Deleted 474 obviously wrong price observations (shipping costs scraped as prices)
This commit is contained in:
Rene Fichtmueller 2026-04-06 01:14:37 +02:00
parent a8faf3798b
commit 1ac03bae0a

View File

@ -1550,7 +1550,8 @@ async function runLlmPipeline(
// POST /api/blog/generate — Generate a new blog draft (returns immediately, LLM runs async) // POST /api/blog/generate — Generate a new blog draft (returns immediately, LLM runs async)
blogRouter.post("/generate", async (req: Request, res: Response) => { blogRouter.post("/generate", async (req: Request, res: Response) => {
const { topic, speed, form_factor, use_case, use_llm } = req.body as { const { title: reqTitle, topic, speed, form_factor, use_case, use_llm } = req.body as {
title?: string;
topic?: string; topic?: string;
speed?: string; speed?: string;
form_factor?: string; form_factor?: string;
@ -1573,7 +1574,10 @@ blogRouter.post("/generate", async (req: Request, res: Response) => {
const year = new Date().getFullYear(); const year = new Date().getFullYear();
const template = templates[Math.floor(Math.random() * templates.length)]; const template = templates[Math.floor(Math.random() * templates.length)];
const title = template.title // Use caller-provided title if given; fall back to template title
const title = (reqTitle && reqTitle.trim())
? reqTitle.trim()
: template.title
.replace("{YEAR}", String(year)) .replace("{YEAR}", String(year))
.replace("{SPEED}", speed || "400G/800G") .replace("{SPEED}", speed || "400G/800G")
.replace("{FORM_FACTOR}", form_factor || "QSFP-DD/OSFP") .replace("{FORM_FACTOR}", form_factor || "QSFP-DD/OSFP")