From 2f3fb5e5d22fbc321e6940c5daafd38dfb1f0d04 Mon Sep 17 00:00:00 2001
From: hit-cxf <2024111082@stu.hit.edu.cn>
Date: Wed, 08 Apr 2026 16:13:54 +0800
Subject: [PATCH] 续写提示词

---
 aigc-director/aigc-claw/backend/core/orchestrator.py |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/aigc-director/aigc-claw/backend/core/orchestrator.py b/aigc-director/aigc-claw/backend/core/orchestrator.py
index 56fc515..1fa6121 100644
--- a/aigc-director/aigc-claw/backend/core/orchestrator.py
+++ b/aigc-director/aigc-claw/backend/core/orchestrator.py
@@ -205,7 +205,6 @@
                 return
 
             # 如果有 progress 回调(纯文字阶段),也定期保存
-            # 这样前端可以实时看到文字生成进度
             current_time = time.time()
             if current_time - last_save_time["time"] >= SAVE_INTERVAL:
                 last_save_time["time"] = current_time
@@ -220,10 +219,14 @@
 
         try:
             result = await agent.process(input_data, intervention=intervention)
+            if not isinstance(result, dict):
+                logger.error(f"[execute_stage] Agent {stage.value} returned non-dict result: {type(result)}")
+                result = {"payload": result}
+            
             state.artifacts[stage.value] = result.get("payload")
 
-            # 第三阶段修改分镜时:同步更新第四、第五阶段的相关内容
-            if stage.value == "storyboard" and intervention and "modified_storyboard" in intervention:
+            # 只有在 storyboard 阶段明确有修改时才执行同步
+            if stage.value == "storyboard" and isinstance(intervention, dict) and "modified_storyboard" in intervention:
                 modified_shots = intervention["modified_storyboard"]
                 if isinstance(modified_shots, list):
                     shot_durations = {s.get('shot_id'): s.get('duration', 10)
@@ -413,7 +416,13 @@
             if state.meta:
                 for k, v in state.meta.items():
                     if v is not None:
-                        data[k] = v
+                        # 转换并保持原始类型(尤其是布尔值)
+                        if isinstance(v, str) and v.lower() == 'true':
+                            data[k] = True
+                        elif isinstance(v, str) and v.lower() == 'false':
+                            data[k] = False
+                        else:
+                            data[k] = v
 
         # 原子写入:先写临时文件,再重命名
         dir_path = os.path.dirname(path)

--
Gitblit v1.8.0