更新API密钥管理,优化意图识别和Excel数据验证功能,增强日志记录,改进错误处理机制,支持文档检索功能,提升代码可读性和灵活性。
This commit is contained in:
@@ -93,7 +93,7 @@ class ProfessionalNounVectorizer:
|
||||
logging.info(f"总共加载了 {len(merged_terms)} 条专业名词")
|
||||
return merged_terms
|
||||
except Exception as e:
|
||||
logging.error(f"加载多个文件失败: {e}")
|
||||
logging.error(f"加载多个文件失败: {e}", exc_info=True)
|
||||
return []
|
||||
|
||||
def vectorize_files_and_save(self, file_paths: List[str]) -> bool:
|
||||
@@ -139,7 +139,7 @@ class ProfessionalNounVectorizer:
|
||||
logging.info("完成多文件专业名词向量化和索引创建")
|
||||
return True
|
||||
except Exception as e:
|
||||
logging.error(f"多文件向量化处理失败: {e}")
|
||||
logging.error(f"多文件向量化处理失败: {e}", exc_info=True)
|
||||
return False
|
||||
|
||||
def _updata_suffix_item(self)->Tuple[List[str], List[Dict]] :
|
||||
@@ -246,7 +246,7 @@ class ProfessionalNounVectorizer:
|
||||
faiss_index.save_local(folder_path=self.index_path)
|
||||
logging.info(f"FAISS索引已保存至 {self.index_path}")
|
||||
except Exception as e:
|
||||
logging.error(f"保存FAISS索引失败: {e}")
|
||||
logging.error(f"保存FAISS索引失败: {e}", exc_info=True)
|
||||
raise e
|
||||
|
||||
|
||||
@@ -349,5 +349,5 @@ class ProfessionalNounRetriever:
|
||||
return [json.loads(item) for item in intersection]
|
||||
|
||||
except Exception as e:
|
||||
logging.error(f"查询FAISS索引失败: {e}")
|
||||
logging.error(f"查询FAISS索引失败: {e}", exc_info=True)
|
||||
return []
|
||||
Reference in New Issue
Block a user