@danhachuel/thunderbolt 0.6.2 → 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.
Files changed (2) hide show
  1. package/app/main.py +20 -13
  2. 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,19 +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
- entered_subject = str(subject or "").strip()
707
- subject = entered_subject
708
- topic_result: dict[str, Any] | None = None
709
- if entered_subject:
710
- # Um Video Subject escrito pelo utilizador é sempre o tema editorial;
711
- # nunca o substituímos por um tópico aleatório gerado pela IA.
712
- subject = entered_subject
713
- else:
714
- selected_blueprint = blueprint if isinstance(blueprint, dict) else blueprint_for_channel(channel)
715
- topic_result = generate_topic_for_channel(settings, channel, selected_blueprint)
716
- subject = str(topic_result.get("topic") or "").strip()
717
- if not subject:
718
- 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)
719
726
 
720
727
  blueprint = blueprint if isinstance(blueprint, dict) else blueprint_for_channel(channel)
721
728
  script_result = generate_script_document(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.6.02",
3
+ "version": "0.6.03",
4
4
  "description": "Thunderbolt — interface local para operação de canais faceless e motor MoneyPrinterTurbo",
5
5
  "license": "MIT",
6
6
  "main": "scripts/cli.mjs",