Skip to content

Commit

Permalink
Fix bugs (#3535)
Browse files Browse the repository at this point in the history
### 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 <[email protected]>
  • Loading branch information
JinHai-CN authored and yingfeng committed Nov 20, 2024
1 parent 9b9afa9 commit 8930bfc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion api/apps/chunk_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,15 @@ 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)
for kb_id in kb_ids:
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(
Expand All @@ -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"]:
Expand Down
3 changes: 2 additions & 1 deletion api/db/services/dialog_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions web/src/pages/user-setting/setting-system/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ enum Status {
}

const TitleMap = {
es: 'Elasticsearch',
doc_store: 'Elasticsearch',
storage: 'Object Storage',
redis: 'Redis',
database: 'Database',
Expand All @@ -33,7 +33,7 @@ const TitleMap = {

const IconMap = {
es: 'es',
storage: 'storage',
doc_store: 'storage',
redis: 'redis',
database: 'database',
};
Expand Down

0 comments on commit 8930bfc

Please sign in to comment.