fix: 修复 get_all_memories 调用时 config 为 None 导致的错误
问题:当调用 get_all_memories API 时,没有传递 config 参数, 导致 _create_mem0_instance 中的 config 为 None, 调用 config.get_custom_fact_extraction_prompt() 时抛出 AttributeError。 修复:添加 config 的空值检查,只在 config 存在时才添加 custom_fact_extraction_prompt。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5b29e866f2
commit
a1f60a7024
@ -301,7 +301,6 @@ class Mem0Manager:
|
||||
# 设置一个假的 base_url,这样 HuggingFaceEmbedding 就不会加载 SentenceTransformer
|
||||
|
||||
config_dict = {
|
||||
"custom_fact_extraction_prompt": config.get_custom_fact_extraction_prompt(),
|
||||
"vector_store": {
|
||||
"provider": "pgvector",
|
||||
"config": {
|
||||
@ -320,6 +319,10 @@ class Mem0Manager:
|
||||
}
|
||||
}
|
||||
|
||||
# 添加自定义记忆提取提示词(如果提供了 config)
|
||||
if config is not None:
|
||||
config_dict["custom_fact_extraction_prompt"] = config.get_custom_fact_extraction_prompt()
|
||||
|
||||
# 添加 LangChain LLM 配置(如果提供了)
|
||||
if config and config.llm_instance is not None:
|
||||
config_dict["llm"] = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user