Don't synchronize vectors while streaming

This commit is contained in:
Cohee 2023-09-10 20:21:23 +03:00
parent 9a5e667674
commit 0bdd350b8d
1 changed files with 5 additions and 5 deletions

View File

@ -77,18 +77,18 @@ async function onVectorizeAllClick() {
let syncBlocked = false; let syncBlocked = false;
async function synchronizeChat(batchSize = 5) { async function synchronizeChat(batchSize = 5) {
if (!settings.enabled) {
return -1;
}
try { try {
await waitUntilCondition(() => !syncBlocked, 500); await waitUntilCondition(() => !syncBlocked && !is_send_press, 1000);
} catch { } catch {
console.log('Vectors: Synchronization blocked by another process'); console.log('Vectors: Synchronization blocked by another process');
return -1; return -1;
} }
try { try {
if (!settings.enabled) {
return -1;
}
syncBlocked = true; syncBlocked = true;
const context = getContext(); const context = getContext();
const chatId = getCurrentChatId(); const chatId = getCurrentChatId();