diff --git a/astrbot/core/provider/sources/sensevoice_selfhosted_source.py b/astrbot/core/provider/sources/sensevoice_selfhosted_source.py index d37f89bf7..1c3c6cc82 100644 --- a/astrbot/core/provider/sources/sensevoice_selfhosted_source.py +++ b/astrbot/core/provider/sources/sensevoice_selfhosted_source.py @@ -6,7 +6,7 @@ LastEditTime: 2025-02-25 14:06:30 import asyncio import re from datetime import datetime -from typing import Protocol +from typing import Protocol, cast import anyio from funasr_onnx import SenseVoiceSmall @@ -55,7 +55,10 @@ class ProviderSenseVoiceSTTSelfHost(STTProvider): # 将模型加载放到线程池中执行 self.model = await asyncio.get_running_loop().run_in_executor( None, - lambda: SenseVoiceSmall(self.model_name, quantize=True, batch_size=16), + lambda: cast( + SenseVoiceModel, + SenseVoiceSmall(self.model_name, quantize=True, batch_size=16), + ), ) logger.info("SenseVoice 模型加载完成。") diff --git a/astrbot/core/provider/sources/xinference_rerank_source.py b/astrbot/core/provider/sources/xinference_rerank_source.py index ebba0a05a..97ac7fbcd 100644 --- a/astrbot/core/provider/sources/xinference_rerank_source.py +++ b/astrbot/core/provider/sources/xinference_rerank_source.py @@ -1,6 +1,5 @@ from xinference_client.client.restful.async_restful_client import AsyncClient as Client from xinference_client.client.restful.async_restful_client import ( - AsyncRESTfulModelHandle, AsyncRESTfulRerankModelHandle, ) diff --git a/astrbot/core/utils/tencent_record_helper.py b/astrbot/core/utils/tencent_record_helper.py index ec74eb421..768fe2773 100644 --- a/astrbot/core/utils/tencent_record_helper.py +++ b/astrbot/core/utils/tencent_record_helper.py @@ -14,9 +14,7 @@ from astrbot.core import logger from astrbot.core.utils.astrbot_path import get_astrbot_temp_path if TYPE_CHECKING: - from typing import Any - - import pilk # optional; stubs live under types/pilk.pyi + pass # pilk/p Moffmpeg are runtime optional deps async def tencent_silk_to_wav(silk_path: str, output_path: str) -> str: diff --git a/astrbot/dashboard/routes/chat.py b/astrbot/dashboard/routes/chat.py index ce2674c6b..2659c0db9 100644 --- a/astrbot/dashboard/routes/chat.py +++ b/astrbot/dashboard/routes/chat.py @@ -105,7 +105,7 @@ class BotMessageAccumulator: def __init__(self) -> None: self.parts: list[dict] = [] self.pending_text = "" - self.pending_tool_calls: dict[str, dict] = {} + self.pending_tool_calls: dict[str, Any] = {} def has_content(self) -> bool: return bool(self.parts or self.pending_text or self.pending_tool_calls)