Merge pull request #1057 from SillyTavern/fix-extension-depth

Fix extension depth
This commit is contained in:
Cohee 2023-08-30 10:27:59 +03:00 committed by GitHub
commit 66bc15edc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 7 deletions

View File

@ -2801,11 +2801,11 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
return;
}
const anchorDepth = Math.abs(index - finalMesSend.length + 1);
const anchorDepth = Math.abs(index - finalMesSend.length);
// NOTE: Depth injected here!
const extensionAnchor = getExtensionPrompt(extension_prompt_types.IN_CHAT, anchorDepth);
if (anchorDepth > 0 && extensionAnchor && extensionAnchor.length) {
if (anchorDepth >= 0 && extensionAnchor && extensionAnchor.length) {
mesItem.extensionPrompts.push(extensionAnchor);
}
});

View File

@ -24,7 +24,6 @@ function createDefaultFiles() {
}
}
const process = require('process')
const yargs = require('yargs/yargs');
const { hideBin } = require('yargs/helpers');
const net = require("net");
@ -149,11 +148,8 @@ let api_openai = "https://api.openai.com/v1";
let api_claude = "https://api.anthropic.com/v1";
let main_api = "kobold";
let response_generate_novel;
let characters = {};
let response_dw_bg;
let first_run = true;
let color = {
byNum: (mess, fgNum) => {
@ -4134,7 +4130,7 @@ function backupSettings() {
const backupFile = path.join(directories.backups, `settings_${generateTimestamp()}.json`);
fs.copyFileSync(SETTINGS_FILE, backupFile);
let files = fs.readdirSync(directories.backups);
let files = fs.readdirSync(directories.backups).filter(f => f.startsWith('settings_'));
if (files.length > MAX_BACKUPS) {
files = files.map(f => path.join(directories.backups, f));
files.sort((a, b) => fs.statSync(a).mtimeMs - fs.statSync(b).mtimeMs);