mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-29 01:33:51 +08:00
update: 记忆模块使用独立LLM openai增加超参
This commit is contained in:
@@ -452,6 +452,34 @@ class ConnectionHandler:
|
||||
save_to_file=not self.read_config_from_api,
|
||||
)
|
||||
|
||||
# 获取记忆总结配置
|
||||
memory_config = self.config["Memory"]
|
||||
memory_type = self.config["Memory"][self.config["selected_module"]["Memory"]][
|
||||
"type"
|
||||
]
|
||||
# 如果使用 nomen,直接返回
|
||||
if memory_type == "nomem":
|
||||
return
|
||||
# 使用 mem_local_short 模式
|
||||
elif memory_type == "mem_local_short":
|
||||
memory_llm_name = memory_config[self.config["selected_module"]["Memory"]]["llm"]
|
||||
if memory_llm_name and memory_llm_name in self.config["LLM"]:
|
||||
# 如果配置了专用LLM,则创建独立的LLM实例
|
||||
from core.utils import llm as llm_utils
|
||||
memory_llm_config = self.config["LLM"][memory_llm_name]
|
||||
memory_llm_type = memory_llm_config.get("type", memory_llm_name)
|
||||
memory_llm = llm_utils.create_instance(
|
||||
memory_llm_type, memory_llm_config
|
||||
)
|
||||
self.logger.bind(tag=TAG).info(
|
||||
f"为记忆总结创建了专用LLM: {memory_llm_name}, 类型: {memory_llm_type}"
|
||||
)
|
||||
self.memory.set_llm(memory_llm)
|
||||
else:
|
||||
# 否则使用主LLM
|
||||
self.memory.set_llm(self.llm)
|
||||
self.logger.bind(tag=TAG).info("使用主LLM作为意图识别模型")
|
||||
|
||||
def _initialize_intent(self):
|
||||
self.intent_type = self.config["Intent"][
|
||||
self.config["selected_module"]["Intent"]
|
||||
|
||||
Reference in New Issue
Block a user