修复本地语音识别插件的依赖导入问题喵~

This commit is contained in:
ikun-11451
2025-11-29 19:49:26 +08:00
parent 9eb8830835
commit 2dc64ed0a8
2 changed files with 3 additions and 2 deletions

View File

@@ -6,4 +6,5 @@ __plugin_meta__ = PluginMetadata(
usage="在 bot_config.toml 中将 asr_provider 设置为 'local' 即可启用",
version="0.1.0",
author="Elysia",
python_dependencies=["openai-whisper"],
)

View File

@@ -1,8 +1,6 @@
import asyncio
from typing import ClassVar
import whisper
from src.common.logger import get_logger
from src.plugin_system import BasePlugin, ComponentInfo, register_plugin
from src.plugin_system.base.base_tool import BaseTool
@@ -35,6 +33,8 @@ class LocalASRTool(BaseTool):
if _whisper_model is None and not _is_loading:
_is_loading = True
try:
import whisper
model_size = plugin_config.get("whisper", {}).get("model_size", "tiny")
device = plugin_config.get("whisper", {}).get("device", "cpu")
logger.info(f"正在预加载 Whisper ASR 模型: {model_size} ({device})")