fix(weaviate): avoid mismatched search vector dimensions
This commit is contained in:
9 files changed
+71
-15
No files matched your search
@@ -75,6 +75,8 @@ const operationIcon = computed(() => {
|
||||
return Play;
|
||||
}
|
||||
});
|
||||
const needsExplicitSearchVector = computed(() => operationMode.value === "search" && props.databaseType === "weaviate" && props.dimension == null && parseVector(searchVector.value) == null);
|
||||
const executeDisabled = computed(() => loading.value || !requestText.value.trim() || needsExplicitSearchVector.value);
|
||||
|
||||
watch(
|
||||
() => [props.databaseType, props.database, props.collection] as const,
|
||||
@@ -87,7 +89,7 @@ watch(
|
||||
);
|
||||
|
||||
watch(
|
||||
() => [operationMode.value, searchVector.value, searchTopK.value] as const,
|
||||
() => [operationMode.value, searchVector.value, searchTopK.value, props.dimension] as const,
|
||||
() => {
|
||||
if (operationMode.value === "search") {
|
||||
requestText.value = defaultRequestText(props.databaseType, props.database, props.collection, operationMode.value);
|
||||
@@ -216,11 +218,18 @@ function defaultRequestText(databaseType: DatabaseType | undefined, database: st
|
||||
return `POST /collections/${collectionPath}/points/scroll\n${JSON.stringify({ limit: 100, with_payload: true, with_vector: false }, null, 2)}`;
|
||||
}
|
||||
|
||||
function tryParseVector(input: string): number[] {
|
||||
function parseVector(input: string): number[] | undefined {
|
||||
try {
|
||||
const parsed = JSON.parse(input);
|
||||
if (Array.isArray(parsed)) return parsed;
|
||||
if (Array.isArray(parsed) && parsed.length > 0) return parsed;
|
||||
} catch {}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function tryParseVector(input: string): number[] {
|
||||
const parsed = parseVector(input);
|
||||
if (parsed) return parsed;
|
||||
if (props.databaseType === "weaviate" && props.dimension == null) return [];
|
||||
return sampleVector();
|
||||
}
|
||||
|
||||
@@ -343,7 +352,7 @@ function setOperationMode(mode: VectorOperationMode) {
|
||||
<RefreshCcw class="h-3.5 w-3.5" />
|
||||
{{ t("vector.refresh") }}
|
||||
</Button>
|
||||
<Button size="sm" class="h-7 gap-1.5 px-2" :disabled="loading || !requestText.trim()" @click="runRequest">
|
||||
<Button size="sm" class="h-7 gap-1.5 px-2" :disabled="executeDisabled" @click="runRequest">
|
||||
<component :is="operationIcon" class="h-3.5 w-3.5" />
|
||||
{{ executeLabel }}
|
||||
</Button>
|
||||
@@ -359,6 +368,7 @@ function setOperationMode(mode: VectorOperationMode) {
|
||||
<span>topK</span>
|
||||
<input v-model.number="searchTopK" type="number" min="1" max="1000" class="h-7 w-16 rounded border bg-muted/30 px-2 text-xs outline-none focus:border-primary" />
|
||||
</div>
|
||||
<span v-if="needsExplicitSearchVector" class="text-xs text-amber-600 dark:text-amber-400">{{ t("vector.vectorDimensionRequired") }}</span>
|
||||
</div>
|
||||
<div class="grid min-h-0 flex-1 grid-rows-[minmax(9rem,15rem)_1fr]">
|
||||
<div class="min-h-0 border-b">
|
||||
|
||||
@@ -3122,6 +3122,7 @@ export default {
|
||||
requestEditor: "Vector request editor",
|
||||
operationSuccess: "Operation completed. The collection preview has been refreshed.",
|
||||
vectorLabel: "Vector",
|
||||
vectorDimensionRequired: "Collection dimensions are not available yet. Enter a vector matching the collection dimension.",
|
||||
},
|
||||
history: {
|
||||
title: "History",
|
||||
|
||||
@@ -2979,6 +2979,7 @@ export default withEnglishFallback({
|
||||
requestEditor: "Editor de solicitudes vectoriales",
|
||||
operationSuccess: "Operación completada. La vista previa de la colección se ha actualizado.",
|
||||
vectorLabel: "Vector",
|
||||
vectorDimensionRequired: "La dimensión de la colección aún no está disponible. Introduce un vector con la dimensión correcta.",
|
||||
},
|
||||
history: {
|
||||
title: "Historial",
|
||||
|
||||
@@ -2977,6 +2977,7 @@ export default withEnglishFallback({
|
||||
requestEditor: "Editor richieste vettoriali",
|
||||
operationSuccess: "Operazione completata. L'anteprima della collezione e stata aggiornata.",
|
||||
vectorLabel: "Vettore",
|
||||
vectorDimensionRequired: "La dimensione della collezione non è ancora disponibile. Inserisci un vettore con la dimensione corretta.",
|
||||
},
|
||||
history: {
|
||||
title: "Cronologia",
|
||||
|
||||
@@ -2978,6 +2978,7 @@ export default withEnglishFallback({
|
||||
requestEditor: "ベクターリクエストエディタ",
|
||||
operationSuccess: "操作が完了しました。コレクションプレビューが更新されました。",
|
||||
vectorLabel: "ベクトル",
|
||||
vectorDimensionRequired: "コレクションの次元をまだ取得できません。次元が一致するベクトルを入力してください。",
|
||||
},
|
||||
history: {
|
||||
title: "履歴",
|
||||
|
||||
@@ -2979,6 +2979,7 @@ export default withEnglishFallback({
|
||||
requestEditor: "Editor de requisição de vetor",
|
||||
operationSuccess: "Operação concluída. A pré-visualização da coleção foi atualizada.",
|
||||
vectorLabel: "Vetor",
|
||||
vectorDimensionRequired: "A dimensão da coleção ainda não está disponível. Insira um vetor com a dimensão correta.",
|
||||
},
|
||||
history: {
|
||||
title: "Histórico",
|
||||
|
||||
@@ -3122,6 +3122,7 @@ export default withEnglishFallback({
|
||||
requestEditor: "向量请求编辑器",
|
||||
operationSuccess: "操作已完成,集合预览已刷新。",
|
||||
vectorLabel: "向量",
|
||||
vectorDimensionRequired: "暂未获取到集合维度,请先输入与集合维度一致的向量。",
|
||||
},
|
||||
history: {
|
||||
title: "历史",
|
||||
|
||||
@@ -2650,6 +2650,7 @@ export default withEnglishFallback({
|
||||
requestEditor: "向量請求編輯器",
|
||||
operationSuccess: "操作已完成,集合預覽已重新整理。",
|
||||
vectorLabel: "向量",
|
||||
vectorDimensionRequired: "尚未取得集合維度,請先輸入與集合維度一致的向量。",
|
||||
},
|
||||
history: {
|
||||
title: "歷史",
|
||||
|
||||
Reference in new issue
Block a user