mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: guard mock suggestions for vectorsdb, optimize fold scan
- Add !isVectorsDb guard to useMockSuggestions derivation - Use single sliceString for bracket matching instead of per-char rope traversal
This commit is contained in:
+5
-5
@@ -1039,15 +1039,15 @@
|
||||
if (!match) continue;
|
||||
|
||||
const bracketPos = line.from + match[1].length;
|
||||
const tail = doc.sliceString(bracketPos, doc.length);
|
||||
let depth = 0;
|
||||
let closePos = -1;
|
||||
for (let i = bracketPos; i < doc.length; i++) {
|
||||
const ch = doc.sliceString(i, i + 1);
|
||||
if (ch === '[') depth++;
|
||||
else if (ch === ']') {
|
||||
for (let i = 0; i < tail.length; i++) {
|
||||
if (tail[i] === '[') depth++;
|
||||
else if (tail[i] === ']') {
|
||||
depth--;
|
||||
if (depth === 0) {
|
||||
closePos = i;
|
||||
closePos = bracketPos + i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -571,6 +571,7 @@
|
||||
const MIN_DOCS_FOR_FUZZY_SUGGESTIONS = 5;
|
||||
|
||||
$: useMockSuggestions =
|
||||
!isVectorsDb &&
|
||||
$noSqlDocument.isNew &&
|
||||
($documents?.documents?.length ?? 0) < MIN_DOCS_FOR_FUZZY_SUGGESTIONS;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user