From 9aa222f738a90fee6d377909a72c007a9fae4229 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Mon, 24 Feb 2025 13:21:05 +0800 Subject: [PATCH] Let list_chat go without kb checking. (#5280) ### What problem does this PR solve? #5278 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/sdk/chat.py | 5 ++++- rag/raptor.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/api/apps/sdk/chat.py b/api/apps/sdk/chat.py index cbd7fdb1f..100e97c78 100644 --- a/api/apps/sdk/chat.py +++ b/api/apps/sdk/chat.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging + from flask import request from api import settings from api.db import StatusEnum @@ -318,7 +320,8 @@ def list_chat(tenant_id): for kb_id in res["kb_ids"]: kb = KnowledgebaseService.query(id=kb_id) if not kb: - return get_error_data_result(message=f"Don't exist the kb {kb_id}") + logging.WARN(f"Don't exist the kb {kb_id}") + continue kb_list.append(kb[0].to_json()) del res["kb_ids"] res["datasets"] = kb_list diff --git a/rag/raptor.py b/rag/raptor.py index eea7ae279..8c2547adf 100644 --- a/rag/raptor.py +++ b/rag/raptor.py @@ -71,7 +71,7 @@ class RecursiveAbstractiveProcessing4TreeOrganizedRetrieval: layers = [(0, len(chunks))] start, end = 0, len(chunks) if len(chunks) <= 1: - return + return [] chunks = [(s, a) for s, a in chunks if s and len(a) > 0] def summarize(ck_idx, lock):