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:
parent
a8faf3798b
commit
1ac03bae0a
@ -1550,7 +1550,8 @@ async function runLlmPipeline(
|
||||
|
||||
// POST /api/blog/generate — Generate a new blog draft (returns immediately, LLM runs async)
|
||||
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;
|
||||
speed?: string;
|
||||
form_factor?: string;
|
||||
@ -1573,11 +1574,14 @@ blogRouter.post("/generate", async (req: Request, res: Response) => {
|
||||
const year = new Date().getFullYear();
|
||||
const template = templates[Math.floor(Math.random() * templates.length)];
|
||||
|
||||
const title = template.title
|
||||
.replace("{YEAR}", String(year))
|
||||
.replace("{SPEED}", speed || "400G/800G")
|
||||
.replace("{FORM_FACTOR}", form_factor || "QSFP-DD/OSFP")
|
||||
.replace("{USE_CASE}", use_case || "Data Center Interconnect");
|
||||
// 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("{SPEED}", speed || "400G/800G")
|
||||
.replace("{FORM_FACTOR}", form_factor || "QSFP-DD/OSFP")
|
||||
.replace("{USE_CASE}", use_case || "Data Center Interconnect");
|
||||
|
||||
const keywords = [
|
||||
...template.seo_keywords,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user