zonde306/ST-Prompt-Template
Using Template Syntax (EJS) in Prompt
What it solves
It overcomes the limitations of simple text replacement in SillyTavern's macro system by allowing users to integrate complex logic, conditions, and variable management directly into AI prompts and character cards.
How it works
The extension integrates the EJS (Embedded JavaScript) templating engine into SillyTavern. It processes templates at two key stages: before the prompt is sent to the LLM (to dynamically construct the input) and after the LLM responds (to execute code within the output that can update variables or change display settings). It also provides a specialized API for interacting with SillyTavern's internal data, such as character and world info.
Who it’s for
Users of SillyTavern who want to create more sophisticated, responsive, and state-driven AI interactions through advanced scripting.
Highlights
- JavaScript Integration: Use full JS logic, loops, and conditions within prompts and character definitions.
- Two-Way Processing: Supports both dynamic prompt generation (pre-LLM) and dynamic chat rendering (post-LLM).
- Advanced Injection: Precise control over prompt structure via content injection tags and the
@INJECTsyntax for inserting messages at specific positions. - State Management: Support for global, local, and message-specific variables to persist data across sessions.
- SillyTavern API: Built-in functions like
getvar,setvar,getwi, andgetcharfor seamless data access.
Related
- Project
- Project
- Project
- Project
- Project