mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add vector retrieval score threshold
This commit is contained in:
@@ -52,6 +52,7 @@ const settings = {
|
||||
insert: 3,
|
||||
query: 2,
|
||||
message_chunk_size: 400,
|
||||
score_threshold: 0.25,
|
||||
|
||||
// For files
|
||||
enabled_files: false,
|
||||
@@ -760,6 +761,7 @@ async function queryCollection(collectionId, searchText, topK) {
|
||||
searchText: searchText,
|
||||
topK: topK,
|
||||
source: settings.source,
|
||||
threshold: settings.score_threshold,
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -788,6 +790,7 @@ async function queryMultipleCollections(collectionIds, searchText, topK) {
|
||||
searchText: searchText,
|
||||
topK: topK,
|
||||
source: settings.source,
|
||||
threshold: settings.score_threshold,
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -1310,6 +1313,12 @@ jQuery(async () => {
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#vectors_score_threshold').val(settings.score_threshold).on('input', () => {
|
||||
settings.score_threshold = Number($('#vectors_score_threshold').val());
|
||||
Object.assign(extension_settings.vectors, settings);
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
const validSecret = !!secret_state[SECRET_KEYS.NOMICAI];
|
||||
const placeholder = validSecret ? '✔️ Key saved' : '❌ Missing key';
|
||||
$('#api_key_nomicai').attr('placeholder', placeholder);
|
||||
|
Reference in New Issue
Block a user