Skip to main content

Purpose and Responsibilities

  • Map refined_requirements to the four platforms: Website, Web Application, Android, iOS.
  • For each: description, cost_script (overwritten by UNIFIED_PRICE_SCRIPT), timeline_seconds, agents_required, fit_score, optional tech_stack.
  • Choose a recommended platform and set next_stage: "payment_processing".

Input/Output

Input

  • requirements: IntentRefinement["refined_requirements"] — From IntentAnalyzer.
  • sessionId: string — For logging.

Output (PlatformSelection in lib/openai.ts)

{
  status: "success";
  stage: "platform_selection";
  platform_options: Array<{
    platform: "Website" | "Web Application" | "Android" | "iOS";
    description: string;
    cost_script: number;   // overwritten by UNIFIED_PRICE_SCRIPT in handler
    timeline_seconds: number;
    agents_required: string[];
    fit_score: number;
    tech_stack?: { frontend, backend?, database?, hosting, additional? };
  }>;
  recommended: "Website" | "Web Application" | "Android" | "iOS";
  next_stage: "payment_processing";
}

Prompt Engineering

  • System: Describes each platform (Website, Web Application, Android, iOS) with stack, cost (UNIFIED_PRICE_SCRIPT), execution time range, and agents. Requires all four options and the exact JSON shape. Stresses that all platforms cost the same.
  • User: Session ID: ${sessionId}\n\nRequirements: ${JSON.stringify(requirements, null, 2)}
  • Options: response_format: { type: "json_object" }, temperature: 0.7. Model: DEFAULT_MODEL_TYPE.
After parsing, the handler replaces every cost_script with UNIFIED_PRICE_SCRIPT. Implementation: selectPlatform(requirements, sessionId, modelType?) in lib/openai.ts.

Examples

Input (refined_requirements)

{
  "title": "Habit Tracker",
  "description": "Web-first habit tracker with streaks and reminders.",
  "features": ["habit logging", "streaks", "push reminders"],
  "target_audience": "Individuals",
  "technical_requirements": ["Web first", "Push notifications"]
}
  • Four entries: Website, Web Application, Android, iOS.
  • cost_script normalized to e.g. 10000.
  • recommended e.g. "Web Application" when auth/DB and rich features are implied.

Customization Options

  • Model: Pass modelType to selectPlatform.
  • Platform list: To add a new platform (e.g. “Desktop”), extend the system prompt and PlatformType / getPlatformConfigByName in lib/platform-templates.ts and add a template.
  • Scoring: Adjust the system instructions for fit_score or add extra fields (e.g. rationale).