From f2daf01f83ef77f8773146526475d1ab5d97ba6e Mon Sep 17 00:00:00 2001 From: jinye_huang Date: Fri, 25 Apr 2025 15:48:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BA=86utils=E9=87=8C?= =?UTF-8?q?=E5=AF=B9content=5Fgenerator=E7=9A=84=E8=B6=85=E6=97=B6?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 3 ++- utils/tweet_generator.py | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 4f1b72a..4fe57db 100644 --- a/main.py +++ b/main.py @@ -193,7 +193,8 @@ def generate_content_and_posters_step(config, run_id, topics_list, output_handle output_poster_subdir=poster_subdir, output_poster_filename=poster_filename, system_prompt=poster_content_system_prompt, - collage_style=collage_style + collage_style=collage_style, + timeout=request_timeout ) if posters_attempted: logging.info(f"Poster generation process completed for Topic {topic_index}.") diff --git a/utils/tweet_generator.py b/utils/tweet_generator.py index 1458a85..44a6302 100644 --- a/utils/tweet_generator.py +++ b/utils/tweet_generator.py @@ -455,7 +455,8 @@ def generate_posters_for_topic(topic_item: dict, output_poster_subdir: str, output_poster_filename: str, system_prompt: str, - collage_style: str + collage_style: str, + timeout: int ): """Generates all posters for a single topic item, handling image data via OutputHandler. @@ -477,7 +478,7 @@ def generate_posters_for_topic(topic_item: dict, output_poster_filename: Filename for the final poster. system_prompt: System prompt for content generation. output_handler: An instance of OutputHandler to process results. - + timeout: Timeout for content generation. Returns: True if poster generation was attempted (regardless of individual variant success), False if setup failed before attempting variants. @@ -572,7 +573,7 @@ def generate_posters_for_topic(topic_item: dict, # Generate Text Configurations for All Variants try: - poster_text_configs_raw = content_gen_instance.run(info_directory, variants, loaded_content_list, system_prompt) + poster_text_configs_raw = content_gen_instance.run(info_directory, variants, loaded_content_list, system_prompt, timeout=timeout) if not poster_text_configs_raw: logging.warning("Warning: ContentGenerator returned empty configuration data. Skipping posters.") return False