Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix:修 AI编辑 时,任务stage0开始执行的bug

liubuyu131ccf2f01945
diff --git a/jiuwenswarm/server/runtime/skill_turbo/rails/skill_prompt_rail.py b/jiuwenswarm/server/runtime/skill_turbo/rails/skill_prompt_rail.py
index e23df163fa..2e541d651b 100644
--- a/jiuwenswarm/server/runtime/skill_turbo/rails/skill_prompt_rail.py
+++ b/jiuwenswarm/server/runtime/skill_turbo/rails/skill_prompt_rail.py
@@ -33,6 +33,8 @@ def _build_skill_turbo_guide_text(language: str) -> str:
若你已先调用了 `skill_tool` 加载了 pptx-craft 正文(即**不属于**上述例外,只是误触),**仍须立即调用 `skill_acceleration_exec`**——不要因"已经加载了 SKILL.md"或"已经做了研究"而放弃加速通道。
若 `skill_acceleration_exec` 返回成功(产物已生成),**禁止**再用 `skill_tool` 重复同一任务——直接向用户总结结果即可。若 `skill_acceleration_exec` 返回失败或未处理,**必须**继续用 `skill_tool` 加载对应技能走标准流程完成用户任务。
+
+🚫 **选区/编辑已有 PPT 排除(重要例外)**:当用户消息出现"PPT选区/选区原文/选区类型/选区位置/选区容器/选区 class/修改要求"等选区字段,或意图是**编辑、修改已有 PPT 文件的局部内容**(如改字体颜色、改某段文案、调某页样式、替换某区域)而非从零生成整套演示文稿时,**禁止调用 `skill_acceleration_exec`**——它只会从流水线 Stage 1 重新生成全新 PPT,无法复用已有文件做局部修改。此类请求请改用 `skill_tool` 加载 pptx-craft 标准流程(支持编辑已有 PPT),或直接用 `edit_file`/读写 pptx 的普通工具完成局部修改。
"""
return """## Skill Acceleration Channel (skill_acceleration_exec)
@@ -41,6 +43,8 @@ def _build_skill_turbo_guide_text(language: str) -> str:
If you have already mistakenly called `skill_tool` to load the pptx-craft body (i.e. this does **NOT** fall under the exception above - it was just a misfire), **you MUST still call `skill_acceleration_exec` immediately** - do NOT abandon the acceleration channel because "SKILL.md is already loaded" or "research is already done."
If `skill_acceleration_exec` returns success (the artifact is already generated), you are **forbidden** from calling `skill_tool` again for the same task — just summarize the result to the user. If `skill_acceleration_exec` returns failure or is not handled, you **MUST** fall back to `skill_tool` to load the corresponding skill and complete the user's task via the standard flow.
+
+🚫 **PPT region/edit-existing exclusion (critical exception)**: When the user message contains selection fields such as "PPT选区/选区原文/选区类型/选区位置/选区容器/选区 class/修改要求", or the intent is to **edit or modify a local part of an existing PPT file** (e.g. change font color, rewrite a paragraph, restyle a slide, replace a region) rather than generating a full deck from scratch, you are **FORBIDDEN from calling `skill_acceleration_exec`** — it only regenerates a brand-new PPT from pipeline Stage 1 and cannot reuse an existing file for local edits. For such requests, use `skill_tool` to load the pptx-craft standard flow (which supports editing existing PPTs), or directly use `edit_file` / pptx read-write tools to make the local change.
"""
diff --git a/jiuwenswarm/server/runtime/skill_turbo/skill_turbo_tools.py b/jiuwenswarm/server/runtime/skill_turbo/skill_turbo_tools.py
index 465f364fd4..7872f7a7f6 100644
--- a/jiuwenswarm/server/runtime/skill_turbo/skill_turbo_tools.py
+++ b/jiuwenswarm/server/runtime/skill_turbo/skill_turbo_tools.py
@@ -248,6 +248,39 @@ async def skill_turbo(query: str) -> dict[str, Any]:
})
# ── [/TEMP-TEMPLATE-BYPASS] ──
+ # ── [REGION-EDIT-BYPASS] 选区/编辑已有 PPT 请求拦截 ──
+ # office-claw 前端在用户选中 PPT 某区域做修改(改字体/文案/样式/局部替换)时,
+ # 注入的 user message 带固定选区字段(PPT选区/选区原文/选区类型/选区位置/选区容器/
+ # 选区 class/修改要求)。这类请求本质是"编辑已有 PPT 局部",而非从零生成整套演示文稿。
+ # skill 加速器(pptx-craft 流水线)只会从 Stage 1 重新生成全新 PPT,无法复用已有文件
+ # 做局部修改(第二次选区修复被 LLM 调进 skill_acceleration_exec,从 stage1 全量重跑,丢失原 PPT)。
+ # 信号源说明:理想信号在"外层 user message"里,而本工具拿到的 query 是 LLM 重写的
+ # 忠实总结——多数选区请求会保留"选区"字样,但 LLM 偶尔会脑补成"生成 N 页 PPT"
+ # (上述 case 即如此,query 变成"8页左右")。因此本块是对"query 保留选区语义"的兜底;
+ # 真正的主防线在 SkillTurboPromptRail 注入的排除提示词(LLM 调工具前能看到完整
+ # user message)。两层叠加降低误进概率。
+ # 删除方式:待 pptx-craft 流水线支持"编辑已有 PPT"短路分支后,搜索 [REGION-EDIT-BYPASS] 删除本块。
+ region_keywords = (
+ "PPT选区", "选区原文", "选区类型", "选区位置", "选区容器",
+ "选区 class", "选区class", "修改要求", "选区字段", "布局优化", "选区优化", "内容优化"
+ )
+ if any(kw in query for kw in region_keywords):
+ logger.info(
+ "[SkillTurboTool] 检测到 PPT 选区/编辑已有 PPT 请求,跳过 skill 加速器,"
+ "建议改用 skill_tool 走 pptx-craft 标准流程或直接编辑已有 PPT 文件"
+ )
+ return _wrap_skill_turbo_result({
+ "success": False,
+ "error": (
+ "检测到该请求是针对已有 PPT 某区域的局部修改(选区/编辑已有 PPT),"
+ "skill 加速器仅支持从零生成全新 PPT(会从 Stage 1 全量重跑,无法复用原文件)。"
+ "请改用 skill_tool 加载 pptx-craft 标准流程(支持编辑已有 PPT),"
+ "或直接用 edit_file / 读写 pptx 的工具完成局部修改"
+ "(直接执行,无需再调用 skill_acceleration_exec)。"
+ ),
+ })
+ # ── [/REGION-EDIT-BYPASS] ──
+
from jiuwenswarm.server.runtime.skill_turbo.agent import SkillTurbo, SkillTurboNotHandled
from jiuwenswarm.agents.harness.common.tools.subagent_executor import (
get_subagent_parent_session,