Spaces:
Build error
Build error
Update aduc_framework/engineers/planner_4d.py
Browse files
aduc_framework/engineers/planner_4d.py
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
# aduc_framework/engineers/planner_4d.py
|
| 2 |
#
|
| 3 |
-
#
|
|
|
|
|
|
|
| 4 |
#
|
| 5 |
# A lógica de tratamento de casos especiais foi movida para o Deformes4D.
|
| 6 |
# Este planner agora simplesmente delega a geração de cada cena,
|
| 7 |
-
# independentemente do número de keyframes
|
|
|
|
| 8 |
|
| 9 |
import logging
|
| 10 |
from typing import List, Dict, Any, Generator
|
|
@@ -57,8 +60,34 @@ class Planner4D:
|
|
| 57 |
chat_history.append({"role": "Planner4D", "content": f"Cena {i+1} resultou em um clipe vazio e foi pulada."})
|
| 58 |
yield {"chat": chat_history}
|
| 59 |
|
| 60 |
-
|
| 61 |
except Exception as e:
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# aduc_framework/engineers/planner_4d.py
|
| 2 |
#
|
| 3 |
+
# Copyright (C) August 4, 2025 Carlos Rodrigues dos Santos
|
| 4 |
+
#
|
| 5 |
+
# Versão 3.3.0 (Gerente de Produção Simplificado e Final)
|
| 6 |
#
|
| 7 |
# A lógica de tratamento de casos especiais foi movida para o Deformes4D.
|
| 8 |
# Este planner agora simplesmente delega a geração de cada cena,
|
| 9 |
+
# independentemente do número de keyframes, confiando na inteligência
|
| 10 |
+
# do motor de geração.
|
| 11 |
|
| 12 |
import logging
|
| 13 |
from typing import List, Dict, Any, Generator
|
|
|
|
| 60 |
chat_history.append({"role": "Planner4D", "content": f"Cena {i+1} resultou em um clipe vazio e foi pulada."})
|
| 61 |
yield {"chat": chat_history}
|
| 62 |
|
|
|
|
| 63 |
except Exception as e:
|
| 64 |
+
error_msg = f"Erro ao filmar a Cena {i+1}: {e}"
|
| 65 |
+
logger.error(error_msg, exc_info=True)
|
| 66 |
+
chat_history.append({"role": "Sistema", "content": f"ERRO CRÍTICO na produção da Cena {i+1}: {error_msg}"})
|
| 67 |
+
yield {"chat": chat_history}
|
| 68 |
+
continue
|
| 69 |
+
|
| 70 |
+
if not all_scene_clips_paths:
|
| 71 |
+
chat_history.append({"role": "Planner4D", "content": "Nenhum clipe de cena foi gerado. Produção encerrada."})
|
| 72 |
+
yield {"chat": chat_history, "status": "production_complete"}
|
| 73 |
+
return
|
| 74 |
+
|
| 75 |
+
chat_history.append({"role": "Planner4D", "content": "Todas as cenas foram filmadas. Montando o filme final..."})
|
| 76 |
+
yield {"chat": chat_history}
|
| 77 |
+
|
| 78 |
+
final_video_path = editor.concatenate_clips(all_scene_clips_paths)
|
| 79 |
+
|
| 80 |
+
chat_history.append({"role": "Planner4D", "content": "Montagem finalizada! O filme está pronto."})
|
| 81 |
|
| 82 |
+
generation_state["videos_atos"] = [{"id": 0, "caminho_pixel": final_video_path, "caminhos_latentes_fragmentos": []}]
|
| 83 |
+
generation_state["chat_history"] = chat_history
|
| 84 |
+
|
| 85 |
+
yield {
|
| 86 |
+
"chat": chat_history,
|
| 87 |
+
"final_video_path": final_video_path,
|
| 88 |
+
"status": "production_complete",
|
| 89 |
+
"dna": generation_state
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
# --- Instância Singleton ---
|
| 93 |
+
planner_4d_singleton = Planner4D()
|