@@ -36,3 +36,11 @@ legacy_model = "turbo"
|
||||
[AIGenImage.llm]
|
||||
scene = "image.generate"
|
||||
image_endpoint = "images/generations"
|
||||
|
||||
[runtime]
|
||||
# AI 绘图属于长耗时命令:
|
||||
# 1. 上游模型生成、下载与落盘都可能持续几十秒到数分钟;
|
||||
# 2. 这里启用 background,让它在后台任务池里跑,避免长期占住前台消息并发槽位;
|
||||
# 3. 超时时间放宽到 7 分钟,兼容慢模型或高峰期图像生成延迟。
|
||||
message_dispatch_mode = "background"
|
||||
plugin_process_timeout_seconds = 420
|
||||
|
||||
@@ -26,3 +26,11 @@ summary_image_template_path = "plugins/message_summary/templates/gemini_summary_
|
||||
template_viewport_width = 580
|
||||
template_viewport_height = 960
|
||||
template_device_scale_factor = 2.0
|
||||
|
||||
[runtime]
|
||||
# 群总结属于典型长任务:
|
||||
# 1. 生成期间会查库、调 LLM、渲染图片,整体耗时明显高于普通命令;
|
||||
# 2. 因此这里改为 background,让命令命中后转入后台任务池,不再占住前台 20 个消息处理槽位;
|
||||
# 3. 同时把插件总超时放宽到 10 分钟,避免长总结被全局保护策略过早截断。
|
||||
message_dispatch_mode = "background"
|
||||
plugin_process_timeout_seconds = 600
|
||||
|
||||
@@ -4,7 +4,7 @@ command = ["菜单", "功能菜单"]
|
||||
# 菜单输出模式:
|
||||
# - text:发送文本菜单(历史行为)
|
||||
# - image:先用 md2image 将 Markdown 渲染为图片后发送
|
||||
output_mode = "image"
|
||||
output_mode = "text"
|
||||
# 图片生成失败时是否回退文本菜单:
|
||||
# - false:严格按图片模式,不发送完整菜单文本
|
||||
# - true:优先保证可达,失败后改发文本
|
||||
|
||||
@@ -94,11 +94,14 @@ class RobotMenuPlugin(MessagePluginInterface):
|
||||
self.sync_send_timeout_seconds = int(
|
||||
self._config.get("RobotMenu", {}).get("sync_send_timeout_seconds", 18)
|
||||
)
|
||||
# 对外层插件保护显式声明一个更合适的总超时:
|
||||
# 1. 内层菜单发送会在 sync_send_timeout_seconds 内决定“成功发图 / 回退文本 / 返回失败提示”;
|
||||
# 2. 外层 wait_for 必须比内层稍长,给降级发送文本留出缓冲;
|
||||
# 3. 这样可以避免过去“内外层都卡在 55 秒”时,外层先打断,导致降级逻辑来不及执行。
|
||||
self.plugin_process_timeout_seconds = max(12, self.sync_send_timeout_seconds + 8)
|
||||
# 只有在图片模式下,菜单插件才需要声明更紧的外层超时预算:
|
||||
# 1. 文本模式本身非常快,没有必要覆盖全局默认超时;
|
||||
# 2. 图片模式下才需要给“渲染 + 文本回退”预留一个略大于内层预算的缓冲区;
|
||||
# 3. 这样默认文本模式下不会额外引入无意义的超时特化逻辑。
|
||||
if RobotMenuRenderTool.normalize_output_mode(output_mode) == "image":
|
||||
self.plugin_process_timeout_seconds = max(12, self.sync_send_timeout_seconds + 8)
|
||||
elif hasattr(self, "plugin_process_timeout_seconds"):
|
||||
delattr(self, "plugin_process_timeout_seconds")
|
||||
# 菜单图片模板文件路径(相对仓库根目录):
|
||||
# 调整样式和布局时只改模板,不改 Python 逻辑。
|
||||
self.image_template_path = str(
|
||||
|
||||
Reference in New Issue
Block a user