├── Dockerfile └── README.md /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:lts-alpine3.19 2 | 3 | # Arguments 4 | ARG APP_HOME=/home/node/app 5 | ARG PLUGINS="" # Comma-separated list of plugin git URLs 6 | 7 | # Install system dependencies 8 | # Add unzip for extracting the application code 9 | # Keep git for potential use by scripts or future plugin updates 10 | # Add wget to download the zip file 11 | # Add curl for health checks and keep-alive 12 | RUN apk add --no-cache gcompat tini git unzip wget curl 13 | 14 | # Create app directory 15 | WORKDIR ${APP_HOME} 16 | 17 | # Set NODE_ENV to production 18 | ENV NODE_ENV=production 19 | 20 | # --- BEGIN: Clone SillyTavern Core from GitHub (staging branch) --- 21 | RUN \ 22 | echo "*** Cloning SillyTavern Core from GitHub (staging branch) ***" && \ 23 | # Clone the specific branch into the current directory 24 | git clone -b staging --depth 1 https://github.com/SillyTavern/SillyTavern.git . && \ 25 | echo "*** Cloning complete. ***" 26 | # --- END: Clone SillyTavern Core --- 27 | 28 | # --- BEGIN: Remove root .gitignore if exists --- 29 | RUN \ 30 | echo "*** Attempting to remove root .gitignore if it exists ***" && \ 31 | rm -f .gitignore && \ 32 | echo "*** Root .gitignore removed (if it existed). ***" 33 | # --- END: Remove root .gitignore --- 34 | 35 | # Install base SillyTavern dependencies (package*.json should be in the cloned root) 36 | RUN \ 37 | echo "*** Install Base npm packages ***" && \ 38 | if [ -f package.json ]; then \ 39 | # Added --force to potentially overcome file system issues in docker/overlayfs 40 | npm i --no-audit --no-fund --loglevel=error --no-progress --omit=dev --force && npm cache clean --force; \ 41 | else \ 42 | echo "No package.json found in root, skipping base npm install."; \ 43 | fi 44 | 45 | # Go back to the main app directory (redundant but safe) 46 | WORKDIR ${APP_HOME} 47 | 48 | # Create config directory. config.yaml will be handled at runtime by ENTRYPOINT 49 | RUN mkdir -p config 50 | 51 | # Pre-compile public libraries (build-lib.js should be in the unzipped structure) 52 | RUN \ 53 | echo "*** Run Webpack ***" && \ 54 | # Check if build-lib.js exists before running 55 | if [ -f "./docker/build-lib.js" ]; then \ 56 | node "./docker/build-lib.js"; \ 57 | elif [ -f "./build-lib.js" ]; then \ 58 | node "./build-lib.js"; \ 59 | else \ 60 | echo "build-lib.js not found, skipping Webpack build."; \ 61 | fi 62 | 63 | # Cleanup unnecessary files (like the docker dir if it exists in the zip) and make entrypoint executable 64 | # This block is removed as we no longer use docker-entrypoint.sh 65 | # RUN \ 66 | # echo "*** Cleanup and Permissions ***" && \ 67 | # ... 68 | 69 | # Fix potential git safe.directory issues if git commands are run later by scripts 70 | RUN git config --global --add safe.directory "${APP_HOME}" 71 | 72 | # Ensure the node user owns the application directory and its contents 73 | RUN chown -R node:node ${APP_HOME} 74 | 75 | # Download the health check script from GitHub and place it in the app directory 76 | RUN git clone --depth 1 https://github.com/fuwei99/docker-health.sh.git /tmp/health_repo && \ 77 | cp /tmp/health_repo/health.sh ${APP_HOME}/health.sh && \ 78 | rm -rf /tmp/health_repo 79 | 80 | # Make the downloaded script executable 81 | RUN chmod +x ${APP_HOME}/health.sh 82 | 83 | EXPOSE 8000 84 | 85 | # Entrypoint: Execute the health check and startup script 86 | ENTRYPOINT ["tini", "--", "/home/node/app/health.sh"] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SillyTavern Docker & HF部署 3 | emoji: 🥂 4 | colorFrom: pink 5 | colorTo: blue 6 | sdk: docker 7 | pinned: false 8 | app_port: 8000 # SillyTavern 默认端口 9 | # 定义所需的 Hugging Face Secrets 10 | secrets: 11 | - name: CONFIG_YAML 12 | description: "你的 config.yaml 文件内容(无注释)" 13 | required: true # 配置是必需的 14 | - name: PLUGINS 15 | description: "要安装的插件Git URL列表(逗号分隔)" 16 | required: false # 插件是可选的 17 | - name: EXTENSIONS 18 | description: "要安装的扩展Git URL列表(逗号分隔)" 19 | required: false # 扩展是可选的 20 | - name: INSTALL_FOR_ALL_USERS 21 | description: "扩展安装模式:true为系统级安装,false或其他值为用户级安装" 22 | required: false # 扩展安装模式是可选的 23 | - name: REPO_URL 24 | description: "cloud-saves插件的GitHub仓库URL(用于自动配置)" 25 | required: false # cloud-saves自动配置是可选的 26 | - name: GITHUB_TOKEN 27 | description: "GitHub访问令牌(用于cloud-saves插件自动配置)" 28 | required: false # cloud-saves自动配置是可选的 29 | - name: AUTOSAVE_INTERVAL 30 | description: "cloud-saves插件自动保存间隔(秒)" 31 | required: false # cloud-saves自动保存配置是可选的 32 | - name: AUTOSAVE_TARGET_TAG 33 | description: "cloud-saves插件自动保存目标标签" 34 | required: false # cloud-saves自动保存配置是可选的 35 | --- 36 | 37 | # 最简单的方法:一键部署 38 | ## 注意部署界面那个visibility一定要改为public,不然没办法用 39 | 40 | 如果你不想手动配置,可以直接点击下方按钮,一键将 SillyTavern Docker 部署到你自己的 Hugging Face Space 中(需要先注册 Hugging Face 账号): 41 | 42 | [![部署到 Hugging Face Spaces](https://huggingface.co/datasets/huggingface/badges/resolve/main/deploy-to-spaces-lg.svg)](https://huggingface.co/spaces/malt666/Tavern-Docker?duplicate=true) 43 | 44 | 点击按钮后,按照下面的格式配置环境变量即可: 45 | 46 | PLUGINS:https://github.com/fuwei99/cloud-saves.git 47 | (填写云备份插件链接) 48 | 49 | CONFIG_YAML:见下方命令行复制,记得改用户名和密码,另外由于hugging face的duplicate(部署)界面有bug,复制下来的也会变成一行,所以只能进入界面之后,在setting下面找到secrets,点击CONFIG_YAML旁边的replace,重新复制粘贴一遍到value那里,这样应该就可以了。 50 | 51 | EXTENSIONS:https://github.com/N0VI028/JS-Slash-Runner,https://gitee.com/muyoou/st-memory-enhancement 52 | (填写扩展链接,比如酒馆助手,增强记忆插件,用英语逗号隔开) 53 | 54 | INSTALL_FOR_ALL_USERS:true 55 | (设置为false会安装到default-user,设置为true会安装到全局,不填写默认安装到default-user,推荐设置为true) 56 | 57 | --- 58 | 59 | 以下是可选secret: 60 | 61 | REPO_URL:https://github.com/yourusername/yourrepo(填写你的 GitHub 仓库地址,用于 cloud-saves 插件自动配置) 62 | 63 | GITHUB_TOKEN:ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(填写你的 GitHub 访问令牌,用于 cloud-saves 插件自动配置) 64 | 65 | AUTOSAVE_INTERVAL:30(填写自动保存间隔秒数,不填写默认为30秒) 66 | 67 | AUTOSAVE_TARGET_TAG:auto-backup(填写自动保存目标标签,不填写默认为空) 68 | 69 | 70 | ## 如何读取或者保存存档 71 | 72 | 教程见: https://github.com/fuwei99/cloud-saves 73 | 74 | * 对于推荐安装的 `cloud-saves` 插件,其管理界面通常位于: 75 | `http://<你的SillyTavern访问地址>/api/plugins/cloud-saves/ui` 76 | 例如,如果是本地部署,则为 `http://127.0.0.1:8000/api/plugins/cloud-saves/ui`。如果是 Hugging Face Space,则将 `<你的SillyTavern访问地址>` 替换为你的 Space 公共 URL 77 | 78 | 其他插件的访问路径请参考其各自的文档。 79 | 80 | 81 | --- 82 | 83 | # SillyTavern Docker 与 Hugging Face 部署指南 84 | 85 | 本指南说明了如何使用提供的 `Dockerfile` 来构建和运行 SillyTavern,以及如何在 Hugging Face Spaces 上进行部署。部署的核心思想是通过环境变量在容器启动时动态配置 SillyTavern 和安装插件。 86 | 87 | ## 关键文件 88 | 89 | * `Dockerfile`: 用于构建 SillyTavern 运行环境的 Docker 镜像。它会: 90 | * 基于官方 Node.js Alpine 镜像。 91 | * 安装必要的系统依赖(如 `git`)。 92 | * 从 GitHub 克隆 SillyTavern 的 `staging` 分支代码。 93 | * 设置工作目录和用户权限。 94 | * 定义容器启动时的 `ENTRYPOINT` 脚本,该脚本负责: 95 | * 读取 `CONFIG_YAML` 环境变量并写入 `./config.yaml` 文件。 96 | * 读取 `PLUGINS` 环境变量,并克隆、安装指定的插件。 97 | * 启动 SillyTavern 服务器 (`node server.js`)。 98 | * `README.md`: 本说明文件。 99 | 100 | ## 配置方式:环境变量 101 | 102 | 我们通过两个主要的环境变量来配置容器: 103 | 104 | 1. `CONFIG_YAML`: **必需**。 105 | * **作用**: 定义 SillyTavern 的运行配置。 106 | * **内容**: 下面是推荐的默认配置内容。你可以直接复制粘贴使用,但**强烈建议你修改其中的认证信息**。 107 | * **推荐配置内容**: 108 | ```yaml 109 | dataRoot: ./data 110 | listen: true 111 | listenAddress: 112 | ipv4: 0.0.0.0 113 | ipv6: '[::]' 114 | protocol: 115 | ipv4: true 116 | ipv6: false 117 | dnsPreferIPv6: false 118 | autorunHostname: "auto" 119 | port: 8000 120 | autorunPortOverride: -1 121 | ssl: 122 | enabled: false 123 | certPath: "./certs/cert.pem" 124 | keyPath: "./certs/privkey.pem" 125 | whitelistMode: false 126 | enableForwardedWhitelist: false 127 | whitelist: 128 | - ::1 129 | - 127.0.0.1 130 | whitelistDockerHosts: true 131 | basicAuthMode: true 132 | basicAuthUser: 133 | username: "用户名" # 请务必修改为你自己的用户名 134 | password: "密码" # 请务必修改为你自己的密码 135 | enableCorsProxy: false 136 | requestProxy: 137 | enabled: false 138 | url: "socks5://username:password@example.com:1080" 139 | bypass: 140 | - localhost 141 | - 127.0.0.1 142 | enableUserAccounts: false 143 | enableDiscreetLogin: false 144 | autheliaAuth: false 145 | perUserBasicAuth: false 146 | sessionTimeout: -1 147 | disableCsrfProtection: false 148 | securityOverride: false 149 | logging: 150 | enableAccessLog: true 151 | minLogLevel: 0 152 | rateLimiting: 153 | preferRealIpHeader: false 154 | autorun: false 155 | avoidLocalhost: false 156 | backups: 157 | common: 158 | numberOfBackups: 50 159 | chat: 160 | enabled: true 161 | checkIntegrity: true 162 | maxTotalBackups: -1 163 | throttleInterval: 10000 164 | thumbnails: 165 | enabled: true 166 | format: "jpg" 167 | quality: 95 168 | dimensions: { 'bg': [160, 90], 'avatar': [96, 144] } 169 | performance: 170 | lazyLoadCharacters: false 171 | memoryCacheCapacity: '100mb' 172 | useDiskCache: true 173 | allowKeysExposure: true 174 | skipContentCheck: false 175 | whitelistImportDomains: 176 | - localhost 177 | - cdn.discordapp.com 178 | - files.catbox.moe 179 | - raw.githubusercontent.com 180 | requestOverrides: [] 181 | extensions: 182 | enabled: true 183 | autoUpdate: false 184 | models: 185 | autoDownload: true 186 | classification: Cohee/distilbert-base-uncased-go-emotions-onnx 187 | captioning: Xenova/vit-gpt2-image-captioning 188 | embedding: Cohee/jina-embeddings-v2-base-en 189 | speechToText: Xenova/whisper-small 190 | textToSpeech: Xenova/speecht5_tts 191 | enableDownloadableTokenizers: true 192 | promptPlaceholder: "[Start a new chat]" 193 | openai: 194 | randomizeUserId: false 195 | captionSystemPrompt: "" 196 | deepl: 197 | formality: default 198 | mistral: 199 | enablePrefix: false 200 | ollama: 201 | keepAlive: -1 202 | batchSize: -1 203 | claude: 204 | enableSystemPromptCache: false 205 | cachingAtDepth: -1 206 | enableServerPlugins: true 207 | enableServerPluginsAutoUpdate: false 208 | ``` 209 | * **⚠️ 重要警告**: 请务必修改上方配置中 `basicAuthUser` 下的 `username` 和 `password` 为你自己的凭据,以确保安全!**不要使用默认的 "用户名" 和 "密码"!** 210 | * **注意**: 必须是有效的 YAML 格式,且**不应包含任何 `#` 开头的注释行**。 211 | 212 | 2. `PLUGINS`: **可选**。 213 | * **作用**: 指定需要在容器启动时自动安装的 SillyTavern 插件。 214 | * **内容**: 一个**逗号分隔**的插件 Git 仓库 URL 列表。 215 | * **推荐安装**: 强烈建议安装 `cloud-saves` 插件,以便在不同部署环境(如本地和 Hugging Face)之间同步数据。 216 | * **插件地址**: `https://github.com/fuwei99/cloud-saves.git` 217 | * **重要前置条件**: 为了让容器/Hugging Face Space 能够拉取你的存档,你**必须**先在你本地的 SillyTavern 中安装好 `cloud-saves` 插件,并**至少进行一次数据存档操作**。这样,远程部署的环境才能通过该插件下载你的存档。 218 | * **格式示例**: `https://github.com/fuwei99/cloud-saves.git` (注意包含推荐的 cloud-saves 插件) 219 | * **注意**: URL 之间**只能用英文逗号 `,` 分隔**,且逗号前后**不能有空格**。如果留空或不提供此变量,则不会安装额外插件。 220 | 221 | 3. `EXTENSIONS`: **可选**。 222 | * **作用**: 指定需要在容器启动时自动安装的 SillyTavern 扩展(Extensions)。 223 | * **内容**: 一个**逗号分隔**的扩展 Git 仓库 URL 列表。 224 | * **安装时机**: 扩展会在项目启动之后自动安装,确保 SillyTavern 目录结构已经准备完毕。 225 | * **格式示例**: `https://github.com/user1/extension1.git,https://github.com/user2/extension2.git` 226 | * **注意**: URL 之间**只能用英文逗号 `,` 分隔**,且逗号前后**不能有空格**。如果留空或不提供此变量,则不会安装额外扩展。 227 | 228 | 4. `INSTALL_FOR_ALL_USERS`: **可选**。 229 | * **作用**: 控制扩展的安装位置模式。 230 | * **可选值**: 231 | * `true`: 扩展安装到 `public/scripts/extensions/third-party` 目录下,对**所有用户**生效(系统级安装)。 232 | * `false` 或任何其他值,或变量不存在: 扩展安装到 `data/default-user/extensions` 目录下,仅对**默认用户**生效(用户级安装)。 233 | * **默认行为**: 如果不设置此环境变量,默认安装到用户级目录。 234 | * **格式示例**: `true` 或 `false` 235 | 236 | 5. `REPO_URL`: **可选**。 237 | * **作用**: 为 cloud-saves 插件提供 GitHub 仓库 URL,用于自动配置插件。 238 | * **前置条件**: 需要同时安装 cloud-saves 插件(通过 `PLUGINS` 环境变量)。 239 | * **格式示例**: `https://github.com/yourusername/yourrepo` 240 | * **说明**: 这是你用来存储 SillyTavern 数据备份的 GitHub 仓库地址。 241 | 242 | 6. `GITHUB_TOKEN`: **可选**。 243 | * **作用**: 为 cloud-saves 插件提供 GitHub 访问令牌,用于自动配置插件。 244 | * **前置条件**: 需要同时设置 `REPO_URL` 和安装 cloud-saves 插件。 245 | * **格式示例**: `ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` 246 | * **获取方式**: 在 GitHub Settings -> Developer settings -> Personal access tokens -> Tokens (classic) 中创建,需要 `repo` 权限。 247 | * **自动配置**: 如果同时提供了 `REPO_URL` 和 `GITHUB_TOKEN`,且安装了 cloud-saves 插件,系统会自动创建插件的配置文件。 248 | 249 | 7. `AUTOSAVE_INTERVAL`: **可选**。 250 | * **作用**: 设置 cloud-saves 插件的自动保存间隔时间(秒)。 251 | * **前置条件**: 需要同时设置 `REPO_URL` 和 `GITHUB_TOKEN`。 252 | * **格式示例**: `30`(表示每30秒自动保存一次) 253 | * **默认值**: 如果不设置,默认为 `30` 秒。 254 | 255 | 8. `AUTOSAVE_TARGET_TAG`: **可选**。 256 | * **作用**: 设置 cloud-saves 插件的自动保存目标标签。 257 | * **前置条件**: 需要同时设置 `REPO_URL` 和 `GITHUB_TOKEN`。 258 | * **格式示例**: `auto-backup` 或 `daily-save` 259 | * **默认值**: 如果不设置,默认为空字符串。 260 | 261 | ## 方法一:本地 Docker 部署 262 | 263 | 你可以在本地使用 Docker 来构建和运行 SillyTavern。 264 | 265 | 1. **构建镜像**: 在包含 `Dockerfile` 的目录下,运行: 266 | ```bash 267 | docker build -t sillytavern-local . 268 | ``` 269 | 将 `sillytavern-local` 替换为你想要的镜像名称。 270 | 271 | 2. **准备配置**: 将你的 `config.yaml` 内容(无注释)准备好。 272 | 273 | 3. **运行容器**: 使用 `docker run` 命令,并通过 `-e` 参数传递环境变量。 274 | * 将上方提供的**推荐配置内容**复制,并作为 `CONFIG_YAML` 环境变量的值。**确保你已经修改了其中的用户名和密码!** 275 | * 如果你需要安装插件(**推荐安装 `cloud-saves`**),请准备好插件 URL 列表。 276 | 277 | ```bash 278 | # 示例:使用推荐配置并安装 cloud-saves 插件 279 | # 1. 将推荐配置(修改密码后)保存到名为 config_no_comments.yaml 的文件中 280 | # 2. 运行以下命令 281 | 282 | docker run -p 8000:8000 --name my-sillytavern \\ 283 | -e CONFIG_YAML="$(cat config_no_comments.yaml)" \\ 284 | -e PLUGINS='https://github.com/fuwei99/cloud-saves.git' \\ 285 | -e EXTENSIONS='https://github.com/user1/extension1.git,https://github.com/user2/extension2.git' \\ 286 | -e INSTALL_FOR_ALL_USERS=false \\ 287 | -e REPO_URL='https://github.com/yourusername/yourrepo' \\ 288 | -e GITHUB_TOKEN='ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \\ 289 | -e AUTOSAVE_INTERVAL=30 \\ 290 | -e AUTOSAVE_TARGET_TAG=auto-backup \\ 291 | sillytavern-local 292 | 293 | # 如果你需要安装更多插件,用逗号隔开添加到 PLUGINS 变量中 294 | # 例如: 295 | # docker run -p 8000:8000 --name my-sillytavern \ 296 | # -e CONFIG_YAML="$(cat config_no_comments.yaml)" \ 297 | # -e PLUGINS='https://github.com/fuwei99/cloud-saves.git,https://github.com/user/other-plugin.git' \ 298 | # -e EXTENSIONS='https://github.com/user1/extension1.git,https://github.com/user2/extension2.git' \ 299 | # -e INSTALL_FOR_ALL_USERS=false \ 300 | # -e REPO_URL='https://github.com/yourusername/yourrepo' \ 301 | # -e GITHUB_TOKEN='ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \ 302 | # -e AUTOSAVE_INTERVAL=30 \ 303 | # -e AUTOSAVE_TARGET_TAG=auto-backup \ 304 | # sillytavern-local 305 | ``` 306 | * `-p 8000:8000`: 将容器的 8000 端口映射到宿主机的 8000 端口。 307 | * `--name my-sillytavern`: 为容器命名,方便管理。 308 | * `-e CONFIG_YAML="$(cat config_no_comments.yaml)"`: 从文件读取配置内容并传递。这是处理多行 YAML 最可靠的方式。**再次确认:运行前务必修改 `config_no_comments.yaml` 文件中的用户名和密码!** 309 | * `-e PLUGINS='...'`: 传递插件列表,这里以安装 `cloud-saves` 为例。 310 | * `-e EXTENSIONS='...'`: 传递扩展列表,这里以安装 `extension1` 和 `extension2` 为例。 311 | * `-e INSTALL_FOR_ALL_USERS=false`: 设置扩展安装模式为用户级安装。 312 | * `-e REPO_URL='...'`: 传递 REPO_URL 环境变量。 313 | * `-e GITHUB_TOKEN='...'`: 传递 GITHUB_TOKEN 环境变量。 314 | * `-e AUTOSAVE_INTERVAL=30`: 设置 AUTOSAVE_INTERVAL 环境变量。 315 | * `-e AUTOSAVE_TARGET_TAG=auto-backup`: 设置 AUTOSAVE_TARGET_TAG 环境变量。 316 | 317 | 4. **访问**: 打开浏览器访问 `http://localhost:8000`。 318 | 319 | ## 方法二:Hugging Face Spaces 部署 320 | 321 | 这是推荐的在线部署方式,利用 Hugging Face 的免费计算资源和 Secrets 管理功能。 322 | 323 | 1. **创建 Space**: 在 Hugging Face 上创建一个新的 Space,选择 **Docker** SDK。 324 | 325 | 2. **上传文件**: 将本项目中的 `Dockerfile` 和 `README.md` 文件上传到你的 Space 仓库根目录。 326 | 327 | 3. **配置 Secrets**: 进入你的 Space 页面的 **Settings -> Secrets** 部分。 328 | * **添加 `CONFIG_YAML` Secret**: 329 | * 点击 "New secret"。 330 | * 名称 (Name) 输入: `CONFIG_YAML` 331 | * 值 (Value) 粘贴: **复制上方提供的推荐配置内容**。**再次强调:粘贴前请务必修改 `basicAuthUser` 下的 `username` 和 `password` 为你自己的安全凭据!** 332 | * 点击 "Add secret"。 333 | * **(推荐) 添加 `PLUGINS` Secret**: 334 | * 再次点击 "New secret"。 335 | * 名称 (Name) 输入: `PLUGINS` 336 | * 值 (Value) 粘贴: 推荐至少包含 `cloud-saves` 插件。例如:`https://github.com/fuwei99/cloud-saves.git`。如果你需要其他插件,用逗号隔开添加,例如:`https://github.com/fuwei99/cloud-saves.git,https://github.com/user/other-plugin.git`。 337 | * **重要提醒**: 请确保你已经在本地 SillyTavern 安装了 `cloud-saves` 并至少进行了一次存档。 338 | * 点击 "Add secret"。如果你确实不需要任何额外插件,可以跳过这一步。 339 | 340 | * **(可选) 添加 `EXTENSIONS` Secret**: 341 | * 再次点击 "New secret"。 342 | * 名称 (Name) 输入: `EXTENSIONS` 343 | * 值 (Value) 粘贴: 你需要安装的扩展 Git URL 列表,用逗号隔开。例如:`https://github.com/user1/extension1.git,https://github.com/user2/extension2.git`。 344 | * 点击 "Add secret"。如果你不需要安装扩展,可以跳过这一步。 345 | 346 | * **(可选) 添加 `INSTALL_FOR_ALL_USERS` Secret**: 347 | * 如果你添加了 `EXTENSIONS` Secret,可以继续添加这个 Secret 来控制扩展安装模式。 348 | * 再次点击 "New secret"。 349 | * 名称 (Name) 输入: `INSTALL_FOR_ALL_USERS` 350 | * 值 (Value) 输入: `true`(系统级安装,所有用户可用)或 `false`(用户级安装,仅默认用户可用)。 351 | * **推荐**: 对于 Hugging Face Space 单用户环境,建议设置为 `false` 或不设置此 Secret。 352 | * 点击 "Add secret"。如果不设置,默认为用户级安装。 353 | 354 | * **(可选) 添加 `REPO_URL` Secret**: 355 | * 再次点击 "New secret"。 356 | * 名称 (Name) 输入: `REPO_URL` 357 | * 值 (Value) 输入: 你的 GitHub 仓库地址,用于 cloud-saves 插件自动配置。例如:`https://github.com/yourusername/yourrepo` 358 | * 点击 "Add secret"。 359 | 360 | * **(可选) 添加 `GITHUB_TOKEN` Secret**: 361 | * 再次点击 "New secret"。 362 | * 名称 (Name) 输入: `GITHUB_TOKEN` 363 | * 值 (Value) 输入: 你的 GitHub 访问令牌,用于 cloud-saves 插件自动配置。例如:`ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` 364 | * 点击 "Add secret"。 365 | 366 | * **(可选) 添加 `AUTOSAVE_INTERVAL` Secret**: 367 | * 再次点击 "New secret"。 368 | * 名称 (Name) 输入: `AUTOSAVE_INTERVAL` 369 | * 值 (Value) 输入: 自动保存间隔秒数,不填写默认为30秒 370 | * 点击 "Add secret"。 371 | 372 | * **(可选) 添加 `AUTOSAVE_TARGET_TAG` Secret**: 373 | * 再次点击 "New secret"。 374 | * 名称 (Name) 输入: `AUTOSAVE_TARGET_TAG` 375 | * 值 (Value) 输入: 自动保存目标标签,不填写默认为空 376 | * 点击 "Add secret"。 377 | 378 | 4. **构建与启动**: Hugging Face 会自动检测到 `Dockerfile` 和 Secrets,并开始构建镜像、启动容器。你可以在 Space 的 **Logs** 标签页查看构建和启动过程。 379 | 380 | 5. **访问**: 构建成功并启动后,通过 Space 提供的公共 URL 访问 SillyTavern 界面。 381 | 382 | ## 插件访问 383 | 384 | 如果通过 `PLUGINS` 环境变量安装了插件,你需要根据各个插件的说明文档找到访问其界面的路径。 385 | 386 | * 对于推荐安装的 `cloud-saves` 插件,其管理界面通常位于: 387 | `http://<你的SillyTavern访问地址>/api/plugins/cloud-saves/ui` 388 | 例如,如果是本地部署,则为 `http://127.0.0.1:8000/api/plugins/cloud-saves/ui`。如果是 Hugging Face Space,则将 `<你的SillyTavern访问地址>` 替换为你的 Space 公共 URL。 389 | 390 | 其他插件的访问路径请参考其各自的文档。 391 | --------------------------------------------------------------------------------