feat(ui): 添加播客生成失败重试功能

添加了播客生成失败后的重试功能,包括:
- 在播客卡片中显示失败状态和重试按钮
- 保存失败任务的输入文本内容以便重试
- 实现重试事件系统,将失败内容回填到创建组件
- 更新多语言支持中的失败和重试文本

同时修复了TTS配置中的语音名称错误,调整了遮罩层透明度,
并改进了路径获取逻辑以处理根路径情况。
This commit is contained in:
hex2077
2025-10-05 22:40:49 +08:00
parent 4c46677c19
commit 13d552bb57
12 changed files with 130 additions and 13 deletions

View File

@@ -256,6 +256,7 @@ async def _generate_podcast_task(
except Exception as e:
task_results[auth_id][task_id]["status"] = TaskStatus.FAILED
task_results[auth_id][task_id]["result"] = str(e)
task_results[auth_id][task_id]["input_txt_content"] = input_txt_content # 失败时保存输入文本
print(f"\nPodcast generation failed for task {task_id}: {e}")
finally: # 无论成功或失败,都尝试调用回调
if callback_url:
@@ -374,7 +375,8 @@ async def get_podcast_status(
"title": task_info.get("title"),
"tags": task_info.get("tags"),
"error": task_info["result"] if task_info["status"] == TaskStatus.FAILED else None,
"timestamp": task_info["timestamp"]
"timestamp": task_info["timestamp"],
"input_txt_content": task_info.get("input_txt_content"), # 添加输入文本内容
})
return {"message": "Tasks retrieved successfully.", "tasks": all_tasks_for_auth_id}

View File

@@ -340,8 +340,8 @@ def _parse_arguments():
parser.add_argument("--base-url", default="https://api.openai.com/v1", help="OpenAI API base URL (default: https://api.openai.com/v1).")
parser.add_argument("--model", default="gpt-3.5-turbo", help="OpenAI model to use (default: gpt-3.5-turbo).")
parser.add_argument("--threads", type=int, default=1, help="Number of threads to use for audio generation (default: 1).")
parser.add_argument("--output-language", type=str, default=None, help="Language for the podcast overview and script (default: Chinese).")
parser.add_argument("--usetime", type=str, default=None, help="Specific time to be mentioned in the podcast script, e.g., 10 minutes, 1 hour.")
parser.add_argument("--output-language", type=str, default="Chinese", help="Language for the podcast overview and script (default: Chinese).")
parser.add_argument("--usetime", type=str, default="Under 5 minutes", help="Specific time to be mentioned in the podcast script, e.g., 10 minutes, 1 hour.")
return parser.parse_args()