浏览代码

Fix index not found for new user. (#4597)

### What problem does this PR solve?

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.16.0
Kevin Hu 9 个月前
父节点
当前提交
c4b9e903c8
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8
    2
      api/apps/kb_app.py

+ 8
- 2
api/apps/kb_app.py 查看文件

@@ -14,6 +14,7 @@
# limitations under the License.
#
import json
import logging

from flask import request
from flask_login import login_required, current_user
@@ -286,13 +287,18 @@ def knowledge_graph(kb_id):
message='No authorization.',
code=settings.RetCode.AUTHENTICATION_ERROR
)
e, kb = KnowledgebaseService.get_by_id(kb_id)
_, kb = KnowledgebaseService.get_by_id(kb_id)
req = {
"kb_id": [kb_id],
"knowledge_graph_kwd": ["graph"]
}
sres = settings.retrievaler.search(req, search.index_name(kb.tenant_id), [kb_id])
obj = {"graph": {}, "mind_map": {}}
try:
sres = settings.retrievaler.search(req, search.index_name(kb.tenant_id), [kb_id])
except Exception as e:
logging.exception(e)
return get_json_result(data=obj)

for id in sres.ids[:1]:
ty = sres.field[id]["knowledge_graph_kwd"]
try:

正在加载...
取消
保存