增加日志

This commit is contained in:
weiweiw 2025-01-14 10:26:14 +08:00
parent 91edb76bc3
commit 345c57fbca
2 changed files with 4 additions and 1 deletions

View File

@ -298,6 +298,7 @@ def update_docs(
kb_files = []
docs = json.loads(docs) if docs else {}
logger.info(f"111111 kb_doc_api update_docs file_names:{file_names},更新的doc 长度:{len(docs)}")
# 生成需要加载docs的文件列表
for file_name in file_names:
file_detail = get_file_detail(kb_name=knowledge_base_name, filename=file_name)
@ -306,6 +307,7 @@ def update_docs(
continue
if file_name not in docs:
try:
logger.info(f"****kb_doc_api update_docs file_name not in docs,filename:{file_name}")
kb_files.append(
KnowledgeFile(
filename=file_name, knowledge_base_name=knowledge_base_name
@ -338,6 +340,7 @@ def update_docs(
# 将自定义的docs进行向量化
for file_name, v in docs.items():
try:
logger.info(f"222222 kb_doc_api update_docs file_name:{file_name},更新的doc 长度:{len(docs)}")
v = [x if isinstance(x, Document) else Document(**x) for x in v]
kb_file = KnowledgeFile(
filename=file_name, knowledge_base_name=knowledge_base_name

View File

@ -607,7 +607,7 @@ class ApiRequest:
"docs": docs,
"not_refresh_vs_cache": not_refresh_vs_cache,
}
logger.info(f"update_kb_docs:{file_names}")
if isinstance(data["docs"], dict):
data["docs"] = json.dumps(data["docs"], ensure_ascii=False)