From 8930bfcff876975291a7c3b3f4f49ae218aef168 Mon Sep 17 00:00:00 2001 From: Jin Hai Date: Wed, 20 Nov 2024 19:45:50 +0800 Subject: [PATCH] Fix bugs (#3535) ### What problem does this PR solve? 1. system monitor icon and text missing 2. Team knowledge base can't be search ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Signed-off-by: jinhai --- api/apps/chunk_app.py | 4 +++- api/db/services/dialog_service.py | 3 ++- web/src/pages/user-setting/setting-system/index.tsx | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/api/apps/chunk_app.py b/api/apps/chunk_app.py index 572a41dfcd..0b237ace49 100644 --- a/api/apps/chunk_app.py +++ b/api/apps/chunk_app.py @@ -255,6 +255,7 @@ def retrieval_test(): similarity_threshold = float(req.get("similarity_threshold", 0.0)) vector_similarity_weight = float(req.get("vector_similarity_weight", 0.3)) top = int(req.get("top_k", 1024)) + tenant_ids = [] try: tenants = UserTenantService.query(user_id=current_user.id) @@ -262,6 +263,7 @@ def retrieval_test(): for tenant in tenants: if KnowledgebaseService.query( tenant_id=tenant.tenant_id, id=kb_id): + tenant_ids.append(tenant.tenant_id) break else: return get_json_result( @@ -283,7 +285,7 @@ def retrieval_test(): question += keyword_extraction(chat_mdl, question) retr = settings.retrievaler if kb.parser_id != ParserType.KG else settings.kg_retrievaler - ranks = retr.retrieval(question, embd_mdl, kb.tenant_id, kb_ids, page, size, + ranks = retr.retrieval(question, embd_mdl, tenant_ids, kb_ids, page, size, similarity_threshold, vector_similarity_weight, top, doc_ids, rerank_mdl=rerank_mdl, highlight=req.get("highlight")) for c in ranks["chunks"]: diff --git a/api/db/services/dialog_service.py b/api/db/services/dialog_service.py index 26e23e773f..0463cbb6c5 100644 --- a/api/db/services/dialog_service.py +++ b/api/db/services/dialog_service.py @@ -594,6 +594,7 @@ def tts(tts_mdl, text): def ask(question, kb_ids, tenant_id): kbs = KnowledgebaseService.get_by_ids(kb_ids) + tenant_ids = [kb.tenant_id for kb in kbs] embd_nms = list(set([kb.embd_id for kb in kbs])) is_kg = all([kb.parser_id == ParserType.KG for kb in kbs]) @@ -603,7 +604,7 @@ def ask(question, kb_ids, tenant_id): chat_mdl = LLMBundle(tenant_id, LLMType.CHAT) max_tokens = chat_mdl.max_length - kbinfos = retr.retrieval(question, embd_mdl, tenant_id, kb_ids, 1, 12, 0.1, 0.3, aggs=False) + kbinfos = retr.retrieval(question, embd_mdl, tenant_ids, kb_ids, 1, 12, 0.1, 0.3, aggs=False) knowledges = [ck["content_with_weight"] for ck in kbinfos["chunks"]] used_token_count = 0 diff --git a/web/src/pages/user-setting/setting-system/index.tsx b/web/src/pages/user-setting/setting-system/index.tsx index 2deff39acf..1fe1833058 100644 --- a/web/src/pages/user-setting/setting-system/index.tsx +++ b/web/src/pages/user-setting/setting-system/index.tsx @@ -24,7 +24,7 @@ enum Status { } const TitleMap = { - es: 'Elasticsearch', + doc_store: 'Elasticsearch', storage: 'Object Storage', redis: 'Redis', database: 'Database', @@ -33,7 +33,7 @@ const TitleMap = { const IconMap = { es: 'es', - storage: 'storage', + doc_store: 'storage', redis: 'redis', database: 'database', };