修改了json文件的配置路径

This commit is contained in:
jinye_huang 2025-04-22 17:46:21 +08:00
parent c9e17016b5
commit 58add25adb
2 changed files with 14 additions and 1 deletions

View File

@ -556,6 +556,19 @@ def generate_posters_for_topic(config, topic_item, tweet_content_list, output_di
if not poster_text_configs_raw:
logging.warning("Warning: ContentGenerator returned empty configuration data. Skipping posters.")
return False
# --- Save the COMPLETE poster configs list for this topic ---
run_output_dir_base = os.path.join(output_dir, run_id)
topic_config_save_path = os.path.join(run_output_dir_base, f"topic_{topic_index}_poster_configs.json")
try:
# Assuming poster_text_configs_raw is JSON-serializable (likely a list/dict)
with open(topic_config_save_path, 'w', encoding='utf-8') as f_cfg_topic:
json.dump(poster_text_configs_raw, f_cfg_topic, ensure_ascii=False, indent=4)
logging.info(f"Saved complete poster configurations for topic {topic_index} to: {topic_config_save_path}")
except Exception as save_err:
logging.error(f"Failed to save complete poster configurations for topic {topic_index} to {topic_config_save_path}: {save_err}")
# --- End Save Complete Config ---
poster_config_summary = core_posterGen.PosterConfig(poster_text_configs_raw)
except Exception as e:
logging.exception("Error running ContentGenerator or parsing poster configs:")
@ -579,7 +592,7 @@ def generate_posters_for_topic(config, topic_item, tweet_content_list, output_di
continue
# Define output directories for this specific variant
run_output_dir = os.path.join(output_dir, run_id) # Base dir for the run
run_output_dir = os.path.join(output_dir, run_id)
variant_output_dir = os.path.join(run_output_dir, f"{topic_index}_{variant_index}")
output_collage_subdir = config.get("output_collage_subdir", "collage_img")
output_poster_subdir = config.get("output_poster_subdir", "poster")