From b7408dd64e185e257f5952d2c07fcef315403a10 Mon Sep 17 00:00:00 2001 From: Massimiliano Angelino Date: Tue, 23 Jan 2024 10:09:20 +0100 Subject: [PATCH] fix(ui): improved checking on the result --- .../rag/semantic-search/semantic-search.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/user-interface/react-app/src/pages/rag/semantic-search/semantic-search.tsx b/lib/user-interface/react-app/src/pages/rag/semantic-search/semantic-search.tsx index 62d85bf86..3ee7303ed 100644 --- a/lib/user-interface/react-app/src/pages/rag/semantic-search/semantic-search.tsx +++ b/lib/user-interface/react-app/src/pages/rag/semantic-search/semantic-search.tsx @@ -84,6 +84,7 @@ export default function SemanticSearch() { data.workspace?.value, data.query ); + console.log(result.data?.performSemanticSearch); setSearchResult(result.data?.performSemanticSearch); } catch (error: any) { console.error(error); @@ -135,30 +136,36 @@ export default function SemanticSearch() { label: "Results", id: "results", content: ( - + ), }); - if (searchResult!.vectorSearchItems!.length > 0) { + if ( + searchResult.vectorSearchItems && + searchResult.vectorSearchItems.length > 0 + ) { tabs.push({ label: "Vector Search", id: "vector-search", content: ( ), }); } - if (searchResult.keywordSearchItems!.length > 0) { + if ( + searchResult.keywordSearchItems && + searchResult.keywordSearchItems.length > 0 + ) { tabs.push({ label: "Keyword Search", id: "keyword-search", content: ( ),