diff --git a/CHANGELOG.md b/CHANGELOG.md index edfac00..6398ea0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,17 @@ # 更新日志 (CHANGELOG) -## [v4.8.8] - feat(golden_quote): 重构金句分析匹配机制,尝试解决金句头像偶尔无法显示的问题,锐评中允许解析用户进行头像渲染 -* **✨ 解决金句头像无法显示**: 尝试解决金句头像无法显示的问题。通过将 Prompt 输入改为 [user_id] 标识符,实现 100% 准确的身份回填,彻底消除了由于 LLM 微调内容导致的匹配失败。 -* **✨ 报告发送优化**: 允许金句分析解析用户,渲染头像和名称,提升潜在的分析互动效果。 +## [v4.8.9] - fix: 群相册严格模式修复 (#111),尝试解决下载用户头像和重试地狱的问题 (#107) + ---
📋 点击查看历史更新日志 +## [v4.8.8] - feat(golden_quote): 重构金句分析匹配机制,尝试解决金句头像偶尔无法显示的问题,锐评中允许解析用户进行头像渲染 +* **✨ 解决金句头像无法显示**: 尝试解决金句头像无法显示的问题。通过将 Prompt 输入改为 [user_id] 标识符,实现 100% 准确的身份回填,彻底消除了由于 LLM 微调内容导致的匹配失败。 +* **✨ 报告发送优化**: 允许金句分析解析用户,渲染头像和名称,提升潜在的分析互动效果。 + ## [v4.8.7] - feat: 语义化 Trace ID 注入与报告标签 ([#103](https://github.com/SXP-Simon/astrbot_plugin_qq_group_daily_analysis/issues/103)) * **✨ 追踪可读性增强**: [TraceContext] 重构 TraceID 生成,支持包含群名和时间(如 manual_xxx群名称_时分),极大提升日志可读性,用户方便理解。 diff --git a/README.md b/README.md index 6faf6ff..80ede22 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # 群聊日常分析插件 -[![Plugin Version](https://img.shields.io/badge/Latest_Version-v4.8.8-blue.svg?style=for-the-badge&color=76bad9)](https://github.com/SXP-Simon/astrbot-qq-group-daily-analysis) +[![Plugin Version](https://img.shields.io/badge/Latest_Version-v4.8.9-blue.svg?style=for-the-badge&color=76bad9)](https://github.com/SXP-Simon/astrbot-qq-group-daily-analysis) [![AstrBot](https://img.shields.io/badge/AstrBot-Plugin-ff69b4?style=for-the-badge)](https://github.com/AstrBotDevs/AstrBot) [![License](https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge)](LICENSE) [![](https://img.shields.io/badge/五彩斑斓的Bug群-Bug反馈群&水群(QQ)-white?style=for-the-badge&color=76bad9&logo=qq&logoColor=76bad9)](https://qm.qq.com/q/oTzIrdDBIc) @@ -51,6 +51,12 @@ _✨ 一个基于 AstrBot 的智能群聊分析插件,支持 **QQ (OneBot)** > 注:群聊隐私模式关闭流程:`@BotFather`→左下角Open→选择要调整的bot→Bot Settings→将`Group Privacy`关闭 +> [!TIP] +> 如果无法正常生成图片,日志出现 `Endpoint https://t2i.soulter.top/text2img failed`、`Endpoint https://t2i.rcfortress.site/text2img failed` 这种情况,或者回退到文本发送总结,,可以考虑自部署 T2I 服务 +> 如果觉得麻烦,或者嫌自部署占用太多不必要的资源,使用 [@clown145 友情提供的 hf 羊毛 T2I 服务](https://clown145-astrbot-t2i-service.hf.space) +> +> **自部署 T2I 文档**:docs.astrbot.app/others/self-host-t2i.html + ### 🛠️ 灵活配置 - **多平台支持**: 自动识别并适配 OneBot, Discord, Telegram 等平台 diff --git a/metadata.yaml b/metadata.yaml index 619f70c..46a808b 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -1,7 +1,7 @@ name: astrbot_plugin_qq_group_daily_analysis # 这是你的插件的唯一识别名。 display_name: 群分析总结插件 # 插件的显示名称 desc: "[多平台接入开发中] 群日常分析总结插件 - 支持 QQ (aiocqhttp)、Telegram、Discord;生成精美的群聊分析报告,支持话题分析、用户形象、群聊圣经等功能" # 插件简短描述 -version: v4.8.8 # 插件版本号。格式:v1.1.1 或者 v1.1 +version: v4.8.9 # 插件版本号。格式:v1.1.1 或者 v1.1 author: SXP-Simon # 作者 astrbot_version: ">=4.16.0" support_platforms: diff --git a/src/infrastructure/reporting/generators.py b/src/infrastructure/reporting/generators.py index 5b21c37..73896f1 100644 --- a/src/infrastructure/reporting/generators.py +++ b/src/infrastructure/reporting/generators.py @@ -29,9 +29,9 @@ class ReportGenerator(IReportGenerator): # 使用专用的 T2I 并发配置项 max_concurrent = self.config_manager.get_t2i_max_concurrent() self._render_semaphore = asyncio.Semaphore(max_concurrent) - + # 运行时缓存,用于在一次分析任务中避免重复下载同一个头像 - self._runtime_avatar_cache = {} # user_id -> base64_uri + self._runtime_avatar_cache = {} # user_id -> base64_uri self._avatar_session = None async def generate_image_report( @@ -536,7 +536,7 @@ class ReportGenerator(IReportGenerator): # 0. 检查运行时缓存 if user_id in self._runtime_avatar_cache: return self._runtime_avatar_cache[user_id] - + res = await self._get_user_avatar_internal(user_id, avatar_getter) self._runtime_avatar_cache[user_id] = res return res @@ -544,11 +544,10 @@ class ReportGenerator(IReportGenerator): async def _get_user_avatar_internal(self, user_id: str, avatar_getter=None) -> str: """核心头像获取逻辑""" import base64 - + if not self._avatar_session: self._avatar_session = aiohttp.ClientSession( - trust_env=True, - timeout=aiohttp.ClientTimeout(total=15) + trust_env=True, timeout=aiohttp.ClientTimeout(total=15) ) try: @@ -612,16 +611,25 @@ class ReportGenerator(IReportGenerator): is_valid_image = True elif content.startswith(b"GIF8"): # GIF is_valid_image = True - elif content.startswith(b"RIFF") and b"WEBP" in content[:16]: # WebP + elif ( + content.startswith(b"RIFF") + and b"WEBP" in content[:16] + ): # WebP is_valid_image = True if is_valid_image: - await asyncio.to_thread(file_path.write_bytes, content) + await asyncio.to_thread( + file_path.write_bytes, content + ) file_content = content else: - logger.warning(f"下载的头像数据格式无效 ({safe_avatar_url})") + logger.warning( + f"下载的头像数据格式无效 ({safe_avatar_url})" + ) else: - logger.warning(f"下载头像失败 {safe_avatar_url}: {response.status}") + logger.warning( + f"下载头像失败 {safe_avatar_url}: {response.status}" + ) except Exception as e: logger.warning(f"下载头像网络错误 {safe_avatar_url}: {e}")