From f60f2cb7a7741aef77045636284e4e3829315f56 Mon Sep 17 00:00:00 2001 From: SillyLossy Date: Wed, 15 Feb 2023 14:35:31 +0200 Subject: [PATCH] Uncomment set of boolean fields on Kobold WI --- server.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/server.js b/server.js index f8988676f..7bf43fe93 100644 --- a/server.js +++ b/server.js @@ -1384,19 +1384,22 @@ async function setKoboldEntryData(tavernEntry, koboldEntry) { await putAsync(`${api_server}/v1/world_info/${koboldEntry.uid}/comment`, commentArgs); }; - /* Can't set these via API due to bug in Kobold) - // 5. Set constant flag - if (tavernEntry.constant) { - const constantArgs = { data: { value: tavernEntry.constant.toString() }, ...baseRequestArgs }; - await putToPromise(`${api_server}/v1/world_info/${koboldEntry.uid}/constant`, constantArgs); + /* Fixed in Kobold United only: https://github.com/henk717/KoboldAI/pull/280 */ + try { + // 5. Set constant flag + if (tavernEntry.constant) { + const constantArgs = { data: { value: tavernEntry.constant.toString() }, ...baseRequestArgs }; + await putToPromise(`${api_server}/v1/world_info/${koboldEntry.uid}/constant`, constantArgs); + } + // 6. Set selective flag + if (tavernEntry.selective) { + const selectiveArgs = { data: { value: tavernEntry.selective.toString() }, ...baseRequestArgs }; + await putToPromise(`${api_server}/v1/world_info/${koboldEntry.uid}/selective`, selectiveArgs); + } + } catch { + // couldn't set fields = ignore } - // 6. Set selective flag - if (tavernEntry.selective) { - const selectiveArgs = { data: { value: tavernEntry.selective.toString() }, ...baseRequestArgs }; - await putToPromise(`${api_server}/v1/world_info/${koboldEntry.uid}/selective`, selectiveArgs); - } - */ } async function validateKoboldWorldInfo(koboldFolderName, koboldWorldInfo, tavernWorldInfo) {