@danhachuel/thunderbolt 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/main.py +20 -8
- package/package.json +1 -1
package/app/main.py
CHANGED
|
@@ -694,6 +694,25 @@ def generate_topic_for_ui(settings: dict[str, Any], channel: dict, user_context:
|
|
|
694
694
|
return generate_topic_for_channel(settings, channel, blueprint_for_channel(channel), user_context=user_context)
|
|
695
695
|
|
|
696
696
|
|
|
697
|
+
def resolve_video_subject_for_generation(
|
|
698
|
+
settings: dict[str, Any],
|
|
699
|
+
channel: dict,
|
|
700
|
+
entered_subject: str,
|
|
701
|
+
blueprint: dict[str, Any] | None = None,
|
|
702
|
+
) -> tuple[str, dict[str, Any] | None]:
|
|
703
|
+
"""Keep the user's Video Subject or generate one only when the field is empty."""
|
|
704
|
+
manual_subject = str(entered_subject or "").strip()
|
|
705
|
+
if manual_subject:
|
|
706
|
+
return manual_subject, None
|
|
707
|
+
|
|
708
|
+
selected_blueprint = blueprint if isinstance(blueprint, dict) else blueprint_for_channel(channel)
|
|
709
|
+
topic_result = generate_topic_for_channel(settings, channel, selected_blueprint)
|
|
710
|
+
generated_subject = str(topic_result.get("topic") or "").strip()
|
|
711
|
+
if not generated_subject:
|
|
712
|
+
raise CreativeGenerationError("A IA não devolveu um Video Subject válido.")
|
|
713
|
+
return generated_subject, topic_result
|
|
714
|
+
|
|
715
|
+
|
|
697
716
|
def generate_video_content_for_ui(
|
|
698
717
|
settings: dict[str, Any],
|
|
699
718
|
channel: dict,
|
|
@@ -703,14 +722,7 @@ def generate_video_content_for_ui(
|
|
|
703
722
|
blueprint: dict[str, Any] | None = None,
|
|
704
723
|
) -> dict[str, Any]:
|
|
705
724
|
"""Generate the subject, script and English keywords in one MoneyPrinter-style action."""
|
|
706
|
-
subject =
|
|
707
|
-
topic_result: dict[str, Any] | None = None
|
|
708
|
-
if not subject:
|
|
709
|
-
selected_blueprint = blueprint if isinstance(blueprint, dict) else blueprint_for_channel(channel)
|
|
710
|
-
topic_result = generate_topic_for_channel(settings, channel, selected_blueprint)
|
|
711
|
-
subject = str(topic_result.get("topic") or "").strip()
|
|
712
|
-
if not subject:
|
|
713
|
-
raise CreativeGenerationError("A IA não devolveu um Video Subject válido.")
|
|
725
|
+
subject, topic_result = resolve_video_subject_for_generation(settings, channel, subject, blueprint)
|
|
714
726
|
|
|
715
727
|
blueprint = blueprint if isinstance(blueprint, dict) else blueprint_for_channel(channel)
|
|
716
728
|
script_result = generate_script_document(
|
package/package.json
CHANGED