diff --git a/utils/__pycache__/tweet_generator.cpython-312.pyc b/utils/__pycache__/tweet_generator.cpython-312.pyc index 0cb53a4..e68f878 100644 Binary files a/utils/__pycache__/tweet_generator.cpython-312.pyc and b/utils/__pycache__/tweet_generator.cpython-312.pyc differ diff --git a/utils/tweet_generator.py b/utils/tweet_generator.py index a52ef87..0d0c3b5 100644 --- a/utils/tweet_generator.py +++ b/utils/tweet_generator.py @@ -259,7 +259,17 @@ def prepare_topic_generation( # 创建AI Agent (still create agent here for the topic generation phase) try: print("Initializing AI Agent for topic generation...") - ai_agent = AI_Agent(config["api_url"], config["model"], config["api_key"]) + # --- Read timeout/retry from config --- + request_timeout = config.get("request_timeout", 30) # Default 30 seconds + max_retries = config.get("max_retries", 3) # Default 3 retries + # --- Pass values to AI_Agent --- + ai_agent = AI_Agent( + config["api_url"], + config["model"], + config["api_key"], + timeout=request_timeout, + max_retries=max_retries + ) except Exception as e: print(f"Error initializing AI Agent for topic generation: {e}") traceback.print_exc()