mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-27 04:49:47 +01:00
- Defaults and config aligned with English-first product surface - Adds/removes ASR/TTS paths; drops China-only provider implementations and bundled SenseVoice assets - Westernizes prompts, plugin/tool copy, connection and handler behavior on upstream fixes - Powermem max_tokens and OpenAI no-thinking guard preserved on downstream path
25 lines
No EOL
740 B
Python
25 lines
No EOL
740 B
Python
import importlib
|
|
import pkgutil
|
|
from config.logger import setup_logging
|
|
|
|
TAG = __name__
|
|
|
|
logger = setup_logging()
|
|
|
|
def auto_import_modules(package_name):
|
|
"""
|
|
Automatically import all modules within the specified package.
|
|
|
|
Args:
|
|
package_name (str): Package name, such as 'functions'.
|
|
"""
|
|
# Get package path
|
|
package = importlib.import_module(package_name)
|
|
package_path = package.__path__
|
|
|
|
# Traverse all modules within the package
|
|
for _, module_name, _ in pkgutil.iter_modules(package_path):
|
|
# Import module
|
|
full_module_name = f"{package_name}.{module_name}"
|
|
importlib.import_module(full_module_name)
|
|
#logger.bind(tag=TAG).info(f"Module '{full_module_name}' loaded") |