mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 15:13:55 +08:00
* update:server连接manager-api * update:读取智能体模型配置 * update:添加默认模型的按钮 * update:优化配置读取方式 * update:server兼容manager接口改造 * update:优化私有配置加载 * update:加载私有模型配置
19 lines
595 B
Python
19 lines
595 B
Python
import os
|
|
import sys
|
|
import importlib
|
|
from config.logger import setup_logging
|
|
|
|
logger = setup_logging()
|
|
|
|
|
|
def create_instance(class_name, *args, **kwargs):
|
|
if os.path.exists(
|
|
os.path.join("core", "providers", "memory", class_name, f"{class_name}.py")
|
|
):
|
|
lib_name = f"core.providers.memory.{class_name}.{class_name}"
|
|
if lib_name not in sys.modules:
|
|
sys.modules[lib_name] = importlib.import_module(f"{lib_name}")
|
|
return sys.modules[lib_name].MemoryProvider(*args, **kwargs)
|
|
|
|
raise ValueError(f"不支持的记忆服务类型: {class_name}")
|