Migrate system prompts from imported instruct template

This commit is contained in:
Cohee
2024-09-18 00:38:15 +03:00
parent 0bc6a572c6
commit b0c537d014
3 changed files with 43 additions and 7 deletions

View File

@ -25,7 +25,7 @@ import { ARGUMENT_TYPE, SlashCommandArgument } from './slash-commands/SlashComma
import { enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';
import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';
import { SlashCommandParser } from './slash-commands/SlashCommandParser.js';
import { system_prompts } from './sysprompt.js';
import { checkForSystemPromptInInstructTemplate, system_prompts } from './sysprompt.js';
import {
textgenerationwebui_preset_names,
textgenerationwebui_presets,
@ -72,7 +72,7 @@ function autoSelectPreset() {
* @param {string} apiId API id
* @returns {PresetManager} Preset manager
*/
function getPresetManager(apiId = '') {
export function getPresetManager(apiId = '') {
if (!apiId) {
apiId = main_api == 'koboldhorde' ? 'kobold' : main_api;
}
@ -183,6 +183,10 @@ class PresetManager {
}
async savePreset(name, settings) {
if (this.apiId === 'instruct') {
await checkForSystemPromptInInstructTemplate(name, settings);
}
const preset = settings ?? this.getPresetSettings(name);
const response = await fetch('/api/presets/save', {