Endpoint
Request Format
| Field | Type | Required | Description |
|---|---|---|---|
sessionId | string | Yes | From /api/idea response. |
answers | string[] | Yes | Answers to clarifying_questions (order preserved). |
idea | string | No | Fallback if workflow context was lost; used to recreate context. |
Example
Response Format
Success (200)
| Field | Type | Description |
|---|---|---|
status | "success" | |
stage | "intent_analysis" | |
refined_requirements | object | title, description, features[], target_audience, technical_requirements[]. |
next_stage | "platform_selection" |
Example
Error (4xx / 5xx)
| Field | Description |
|---|---|
status | "error" |
stage | "intent_analysis" |
error | Message. |
Error Codes
| HTTP | Cause |
|---|---|
| 400 | sessionId missing; answers missing, not array, or empty; context not found and no idea to recover. |
| 405 | Method not POST. |
| 500 | refineIntent (OpenRouter) or DB/write failure. |
Implementation Notes
- Uses
getWorkflowContextDB(thengetWorkflowContext) to load context. If missing andideais provided, creates/updates context withideaand then continues. - Calls
refineIntent(idea, answers, sessionId)fromlib/openai.ts(IntentAnalyzer). - Persists:
answers,refinedRequirements,currentStage: 'intent_analysis'.