AI Prompt Generator

From nuBuilderForte
Jump to navigation Jump to search

AI Prompt Generator is accessible via the Admin Tools icon. This tool streamlines your development workflow by automatically pulling in context from the form where it was launched. For example, if opened from Form Custom Code, the generator will preselect JavaScript as the language and set the scope to Custom Form. It also preloads the associated table name and schema (#7), making it even faster to generate relevant and context-aware AI prompts.

Prompt icon

Key Features

  • Automatic Table Schema Generation
 Select one or more tables (#7) and have their column definitions (including primary key info) pulled in for you.
  • Language-Specific Guidance
 Choose your target languages (#4) and get tailored notes on which helpers and conventions to use.
  • Scope-Aware Context
 Pick your execution context (#5) and receive prompts optimized for that environment.
  • Topic Refinement
 Optionally add Topics (#6) to refine your prompt—or click the magic wand (#14) for AI-suggested keywords.
  • One-Click Actions
 ** Copy Prompt (#10)  
    Copies your entered prompt (#3) plus the instructions (#9) and the assembled Extra Information (#9) to the clipboard so you can paste it into your favorite AI tool.  
 ** Ask AI (#12)  
    If your AI credentials are configured, sends the prompt directly and displays the result in the “API Response” tab (#10).
  • Save (#13)
 Optionally save the prompt and/or use it as a template.

Example: Generating a Prompt

  1. Fill in the Code field (#1) and an optional Description (#2), then enter your user-facing task in the Prompt box (#4).
  2. Select one or more Languages (#5) and Scopes (#6).
  3. Optionally refine with Topics (#7) or click the magic wand (#14) to have AI suggest them for you.
  4. Confirm which Tables (#8) to include—their schemas will appear in the Extra Information pane (#9).
  5. Click Copy Prompt (#11) to copy the full AI prompt (with schemas and helper notes), or click Ask AI (#12) to send it immediately and view the output in the “API Response” tab (#10). For the latter, configuration is required in nuconfig.php. Currently, only OpenAI is supported. You will need to create an OpenAI account and obtain an API key to use the service.
AI Prompt Generator interface

Hint: Enable the ‘search the web’ feature in your AI interface (such as ChatGPT, Grok, Claude, etc.) to allow it to access the nuBuilder wiki and retrieve up-to-date information about functions and their usage.

Instructions

  1. Launch via the Admin Tools icon.
  2. Fill in the Code field (#1) and optional Description (#2). (only required when saving)
  3. Review or edit the Instruction block (#3) to remind the AI of nuBuilder conventions.
  4. Enter your user-facing task in the Prompt box (#4).
  5. Select one or more programming Languages (#5).
  6. Choose the Scopes (#6) where the code will run.
  7. Refine with Topics (#7) or click the magic-wand (#14) to auto-suggest.
  8. Confirm which Tables (#8) to include—their schemas will load into Extra Information (#9).
  9. Click Copy Prompt (#11) to copy the assembled instructions + prompt + context, or Ask AI (#12) to send it immediately (requires OpenAI key in nuconfig.php).
  10. Optionally Save (#13) this form as a template.

Example AI response

function nuBeforeSave() {
    var code = nuGetValue('sfo_code');
    var status = nuGetValue('sfo_status');
    var allowedStatuses = ['A', 'I', 'S']; // Replace with actual allowed status codes
    if (!code || code.trim() === '') {
        nuMessage(['sfo_code cannot be blank.']);
        return false;
    }
    if (!allowedStatuses.includes(status)) {
        nuMessage(['sfo_status must be one of: ' + allowedStatuses.join(', ')]);
        return false;
    }
    return true;
}