Skip to content

Commit bc8354f

Browse files
committed
refactor: remove ExplanationNode call from /generate10/json endpoint
1 parent 0336b85 commit bc8354f

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

api/main.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from api.nodes.new_pipeline.deduplicate_node import DeduplicateNode
3232
from api.nodes.new_pipeline.business_anchor_guard import BusinessAnchorGuard
3333
from api.nodes.new_pipeline.quota_enforce_node import QuotaEnforceNode
34-
from api.nodes.new_pipeline.explanation_node import ExplanationNode
34+
# ExplanationNode and tips removed
3535
from api.nodes.assets_node import AssetsNode
3636

3737
import logging
@@ -136,13 +136,11 @@ async def generate10_json(request: Request):
136136
anchored = BusinessAnchorGuard(unique_prompts, keyphrases)
137137
# Step 8: enforce quota
138138
final_prompts = QuotaEnforceNode(anchored, plan)
139-
# Step 9: explanations
140-
tips = ExplanationNode(final_prompts)
139+
# Step 9: skip explanations (tips removed)
141140
# Step 10: assets for branding
142141
assets = AssetsNode(url)
143142
return JSONResponse(content={
144143
"prompts": final_prompts,
145-
"tips": tips,
146144
"logo_url": assets.get('logo_url'),
147145
"palette": assets.get('palette', [])
148146
})
@@ -155,14 +153,13 @@ async def generate10_json(request: Request):
155153
@app.post("/generate10/pdf")
156154
async def generate10_pdf(request: Request):
157155
data = await request.json()
158-
prompts = data.get("prompts")
159-
tips = data.get("tips")
156+
prompts_by_cat = data.get("prompts")
160157
logo_url = data.get("logo_url")
161158
palette = data.get("palette", [])
162-
if not (isinstance(prompts, list) and isinstance(tips, list) and len(prompts) == len(tips)):
163-
raise HTTPException(status_code=400, detail="Invalid prompts or tips payload")
159+
if not isinstance(prompts_by_cat, dict):
160+
raise HTTPException(status_code=400, detail="Invalid prompts payload; expected object mapping categories to arrays")
164161
try:
165-
pdf_bytes = PdfBuilderNode(logo_url, palette, prompts, tips)
162+
pdf_bytes = PdfBuilderNode(logo_url, palette, prompts_by_cat)
166163
return StreamingResponse(
167164
io.BytesIO(pdf_bytes),
168165
media_type="application/pdf",

0 commit comments

Comments
 (0)