fix(template-utils): str.format -> string.Template (#149)

* feat: upgrade prompt templates from str.format to string.Template for improved compatibility

* fix(get_astrbot_data_path): fallback 到 get_astrbot_data_path 方法

* feat: upgrade prompt templates from str.format to string.Template for improved compatibility

* fix: strict mode

* fix: 补齐文件名格式的自动迁移

* fix(ChatQualityAnalyzer): 删除无效的 prompt 提示语句

* ruff

---------

Co-authored-by: SXP-Simon <sxp20061207@163.com>
This commit is contained in:
leko
2026-04-02 16:40:34 +08:00
committed by GitHub
co-authored by SXP-Simon
parent 5e2da8c852
commit 47eeff3f61
9 changed files with 232 additions and 37 deletions
+6
View File
@@ -220,6 +220,12 @@ class GroupDailyAnalysis(Star):
logger.info(f"正在执行插件初始化 (来源: {source})...")
# 0. 自动升级旧版 prompt 模板(str.format -> string.Template)并回写配置
try:
self.config_manager.upgrade_prompt_templates()
except Exception as e:
logger.warning(f"自动升级 prompt 模板失败: {e}")
# 1. 尝试发现 bot 实例
await self.bot_manager.initialize_from_config()