触发 Slash Command
提示
请务必先阅读如何正确使用酒馆助手
我们可以在嵌入的 iframe 中执行 SillyTavern 内部的 Slash 命令 (斜杠命令), 如 /run
、/echo
等。 点击查看对应类型定义文件(可发给AI或IDE使用,酒馆助手设置中提供了打包下载)
参考
你可以在这些地方查看SillyTavern的全部 Slash(快速回复) 命令:
- 在 SillyTavern 消息发送框中输入并发送
/help slash
- 点击酒馆助手扩展界面右上角的
编写参考-酒馆命令
- 查看SillyTavern 脚本命令自查手册
triggerSlash
运行 Slash 命令, 注意如果命令写错了将不会有任何反馈。
typescript
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}}');