百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

ST-Prompt-Template

> 编程语言
开源

快速使用模板语法( EJS)

390 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

快速使用模板语法( EJS)

SillyTavern EJS Template Extension

This extension supercharges SillyTavern's macro system, enabling you to use full-fledged JavaScript within your prompts, character cards, and World Info. It leverages EJS (Embedded JavaScript templating) to bring dynamic logic, conditions, loops, and advanced variable management directly into your creative workflow.

Go beyond simple text replacement and create truly dynamic and responsive AI interactions.

中文文档

Core Features

  • Advanced Scripting: Use JavaScript logic (``) anywhere in your prompts, character definitions, or World Info entries.
  • Dynamic Prompt Generation: Process templates before sending them to the LLM. This allows for conditional text, variable insertion (``), and complex, on-the-fly prompt construction.
  • Dynamic Chat Rendering: Process templates in the LLM's response after it's received. This lets you run code from the AI's output to update variables or change how messages are displayed.
  • Powerful Prompt Injection: Gain precise control over the final prompt structure.
    • Content Injection: Use simple tags like [GENERATE:BEFORE] in a World Info entry's title to inject its content at the start or end of the prompt context.
    • Prompt Injection: Use the @INJECT syntax for fine-grained control, allowing you to insert entire messages ({role: 'system', content: '...'}) at absolute positions, relative to other messages, or based on regex matches.
  • Comprehensive API: A rich set of built-in functions (getvar, setvar, getwi, getchar) to interact with SillyTavern's data, manage state, and fetch content dynamically.
  • Scoped Variables: Manage state with global, local (chat-specific), and even message-specific variables that persist across sessions.
  • Full Compatibility: Works alongside SillyTavern's original macro syntax.

Basic Usage

Simply use EJS tags in any text field that gets sent to the LLM. The extension will process them at the appropriate time.

Example 1: Simple Output Display a variable's value in a character's prompt.

javascript
// In a World Info entry or character definition
Character's current affinity: 

Example 2: Conditional Logic Change the prompt based on a variable.

javascript
 50) { %>
You are my trusted friend.

I'm still wary of you.

Example 3: Updating Variables from LLM Output Let the LLM's response modify the character's state.

javascript
// LLM generates this message

Your kindness has been noted. My affinity for you has increased.
New affinity: 

The user will see the message with the updated affinity value, and the affinity variable will be saved for future interactions.

Installation

  1. In SillyTavern, navigate to the Extensions panel (the puzzle piece icon).
  2. Under Install extension, paste this repository's URL into the text field.
  3. Click Install for all users.
  4. Once installed, enable the Prompt Template extension from the list.

Documentation

For a complete guide to all features and advanced usage, please see:

  • features.md: A detailed description of all functionalities, including Content Injection, Prompt Injection, and settings.
  • reference.md: The full API reference for all available functions, variables, and libraries (_, faker, etc.).

License

This project is open-source and available under the AGPL-3.0 License.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言