chore: 统一代码风格并进行现代化改造
本次提交主要包含以下内容: - **代码风格统一**:对多个文件进行了格式化,包括移除多余的空行、调整导入顺序、统一字符串引号等,以提高代码一致性和可读性。 - **类型提示现代化**:在多个文件中将旧的 `typing` 模块类型提示(如 `Optional[T]`、`List[T]`、`Union[T, U]`)更新为现代 Python 语法(`T | None`、`list[T]`、`T | U`)。 - **f-string 格式化**:在 `scripts/convert_manifest.py` 中,将 `.format()` 调用更新为更现代和易读的 f-string `!r` 表示法。 - **文件末尾换行符**:为多个文件添加或修正了文件末尾的换行符,遵循 POSIX 标准。
This commit is contained in:
committed by
Windpicker-owo
parent
778f2bbf1d
commit
a234e0b8aa
@@ -9,7 +9,6 @@ from src.chat.utils.prompt import Prompt
|
||||
from src.common.logger import get_logger
|
||||
from src.config.config import global_config, model_config
|
||||
from src.mood.mood_manager import mood_manager
|
||||
from .prompts import DECISION_PROMPT, PLAN_PROMPT
|
||||
from src.person_info.person_info import get_person_info_manager
|
||||
from src.plugin_system.apis import (
|
||||
chat_api,
|
||||
@@ -22,6 +21,8 @@ from src.plugin_system.apis import (
|
||||
send_api,
|
||||
)
|
||||
|
||||
from .prompts import DECISION_PROMPT, PLAN_PROMPT
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
|
||||
@@ -94,4 +94,4 @@ PLAN_PROMPT = Prompt(
|
||||
|
||||
现在,你说:
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
TTS 语音合成 Action
|
||||
"""
|
||||
|
||||
import toml
|
||||
from pathlib import Path
|
||||
|
||||
import toml
|
||||
|
||||
from src.common.logger import get_logger
|
||||
from src.plugin_system.base.base_action import ActionActivationType, BaseAction, ChatMode
|
||||
from src.plugin_system.base.base_action import BaseAction, ChatMode
|
||||
|
||||
from ..services.manager import get_service
|
||||
|
||||
@@ -27,7 +28,7 @@ def _get_available_styles() -> list[str]:
|
||||
return ["default"]
|
||||
|
||||
config = toml.loads(config_file.read_text(encoding="utf-8"))
|
||||
|
||||
|
||||
styles_config = config.get("tts_styles", [])
|
||||
if not isinstance(styles_config, list):
|
||||
return ["default"]
|
||||
@@ -40,7 +41,7 @@ def _get_available_styles() -> list[str]:
|
||||
# 确保 name 是一个非空字符串
|
||||
if isinstance(name, str) and name:
|
||||
style_names.append(name)
|
||||
|
||||
|
||||
return style_names if style_names else ["default"]
|
||||
except Exception as e:
|
||||
logger.error(f"动态加载TTS风格列表时出错: {e}", exc_info=True)
|
||||
|
||||
Reference in New Issue
Block a user