From 00a89c142cee898ea9b06f55f8e920503d5adb96 Mon Sep 17 00:00:00 2001 From: Marcin Szczyglinski Date: Mon, 3 Feb 2025 06:43:26 +0100 Subject: [PATCH] Added empty index check --- src/pygpt_net/core/idx/chat.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pygpt_net/core/idx/chat.py b/src/pygpt_net/core/idx/chat.py index 98aa2dff..5e739d7d 100755 --- a/src/pygpt_net/core/idx/chat.py +++ b/src/pygpt_net/core/idx/chat.py @@ -269,6 +269,12 @@ def chat( else: llm = self.window.core.idx.llm.get(model) + # check if index is empty + if index: + nodes = index.docstore.docs.values() + if not nodes: + use_index = False + # TODO: if multimodal support, try to get multimodal provider # if model.is_multimodal(): # llm = self.window.core.idx.llm.get(model, multimodal=True) # get multimodal LLM model