修复本地语音识别插件的依赖导入问题喵~
This commit is contained in:
@@ -6,4 +6,5 @@ __plugin_meta__ = PluginMetadata(
|
|||||||
usage="在 bot_config.toml 中将 asr_provider 设置为 'local' 即可启用",
|
usage="在 bot_config.toml 中将 asr_provider 设置为 'local' 即可启用",
|
||||||
version="0.1.0",
|
version="0.1.0",
|
||||||
author="Elysia",
|
author="Elysia",
|
||||||
|
python_dependencies=["openai-whisper"],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from typing import ClassVar
|
from typing import ClassVar
|
||||||
|
|
||||||
import whisper
|
|
||||||
|
|
||||||
from src.common.logger import get_logger
|
from src.common.logger import get_logger
|
||||||
from src.plugin_system import BasePlugin, ComponentInfo, register_plugin
|
from src.plugin_system import BasePlugin, ComponentInfo, register_plugin
|
||||||
from src.plugin_system.base.base_tool import BaseTool
|
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:
|
if _whisper_model is None and not _is_loading:
|
||||||
_is_loading = True
|
_is_loading = True
|
||||||
try:
|
try:
|
||||||
|
import whisper
|
||||||
|
|
||||||
model_size = plugin_config.get("whisper", {}).get("model_size", "tiny")
|
model_size = plugin_config.get("whisper", {}).get("model_size", "tiny")
|
||||||
device = plugin_config.get("whisper", {}).get("device", "cpu")
|
device = plugin_config.get("whisper", {}).get("device", "cpu")
|
||||||
logger.info(f"正在预加载 Whisper ASR 模型: {model_size} ({device})")
|
logger.info(f"正在预加载 Whisper ASR 模型: {model_size} ({device})")
|
||||||
|
|||||||
Reference in New Issue
Block a user