@Depth insertion for WI Entries
This commit is contained in:
parent
0178c95f6f
commit
86c7a7a058
|
@ -1935,7 +1935,7 @@
|
||||||
</optgroup>
|
</optgroup>
|
||||||
<optgroup label="GPT-3.5 Turbo Instruct">
|
<optgroup label="GPT-3.5 Turbo Instruct">
|
||||||
<option value="gpt-3.5-turbo-instruct">gpt-3.5-turbo-instruct</option>
|
<option value="gpt-3.5-turbo-instruct">gpt-3.5-turbo-instruct</option>
|
||||||
<option value="gpt-3.5-turbo-instruct-0914">gpt-3.5-turbo-instruct-0914</option>
|
<option value="gpt-3.5-turbo-instruct-0914">gpt-3.5-turbo-instruct-0914</option>
|
||||||
</optgroup>
|
</optgroup>
|
||||||
<optgroup label="GPT-4">
|
<optgroup label="GPT-4">
|
||||||
<option value="gpt-4">gpt-4</option>
|
<option value="gpt-4">gpt-4</option>
|
||||||
|
@ -3960,6 +3960,7 @@
|
||||||
<option value="1" data-i18n="After Char Defs">After Char Defs</option>
|
<option value="1" data-i18n="After Char Defs">After Char Defs</option>
|
||||||
<option value="2" data-i18n="Before AN">Before AN</option>
|
<option value="2" data-i18n="Before AN">Before AN</option>
|
||||||
<option value="3" data-i18n="After AN">After AN</option>
|
<option value="3" data-i18n="After AN">After AN</option>
|
||||||
|
<option value="4" data-i18n="at Depth">at Depth</option>
|
||||||
</select>
|
</select>
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3286,6 +3286,14 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||||
}
|
}
|
||||||
is_send_press = false;
|
is_send_press = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//prevent custom depth WI entries (which have unique random key names) from duplicating
|
||||||
|
for (let key in extension_prompts) {
|
||||||
|
if (key.includes('customDepthWI')) {
|
||||||
|
let keyname = extension_prompts[key]
|
||||||
|
delete extension_prompts[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
//console.log('generate ending');
|
//console.log('generate ending');
|
||||||
} //generate ends
|
} //generate ends
|
||||||
|
|
||||||
|
@ -5194,7 +5202,7 @@ export async function getChatsFromFiles(data, isGroupChat) {
|
||||||
let chat_dict = {};
|
let chat_dict = {};
|
||||||
let chat_list = Object.values(data).sort((a, b) => a["file_name"].localeCompare(b["file_name"])).reverse();
|
let chat_list = Object.values(data).sort((a, b) => a["file_name"].localeCompare(b["file_name"])).reverse();
|
||||||
|
|
||||||
let chat_promise = chat_list.map(({ file_name}) => {
|
let chat_promise = chat_list.map(({ file_name }) => {
|
||||||
return new Promise(async (res, rej) => {
|
return new Promise(async (res, rej) => {
|
||||||
try {
|
try {
|
||||||
const endpoint = isGroupChat ? '/getgroupchat' : '/getchat';
|
const endpoint = isGroupChat ? '/getgroupchat' : '/getchat';
|
||||||
|
|
|
@ -71,6 +71,7 @@ const world_info_position = {
|
||||||
after: 1,
|
after: 1,
|
||||||
ANTop: 2,
|
ANTop: 2,
|
||||||
ANBottom: 3,
|
ANBottom: 3,
|
||||||
|
atDepth: 4,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -658,6 +659,9 @@ function getWorldEntry(name, data, entry) {
|
||||||
const uid = $(this).data("uid");
|
const uid = $(this).data("uid");
|
||||||
const value = Number($(this).val());
|
const value = Number($(this).val());
|
||||||
data.entries[uid].position = !isNaN(value) ? value : 0;
|
data.entries[uid].position = !isNaN(value) ? value : 0;
|
||||||
|
if (value === 4) {
|
||||||
|
template.find('label[for="order"').text('Depth:')
|
||||||
|
} else { template.find('label[for="order"').text('Order:') }
|
||||||
// Spec v2 only supports before_char and after_char
|
// Spec v2 only supports before_char and after_char
|
||||||
setOriginalDataValue(data, uid, "position", data.entries[uid].position == 0 ? 'before_char' : 'after_char');
|
setOriginalDataValue(data, uid, "position", data.entries[uid].position == 0 ? 'before_char' : 'after_char');
|
||||||
// Write the original value as extensions field
|
// Write the original value as extensions field
|
||||||
|
@ -1154,6 +1158,13 @@ async function checkWorldInfo(chat, maxContext) {
|
||||||
case world_info_position.ANBottom:
|
case world_info_position.ANBottom:
|
||||||
ANBottomEntries.unshift(entry.content);
|
ANBottomEntries.unshift(entry.content);
|
||||||
break;
|
break;
|
||||||
|
case world_info_position.atDepth:
|
||||||
|
//inserted one by one, unrelated to any array of items
|
||||||
|
//must have a unique value for 'key' argument
|
||||||
|
//uses the order input to specify depth
|
||||||
|
var randomNumber = Math.floor(Math.random() * 99999) + 1;
|
||||||
|
context.setExtensionPrompt(`customDepthWI-${entry.keywords}-${entry.uid}-${randomNumber}`, entry.content, 1, entry.order);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue