Merge branch 'staging' into webpack-cache-dataroot

This commit is contained in:
Cohee 2025-02-19 21:34:02 +02:00
commit 1ef5154770
19 changed files with 44 additions and 23 deletions

View File

@ -4666,7 +4666,7 @@
<small data-i18n="Enabled">Enabled</small>
</label>
<small data-i18n="Minimum generated message length">Minimum generated message length</small>
<input id="auto_swipe_minimum_length" name="auto_swipe_minimum_length" type="number" min="0" step="1" value="0" class="text_pole" title="If the generated message is shorter than this, trigger an auto-swipe." data-i18n="[title]If the generated message is shorter than this, trigger an auto-swipe">
<input id="auto_swipe_minimum_length" name="auto_swipe_minimum_length" type="number" min="0" step="1" value="0" class="text_pole" title="If the generated message is shorter than these many characters, trigger an auto-swipe." data-i18n="[title]If the generated message is shorter than these many characters, trigger an auto-swipe">
<small data-i18n="Blacklisted words">Blacklisted words</small>
<div class="auto_swipe">
<textarea id="auto_swipe_blacklist" name="auto_swipe_blacklist" data-i18n="[placeholder]words you dont want generated separated by comma ','" placeholder="words you don't want generated separated by comma ','" class="text_pole textarea_compact" value="" autocomplete="off" rows="3"></textarea>

View File

@ -709,7 +709,7 @@
"Auto-swipe": "السحب التلقائي",
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "تمكين وظيفة السحب التلقائي. الإعدادات في هذا القسم تؤثر فقط عند تمكين السحب التلقائي",
"Minimum generated message length": "الحد الأدنى لطول الرسالة المولدة",
"If the generated message is shorter than this, trigger an auto-swipe": "إذا كانت الرسالة المولدة أقصر من هذا، فتحريض السحب التلقائي",
"If the generated message is shorter than these many characters, trigger an auto-swipe": "إذا كانت الرسالة المولدة أقصر من هذا، فتحريض السحب التلقائي",
"Blacklisted words": "الكلمات الممنوعة",
"words you dont want generated separated by comma ','": "الكلمات التي لا تريد توليدها مفصولة بفاصلة ','",
"Blacklisted word count to swipe": "عدد الكلمات الممنوعة للسحب",

View File

@ -709,7 +709,7 @@
"Auto-swipe": "Automatisches Wischen",
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Aktiviere die Auto-Wisch-Funktion. Einstellungen in diesem Abschnitt haben nur dann Auswirkungen, wenn das automatische Wischen aktiviert ist",
"Minimum generated message length": "Minimale generierte Nachrichtenlänge",
"If the generated message is shorter than this, trigger an auto-swipe": "Wenn die generierte Nachricht kürzer ist als diese, löse automatisches Wischen aus",
"If the generated message is shorter than these many characters, trigger an auto-swipe": "Wenn die generierte Nachricht kürzer ist als diese, löse automatisches Wischen aus",
"Blacklisted words": "Verbotene Wörter",
"words you dont want generated separated by comma ','": "Wörter, die du nicht generiert haben möchtest, durch Komma ',' getrennt",
"Blacklisted word count to swipe": "Anzahl der verbotenen Wörter, um zu wischen",

View File

@ -709,7 +709,7 @@
"Auto-swipe": "Deslizamiento automático",
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Habilitar la función de deslizamiento automático. La configuración en esta sección solo tiene efecto cuando el deslizamiento automático está habilitado",
"Minimum generated message length": "Longitud mínima del mensaje generado",
"If the generated message is shorter than this, trigger an auto-swipe": "Si el mensaje generado es más corto que esto, activar un deslizamiento automático",
"If the generated message is shorter than these many characters, trigger an auto-swipe": "Si el mensaje generado es más corto que esto, activar un deslizamiento automático",
"Blacklisted words": "Palabras prohibidas",
"words you dont want generated separated by comma ','": "palabras que no desea generar separadas por coma ','",
"Blacklisted word count to swipe": "Número de palabras prohibidas para deslizar",

View File

@ -656,7 +656,7 @@
"Auto-swipe": "Balayage automatique",
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Activer la fonction de balayage automatique. Les paramètres de cette section n'ont d'effet que lorsque le balayage automatique est activé",
"Minimum generated message length": "Longueur minimale du message généré",
"If the generated message is shorter than this, trigger an auto-swipe": "Si le message généré est plus court que cela, déclenchez un balayage automatique",
"If the generated message is shorter than these many characters, trigger an auto-swipe": "Si le message généré est plus court que cela, déclenchez un balayage automatique",
"Blacklisted words": "Mots en liste noire",
"words you dont want generated separated by comma ','": "mots que vous ne voulez pas générer séparés par des virgules ','",
"Blacklisted word count to swipe": "Nombre de mots en liste noire pour balayer",

View File

@ -709,7 +709,7 @@
"Auto-swipe": "Sjálfvirkur sveip",
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Virkjaðu sjálfvirka sveiflugerð. Stillingar í þessum hluta hafa aðeins áhrif þegar sjálfvirkur sveiflugerð er virk",
"Minimum generated message length": "Lágmarks lengd á mynduðum skilaboðum",
"If the generated message is shorter than this, trigger an auto-swipe": "Ef mynduðu skilaboðin eru styttri en þessi, kallaðu fram sjálfvirkar sveiflugerðar",
"If the generated message is shorter than these many characters, trigger an auto-swipe": "Ef mynduðu skilaboðin eru styttri en þessi, kallaðu fram sjálfvirkar sveiflugerðar",
"Blacklisted words": "Svört orð",
"words you dont want generated separated by comma ','": "orð sem þú vilt ekki að framleiða aðskilin með kommu ','",
"Blacklisted word count to swipe": "Fjöldi svörtra orða til að sveipa",

View File

@ -709,7 +709,7 @@
"Auto-swipe": "Auto-swipe",
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Abilita la funzione di auto-swipe. Le impostazioni in questa sezione hanno effetto solo quando l'auto-swipe è abilitato",
"Minimum generated message length": "Lunghezza minima del messaggio generato",
"If the generated message is shorter than this, trigger an auto-swipe": "Se il messaggio generato è più breve di questo, attiva un'automatica rimozione",
"If the generated message is shorter than these many characters, trigger an auto-swipe": "Se il messaggio generato è più breve di questo, attiva un'automatica rimozione",
"Blacklisted words": "Parole in blacklist",
"words you dont want generated separated by comma ','": "parole che non vuoi generate separate da virgola ','",
"Blacklisted word count to swipe": "Numero di parole in blacklist per attivare un'automatica rimozione",

View File

@ -709,7 +709,7 @@
"Auto-swipe": "オートスワイプ",
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "自動スワイプ機能を有効にします。このセクションの設定は、自動スワイプが有効になっている場合にのみ効果があります",
"Minimum generated message length": "生成されたメッセージの最小長",
"If the generated message is shorter than this, trigger an auto-swipe": "生成されたメッセージがこれよりも短い場合、自動スワイプをトリガーします",
"If the generated message is shorter than these many characters, trigger an auto-swipe": "生成されたメッセージがこれよりも短い場合、自動スワイプをトリガーします",
"Blacklisted words": "ブラックリストされた単語",
"words you dont want generated separated by comma ','": "コンマ ',' で区切られた生成したくない単語",
"Blacklisted word count to swipe": "スワイプするブラックリストされた単語の数",

View File

@ -724,7 +724,7 @@
"Auto-swipe": "자동 스와이프",
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "자동 스와이프 기능을 활성화합니다. 이 섹션의 설정은 자동 스와이프가 활성화되었을 때만 영향을 미칩니다",
"Minimum generated message length": "생성된 메시지 최소 길이",
"If the generated message is shorter than this, trigger an auto-swipe": "생성된 메시지가이보다 짧으면 자동 스와이프를 트리거합니다",
"If the generated message is shorter than these many characters, trigger an auto-swipe": "생성된 메시지가이보다 짧으면 자동 스와이프를 트리거합니다",
"Blacklisted words": "금지어",
"words you dont want generated separated by comma ','": "쉼표로 구분된 생성하지 않으려는 단어",
"Blacklisted word count to swipe": "스와이프할 금지어 개수",

View File

@ -709,7 +709,7 @@
"Auto-swipe": "Automatisch vegen",
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Schakel de automatische-vegen functie in. Instellingen in dit gedeelte hebben alleen effect wanneer automatisch vegen is ingeschakeld",
"Minimum generated message length": "Minimale gegenereerde berichtlengte",
"If the generated message is shorter than this, trigger an auto-swipe": "Als het gegenereerde bericht korter is dan dit, activeer dan een automatische veeg",
"If the generated message is shorter than these many characters, trigger an auto-swipe": "Als het gegenereerde bericht korter is dan dit, activeer dan een automatische veeg",
"Blacklisted words": "Verboden woorden",
"words you dont want generated separated by comma ','": "woorden die je niet gegenereerd wilt hebben gescheiden door komma ','",
"Blacklisted word count to swipe": "Aantal verboden woorden om te vegen",

View File

@ -709,7 +709,7 @@
"Auto-swipe": "Auto-swipe",
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Ativar a função de auto-swipe. As configurações nesta seção só têm efeito quando o auto-swipe está ativado",
"Minimum generated message length": "Comprimento mínimo da mensagem gerada",
"If the generated message is shorter than this, trigger an auto-swipe": "Se a mensagem gerada for mais curta que isso, acione um auto-swipe",
"If the generated message is shorter than these many characters, trigger an auto-swipe": "Se a mensagem gerada for mais curta que isso, acione um auto-swipe",
"Blacklisted words": "Palavras proibidas",
"words you dont want generated separated by comma ','": "palavras que você não quer geradas separadas por vírgula ','",
"Blacklisted word count to swipe": "Contagem de palavras proibidas para swipe",

View File

@ -426,7 +426,7 @@
"Requests logprobs from the API for the Token Probabilities feature": "Запросить логпробы из API для функции Token Probabilities.",
"Automatically reject and re-generate AI message based on configurable criteria": "Автоматическое отклонение и повторная генерация сообщений AI на основе настраиваемых критериев.",
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Включить авто-свайп. Настройки в этом разделе действуют только при включенном авто-свайпе.",
"If the generated message is shorter than this, trigger an auto-swipe": "Если сгенерированное сообщение короче этого значения, срабатывает авто-свайп.",
"If the generated message is shorter than these many characters, trigger an auto-swipe": "Если сгенерированное сообщение короче этого значения, срабатывает авто-свайп.",
"Reload and redraw the currently open chat": "Перезагрузить и перерисовать открытый в данный момент чат.",
"Auto-Expand Message Actions": "Развернуть действия",
"Persona Management": "Управление персоной",
@ -2205,4 +2205,4 @@
"Tokenized text:": "Токенизированный текст:",
"Token IDs:": "Идентификаторы токенов:",
"Tokens:": "Токенов:"
}
}

View File

@ -709,7 +709,7 @@
"Auto-swipe": "Автоматичний змах",
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Вмикає функцію автоматичного змаху. Налаштування в цьому розділі діють лише тоді, коли увімкнено автоматичний змах",
"Minimum generated message length": "Мінімальна довжина згенерованого повідомлення",
"If the generated message is shorter than this, trigger an auto-swipe": "Якщо згенероване повідомлення коротше за це, викликайте автоматичний змаху",
"If the generated message is shorter than these many characters, trigger an auto-swipe": "Якщо згенероване повідомлення коротше за це, викликайте автоматичний змаху",
"Blacklisted words": "Список заборонених слів",
"words you dont want generated separated by comma ','": "слова, які ви не хочете генерувати, розділені комою ','",
"Blacklisted word count to swipe": "Кількість заборонених слів для змаху",

View File

@ -709,7 +709,7 @@
"Auto-swipe": "Tự động vuốt",
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Bật chức năng tự động vuốt. Các cài đặt trong phần này chỉ có tác dụng khi tự động vuốt được bật",
"Minimum generated message length": "Độ dài tối thiểu của tin nhắn được tạo",
"If the generated message is shorter than this, trigger an auto-swipe": "Nếu tin nhắn được tạo ra ngắn hơn điều này, kích hoạt tự động vuốt",
"If the generated message is shorter than these many characters, trigger an auto-swipe": "Nếu tin nhắn được tạo ra ngắn hơn điều này, kích hoạt tự động vuốt",
"Blacklisted words": "Từ trong danh sách đen",
"words you dont want generated separated by comma ','": "các từ bạn không muốn được tạo ra được phân tách bằng dấu phẩy ','",
"Blacklisted word count to swipe": "Số từ trong danh sách đen để vuốt",

View File

@ -804,7 +804,7 @@
"Auto-swipe": "自动滑动",
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "启用自动滑动功能。仅当启用自动滑动时,本节中的设置才会生效",
"Minimum generated message length": "生成的消息的最小长度",
"If the generated message is shorter than this, trigger an auto-swipe": "如果生成的消息短于此长度,则触发自动滑动",
"If the generated message is shorter than these many characters, trigger an auto-swipe": "如果生成的消息短于此长度,则触发自动滑动",
"Blacklisted words": "屏蔽词",
"words you dont want generated separated by comma ','": "不想生成的词语,用半角逗号“,”分隔",
"Blacklisted word count to swipe": "触发滑动的黑名单词语数量",

View File

@ -710,7 +710,7 @@
"Auto-swipe": "自動滑動",
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "啟用自動滑動功能。此部分的設定僅在啟用自動滑動時有效。",
"Minimum generated message length": "生成訊息的最小長度",
"If the generated message is shorter than this, trigger an auto-swipe": "如果生成的訊息比這個短,將觸發自動滑動。",
"If the generated message is shorter than these many characters, trigger an auto-swipe": "如果生成的訊息比這個短,將觸發自動滑動。",
"Blacklisted words": "黑名單詞語",
"words you dont want generated separated by comma ','": "您不想生成的文字,使用逗號分隔",
"Blacklisted word count to swipe": "滑動的黑名單詞語數量",

View File

@ -25,7 +25,7 @@ class OpenAICompatibleTtsProvider {
<label for="openai_compatible_tts_endpoint">Provider Endpoint:</label>
<div class="flex-container alignItemsCenter">
<div class="flex1">
<input id="openai_compatible_tts_endpoint" type="text" class="text_pole" maxlength="250" value="${this.defaultSettings.provider_endpoint}"/>
<input id="openai_compatible_tts_endpoint" type="text" class="text_pole" maxlength="500" value="${this.defaultSettings.provider_endpoint}"/>
</div>
<div id="openai_compatible_tts_key" class="menu_button menu_button_icon">
<i class="fa-solid fa-key"></i>
@ -33,9 +33,9 @@ class OpenAICompatibleTtsProvider {
</div>
</div>
<label for="openai_compatible_model">Model:</label>
<input id="openai_compatible_model" type="text" class="text_pole" maxlength="250" value="${this.defaultSettings.model}"/>
<input id="openai_compatible_model" type="text" class="text_pole" maxlength="500" value="${this.defaultSettings.model}"/>
<label for="openai_compatible_tts_voices">Available Voices (comma separated):</label>
<input id="openai_compatible_tts_voices" type="text" class="text_pole" maxlength="250" value="${this.defaultSettings.available_voices.join()}"/>
<input id="openai_compatible_tts_voices" type="text" class="text_pole" value="${this.defaultSettings.available_voices.join()}"/>
<label for="openai_compatible_tts_speed">Speed: <span id="openai_compatible_tts_speed_output"></span></label>
<input type="range" id="openai_compatible_tts_speed" value="1" min="0.25" max="4" step="0.05">`;
return html;

View File

@ -57,7 +57,7 @@ import {
import getWebpackServeMiddleware from './src/middleware/webpack-serve.js';
import basicAuthMiddleware from './src/middleware/basicAuth.js';
import whitelistMiddleware from './src/middleware/whitelist.js';
import whitelistMiddleware, { getAccessLogPath, migrateAccessLog } from './src/middleware/whitelist.js';
import multerMonkeyPatch from './src/middleware/multerMonkeyPatch.js';
import initRequestProxy from './src/request-proxy.js';
import getCacheBusterMiddleware from './src/middleware/cacheBuster.js';
@ -754,6 +754,7 @@ const preSetupTasks = async function () {
await checkForNewContent(directories);
await ensureThumbnailCache();
cleanUploads();
migrateAccessLog();
await settingsInit();
await statsInit();
@ -856,7 +857,7 @@ const postSetupTasks = async function (v6Failed, v4Failed, useIPv6, useIPv4) {
if (listen) {
console.log();
console.log('To limit connections to internal localhost only ([::1] or 127.0.0.1), change the setting in config.yaml to "listen: false".');
console.log('Check the "access.log" file in the SillyTavern directory to inspect incoming connections.');
console.log('Check the "access.log" file in the data directory to inspect incoming connections:', color.green(getAccessLogPath()));
}
console.log('\n' + getSeparator(plainGoToLog.length) + '\n');
console.log(goToLog);

View File

@ -12,6 +12,8 @@ const enableForwardedWhitelist = getConfigValue('enableForwardedWhitelist', fals
let whitelist = getConfigValue('whitelist', []);
let knownIPs = new Set();
export const getAccessLogPath = () => path.join(globalThis.DATA_ROOT, 'access.log');
if (fs.existsSync(whitelistPath)) {
try {
let whitelistTxt = fs.readFileSync(whitelistPath, 'utf-8');
@ -46,6 +48,23 @@ function getForwardedIp(req) {
return undefined;
}
export function migrateAccessLog() {
try {
if (!fs.existsSync('access.log')) {
return;
}
const logPath = getAccessLogPath();
if (fs.existsSync(logPath)) {
return;
}
fs.renameSync('access.log', logPath);
console.log(color.yellow('Migrated access.log to new location:'), logPath);
} catch (e) {
console.error('Failed to migrate access log:', e);
console.info('Please move access.log to the data directory manually.');
}
}
/**
* Returns a middleware function that checks if the client IP is in the whitelist.
* @param {boolean} whitelistMode If whitelist mode is enabled via config or command line
@ -67,9 +86,10 @@ export default function whitelistMiddleware(whitelistMode, listen) {
knownIPs.add(clientIp);
// Write access log
const logPath = getAccessLogPath();
const timestamp = new Date().toISOString();
const log = `${timestamp} ${clientIp} ${userAgent}\n`;
fs.appendFile('access.log', log, (err) => {
fs.appendFile(logPath, log, (err) => {
if (err) {
console.error('Failed to write access log:', err);
}