perf: 格式化

This commit is contained in:
anka
2025-03-26 17:59:30 +08:00
parent 5c14ebb049
commit 6b6577006d
3 changed files with 14 additions and 4 deletions
+8
View File
@@ -6,6 +6,8 @@ from typing import List
@dataclass
class Platform:
"""平台使用统计数据"""
name: str
count: int
timestamp: int
@@ -13,6 +15,8 @@ class Platform:
@dataclass
class Provider:
"""供应商使用统计数据"""
name: str
count: int
timestamp: int
@@ -20,6 +24,8 @@ class Provider:
@dataclass
class Plugin:
"""插件使用统计数据"""
name: str
count: int
timestamp: int
@@ -27,6 +33,8 @@ class Plugin:
@dataclass
class Command:
"""命令使用统计数据"""
name: str
count: int
timestamp: int
@@ -58,9 +58,9 @@ class LLMRequestSubStage(Stage):
if event.get_extra("provider_request"):
req = event.get_extra("provider_request")
assert isinstance(req, ProviderRequest), (
"provider_request 必须是 ProviderRequest 类型。"
)
assert isinstance(
req, ProviderRequest
), "provider_request 必须是 ProviderRequest 类型。"
if req.conversation:
req.contexts = json.loads(req.conversation.history)
@@ -156,7 +156,9 @@ class ResultDecorateStage(Stage):
self.ctx.astrbot_config["provider_tts_settings"]["enable"]
and result.is_llm_result()
):
tts_provider = self.ctx.plugin_manager.context.provider_manager.curr_tts_provider_inst
tts_provider = (
self.ctx.plugin_manager.context.provider_manager.curr_tts_provider_inst
)
new_chain = []
for comp in result.chain:
if isinstance(comp, Plain) and len(comp.text) > 1: