Skip to content
dsh.fish
Bundle

@dsh-external/dsh-sillytavern

SillyTavern feature port for DeepSeek Harness: character cards, world info (lorebook), and generation presets as prompt sections, runtime context, request overrides, and slash commands

Source
buhayi
License
MIT
Updated
Updated 3 days ago

Readme

# dsh-sillytavern

将 SillyTavern 的「角色卡」「世界书(lorebook)」与「生成预设」接入 DeepSeek Harness:角色卡进入系统提示词,世界书条目按关键词在每步注入为运行时上下文,生成预设的可移植采样字段应用到每个 agent 请求。全部通过斜杠命令管理,状态持久化到 `~/.dsh/sillytavern/state.json`。不新增任何模型可见的工具 schema。

蓝色大肥鱼写的喵,不好用我替你去压力蓝色大肥鱼喵

### 功能

- `sillytavern:character` 系统提示词 section(第 10 位,紧跟在 persona 之后):角色卡的名称、描述、性格、场景、系统提示、对话示例与开场白共同塑造 agent 的人设。
- `sillytavern:lorebook` 运行时上下文(第 50 位):常驻条目每步注入;关键词/次要关键词条目在匹配最近用户消息时注入。每步受 `maxInjectedEntries` / `maxInjectedChars` 限制。
- 生成预设:加载 SillyTavern「AI Response Configuration」JSON 后,把 `temperature`、`max_response_length`/`max_tokens`、`stopping_strings` 通过 `agent/request` waterfall 应用到每个 agent 请求;无法应用的字段会明确列出,绝不静默丢弃。

### 命令用法

#### `/character`

| 写法 | 作用 |
|---|---|
| `/character` | 查看当前已加载的角色卡(显示名字和标签数);没加载时会提示怎么加载 |
| `/character clear` | 清除已加载的角色卡 |
| `/character <路径>` | 加载一张角色卡 |

#### `/lorebook`

| 写法 | 作用 |
|---|---|
| `/lorebook` | 查看当前条目总数和所有关键词 |
| `/lorebook clear` | 清空全部条目 |
| `/lorebook load <路径>` | 从 JSON 文件追加导入条目 |
| `/lorebook add <关键词>::<内容>` | 手动新增一条条目 |
| `/lorebook remove <关键词>` | 按关键词删除条目(不区分大小写) |

#### `/preset`

| 写法 | 作用 |
|---|---|
| `/preset` | 查看当前已加载的预设及其应用/跳过的字段;没加载时会提示怎么加载 |
| `/preset load <路径>` | 加载一个 SillyTavern 生成预设 JSON |
| `/preset clear` | 停止应用预设,恢复 harness 默认采样参数 |

### 卡片格式

- `.json` 角色卡:SillyTavern V1(扁平)或 V2(`{ spec: "chara_card_v2", data: {…} }`)。
- PNG 角色卡:名为 `chara`(JSON)或 `ccv3`(base64 JSON)的 `tEXt` 数据块。
- 世界书文件:SillyTavern `{ "entries": { … } }` 或条目数组。

`{{char}}` / `{{user}}` 宏会被解析为角色名与 `User`;其余 `{{…}}` 占位符会被中和,避免严格提示词插值拒绝该提示词。

### 生成预设字段

| SillyTavern 预设字段 | Harness 字段 | 说明 |
|---|---|---|
| `temperature` | `LlmCallConfig.temperature` | 截断到 [0, 2](DeepSeek 兼容范围) |
| `max_response_length` / `max_tokens` | `LlmCallConfig.maxTokens` | `max_length`(上下文截断)无对应项,会在结果中列为跳过 |
| `stopping_strings` | `LlmCallConfig.stop` | 空字符串条目被丢弃 |

文件中的其余字段(`top_p`、`top_k`、`rep_pen`、`freq_pen`、`mirostat_*`、采样器顺序、`banned_strings`、`prompt_order` 等)都会在加载结果中列为跳过——绝不静默丢弃。

### 配置

| 字段 | 默认值 | 含义 |
|---|---|---|
| `stateFile` | `''` | JSON 状态文件;为空表示 `~/.dsh/sillytavern/state.json`(存角色卡、世界书与预设) |
| `scanDepth` | `4` | 世界书扫描器读取的最近用户消息数 |
| `maxInjectedEntries` | `8` | 每步注入的世界书条目数 |
| `maxInjectedChars` | `4000` | 每步注入的匹配条目总字符数 |

### 安装

```sh
# 在插件目录下执行,需设置 DSH_CHECKOUT 或插件位于 checkout 内:
npm run build
dsh plugin --profile web add .
```


Install

dsh plugin --profile web add github:buhayi/dsh-sillytavern#ec53571e30e019fb70aed5618aed96e3ddb2d5c7

Profile: web

  • This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
Source