web-app/lib/promptEngine

The SPA's browser-engine facade: wires the shared core/ engine to a loader that augments the bundled data with the user's browser-local custom expansions, and exposes generation, live preview, the categorized building blocks, and presets.

Description:
  • The SPA's browser-engine facade: wires the shared core/ engine to a loader that augments the bundled data with the user's browser-local custom expansions, and exposes generation, live preview, the categorized building blocks, and presets.

Source:

Methods

(static) expandPrompt(prompt, settings) → {string}

Description:
  • Expand a specific prompt (the live preview).

Source:
Parameters:
Name Type Description
prompt string

The prompt to expand.

settings object

The generation settings.

Returns:

The expanded prompt.

Type
string

(static) generatePrompt(settings) → {string}

Source:
Parameters:
Name Type Description
settings object

The generation settings.

Returns:

One generated prompt.

Type
string

(static) generatePrompts(settings) → {Array.<string>}

Source:
Parameters:
Name Type Description
settings object

The generation settings (promptCount).

Returns:

That many generated prompts.

Type
Array.<string>

(static) getBlocks() → {Array.<object>}

Source:
Returns:

The categorized building-block groups for the token cloud. The dynamic blocks (Blocks = v3 all; Full / Partial = frozen v1/v2) are dynVersioned and carry variants per generation; Expansions is a v1/v2-only legacy tab; then Lists + the browser-local custom blocks.

Type
Array.<object>

(static) getListNames() → {Array.<string>}

Source:
Returns:

The sorted list names.

Type
Array.<string>

(static) getPresetNames() → {Array.<string>}

Source:
Returns:

The sorted preset names (built-in + the user's custom presets).

Type
Array.<string>

(static) loadPreset(name) → {object}

Description:
  • Load a preset's settings (a custom preset shadows a built-in of the same name).

Source:
Parameters:
Name Type Description
name string

The preset name.

Returns:

The preset settings (or {} if unknown).

Type
object

(static) renderWrapperPart(text, settingsopt) → {string}

Description:
  • Render one wrapper box (a DPL snippet — the user can use bullets/probability) into a flat token string. Tokens it emits ({#…}, {list}, ) are resolved later by the generation pipeline.

Source:
Parameters:
Name Type Attributes Description
text string

The wrapper box's DPL text.

settings object <optional>

The generation settings (passed to any JS the snippet calls).

Returns:

The rendered token string (or "" when blank).

Type
string

(inner) withChaos(settings) → {object}

Description:
  • Scale the emphasis / alternating knobs by settings.chaos (mirrors the CLI --chaos).

Source:
Parameters:
Name Type Description
settings object

The generation settings.

Returns:

The (possibly) chaos-scaled settings.

Type
object