修复了Poster content generator的生成

This commit is contained in:
jinye_huang 2025-04-29 11:11:22 +08:00
parent d684323aa6
commit 35a6bd5dfc
2 changed files with 6 additions and 3 deletions

View File

@ -195,11 +195,14 @@ class ContentGenerator:
poster_num, poster_num,
content_data_list, content_data_list,
system_prompt=None, system_prompt=None,
api_url=None,
model_name=None,
api_key=None,
timeout=60, timeout=60,
max_retries=3): max_retries=3):
""" """
生成海报内容 生成海报内容
参数: 参数:
poster_num: 海报数量 poster_num: 海报数量
content_data_list: 内容数据列表字典或字符串 content_data_list: 内容数据列表字典或字符串
@ -319,7 +322,7 @@ class ContentGenerator:
full_response = "" full_response = ""
try: try:
# 使用AI_Agent的non-streaming方法 # 使用AI_Agent的non-streaming方法
self.logger.info(f"调用AI生成海报配置模型: {model_name}") self.logger.info(f"调用AI生成海报配置模型: {self.model_name}")
full_response, tokens, time_cost = ai_agent.work( full_response, tokens, time_cost = ai_agent.work(
system_prompt, system_prompt,
user_content, user_content,
@ -570,7 +573,7 @@ class ContentGenerator:
model_name, model_name,
api_key, api_key,
timeout=timeout, timeout=timeout,
) )
# 检查生成是否失败 # 检查生成是否失败
if not isinstance(full_response, str) or not full_response.strip(): if not isinstance(full_response, str) or not full_response.strip():