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
df8d1e797c
commit
a35817c96d
@ -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,11 +1574,14 @@ 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
|
||||||
.replace("{YEAR}", String(year))
|
const title = (reqTitle && reqTitle.trim())
|
||||||
.replace("{SPEED}", speed || "400G/800G")
|
? reqTitle.trim()
|
||||||
.replace("{FORM_FACTOR}", form_factor || "QSFP-DD/OSFP")
|
: template.title
|
||||||
.replace("{USE_CASE}", use_case || "Data Center Interconnect");
|
.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 = [
|
const keywords = [
|
||||||
...template.seo_keywords,
|
...template.seo_keywords,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user