fix:修复base中创建知识库时直接将basemodel转为json时的报错,先转为dict再转为json
This commit is contained in:
parent
4d31a6b5df
commit
367c79a06e
@ -137,12 +137,13 @@ class KnowledgeBase(ABC):
|
|||||||
db_id = f"kb_{hashstr(database_name, with_salt=True)}"
|
db_id = f"kb_{hashstr(database_name, with_salt=True)}"
|
||||||
|
|
||||||
# 创建数据库记录
|
# 创建数据库记录
|
||||||
|
# 确保 Pydantic 模型被转换为字典,以便 JSON 序列化
|
||||||
self.databases_meta[db_id] = {
|
self.databases_meta[db_id] = {
|
||||||
"name": database_name,
|
"name": database_name,
|
||||||
"description": description,
|
"description": description,
|
||||||
"kb_type": self.kb_type,
|
"kb_type": self.kb_type,
|
||||||
"embed_info": embed_info,
|
"embed_info": embed_info.model_dump() if hasattr(embed_info, 'model_dump') else embed_info,
|
||||||
"llm_info": llm_info,
|
"llm_info": llm_info.model_dump() if hasattr(llm_info, 'model_dump') else llm_info,
|
||||||
"metadata": kwargs,
|
"metadata": kwargs,
|
||||||
"created_at": utc_isoformat(),
|
"created_at": utc_isoformat(),
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user