触发 Slash Command
我们可以在嵌入的 iframe 中执行 SillyTavern 内部的 Slash 命令 (斜杠命令), 如 /run
、/echo
等。
参考
你可以在这些地方查看SillyTavern的全部 Slash(快速回复) 命令:
- 在 SillyTavern 消息发送框中输入并发送
/help slash
- 点击酒馆助手扩展界面右上角的
编写参考-酒馆命令
- 查看SillyTavern 脚本命令自查手册
triggerSlash
运行 Slash 命令, 注意如果命令写错了将不会有任何反馈。
typescript
async function triggerSlash(command: string): Promise<string>;
参数
command
要运行的 Slash 命令
返回值
- Slash 管道结果: 如果命令出错或执行了
/abort
则返回undefined
示例
typescript
await triggerSlash('/echo hello!');
typescript
const last_message_id = await triggerSlash('/pass {{lastMessageId}}');