Make summarization toggleable
This commit is contained in:
parent
59abee3043
commit
a1473dedd0
|
@ -25,6 +25,7 @@ const settings = {
|
|||
include_wi: false,
|
||||
togetherai_model: 'togethercomputer/m2-bert-80M-32k-retrieval',
|
||||
openai_model: 'text-embedding-ada-002',
|
||||
summarize: false,
|
||||
|
||||
// For chats
|
||||
enabled_chats: false,
|
||||
|
@ -152,9 +153,11 @@ async function synchronizeChat(batchSize = 5) {
|
|||
const newVectorItems = hashedMessages.filter(x => !hashesInCollection.includes(x.hash));
|
||||
const deletedHashes = hashesInCollection.filter(x => !hashedMessages.some(y => y.hash === x));
|
||||
|
||||
const sysPrompt = 'Pause your roleplay. Summarize the most important parts of the message. Your response should include nothing but the summary.';
|
||||
for (let i = 0; i < hashedMessages.length; i++) {
|
||||
hashedMessages[i].text = await generateRaw(hashedMessages[i].text, '', false, false, sysPrompt);
|
||||
if (settings.summarize) {
|
||||
const sysPrompt = 'Pause your roleplay. Summarize the most important parts of the message. Limit yourself to 250 words or less. Your response should include nothing but the summary.';
|
||||
for (const element of hashedMessages) {
|
||||
element.text = await generateRaw(element.text, '', false, false, sysPrompt);
|
||||
}
|
||||
}
|
||||
|
||||
if (newVectorItems.length > 0) {
|
||||
|
@ -773,6 +776,12 @@ jQuery(async () => {
|
|||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#vectors_summarize').prop('checked', settings.summarize).on('input', () => {
|
||||
settings.summarize = !!$('#vectors_summarize').prop('checked');
|
||||
Object.assign(extension_settings.vectors, settings);
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#vectors_message_chunk_size').val(settings.message_chunk_size).on('input', () => {
|
||||
settings.message_chunk_size = Number($('#vectors_message_chunk_size').val());
|
||||
Object.assign(extension_settings.vectors, settings);
|
||||
|
|
|
@ -73,10 +73,16 @@
|
|||
<input type="number" id="vectors_query" class="text_pole widthUnset" min="1" max="99" />
|
||||
</div>
|
||||
|
||||
<label class="checkbox_label" for="vectors_include_wi" title="Query results can activate World Info entries.">
|
||||
<input id="vectors_include_wi" type="checkbox" class="checkbox">
|
||||
Include in World Info Scanning
|
||||
</label>
|
||||
<div class="flex-container">
|
||||
<label class="checkbox_label expander" for="vectors_include_wi" title="Query results can activate World Info entries.">
|
||||
<input id="vectors_include_wi" type="checkbox" class="checkbox">
|
||||
Include in World Info Scanning
|
||||
</label>
|
||||
<label class="checkbox_label expander" for="vectors_summarize" title="Summarize chat messages before generating embeddings.">
|
||||
<input id="vectors_summarize" type="checkbox" class="checkbox">
|
||||
Summarize chat messages
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
|
|
Loading…
Reference in New Issue