mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
context template preset manager
This commit is contained in:
@@ -18,7 +18,7 @@ import {
|
||||
import { groups, selected_group } from "./group-chats.js";
|
||||
import { instruct_presets } from "./instruct-mode.js";
|
||||
import { kai_settings } from "./kai-settings.js";
|
||||
import { power_user } from "./power-user.js";
|
||||
import { context_presets, power_user } from "./power-user.js";
|
||||
import {
|
||||
textgenerationwebui_preset_names,
|
||||
textgenerationwebui_presets,
|
||||
@@ -167,6 +167,10 @@ class PresetManager {
|
||||
presets = textgenerationwebui_presets;
|
||||
preset_names = textgenerationwebui_preset_names;
|
||||
break;
|
||||
case "context":
|
||||
presets = context_presets;
|
||||
preset_names = context_presets.map(x => x.name);
|
||||
break;
|
||||
case "instruct":
|
||||
presets = instruct_presets;
|
||||
preset_names = instruct_presets.map(x => x.name);
|
||||
@@ -179,11 +183,11 @@ class PresetManager {
|
||||
}
|
||||
|
||||
isKeyedApi() {
|
||||
return this.apiId == "textgenerationwebui" || this.apiId == "instruct";
|
||||
return this.apiId == "textgenerationwebui" || this.apiId == "context" || this.apiId == "instruct";
|
||||
}
|
||||
|
||||
isNonGenericApi() {
|
||||
return this.apiId == "instruct";
|
||||
return this.apiId == "context" || this.apiId == "instruct";
|
||||
}
|
||||
|
||||
updateList(name, preset) {
|
||||
@@ -231,10 +235,14 @@ class PresetManager {
|
||||
return nai_settings;
|
||||
case "textgenerationwebui":
|
||||
return textgenerationwebui_settings;
|
||||
case "context":
|
||||
const context_preset = deepClone(power_user.context);
|
||||
context_preset['name'] = name || power_user.context.preset;
|
||||
return context_preset;
|
||||
case "instruct":
|
||||
const preset = deepClone(power_user.instruct);
|
||||
preset['name'] = name || power_user.instruct.preset;
|
||||
return preset;
|
||||
const instruct_preset = deepClone(power_user.instruct);
|
||||
instruct_preset['name'] = name || power_user.instruct.preset;
|
||||
return instruct_preset;
|
||||
default:
|
||||
console.warn(`Unknown API ID ${apiId}`);
|
||||
return {};
|
||||
|
Reference in New Issue
Block a user