- download_stat 新增 _task_queue / _completed_chats 与三个辅助函数 - 切频道前自动把上一个频道的最终进度快照进 completed_chats - save_and_restart(_multi) 启动任务时设置队列,供前端渲染总览 - 前端 banner 改为"任务队列"多卡片列表(✅已完成 / 🚀当前 / ⏳排队中), 含进度条、跳过明细;兼容单频道场景 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+15
-2
@@ -19,6 +19,8 @@ import utils
|
||||
from module.app import Application, ChatDownloadConfig, TaskNode
|
||||
from module.download_stat import (
|
||||
DownloadState,
|
||||
clear_completed_chats,
|
||||
set_task_queue,
|
||||
get_download_result,
|
||||
get_download_state,
|
||||
get_total_download_speed,
|
||||
@@ -840,12 +842,16 @@ def api_save_and_restart():
|
||||
|
||||
# Add to channel history
|
||||
_add_to_channel_history(chat_id, chat_title, chat_type)
|
||||
|
||||
|
||||
# 重置队列总览元信息(单频道场景队列就一项)
|
||||
clear_completed_chats()
|
||||
set_task_queue([{"chat_id": chat_id, "chat_title": chat_title or chat_id}])
|
||||
|
||||
# Trigger restart
|
||||
if _app:
|
||||
_app.restart_program = True
|
||||
logger.info(f"Restart flag set, new chat_id: {chat_id} ({chat_title})")
|
||||
|
||||
|
||||
return jsonify({
|
||||
"success": True,
|
||||
"message": f"配置已保存,正在重启下载 {chat_title or chat_id}..."
|
||||
@@ -897,6 +903,13 @@ def api_save_and_restart_multi():
|
||||
for it in normalized:
|
||||
_add_to_channel_history(it["chat_id"], it["chat_title"], it["chat_type"])
|
||||
|
||||
# 重置并设置本次任务的完整队列,供前端渲染"任务队列"卡片
|
||||
clear_completed_chats()
|
||||
set_task_queue([
|
||||
{"chat_id": it["chat_id"], "chat_title": it["chat_title"] or it["chat_id"]}
|
||||
for it in normalized
|
||||
])
|
||||
|
||||
# 触发重启
|
||||
if _app:
|
||||
_app.restart_program = True
|
||||
|
||||
Reference in New Issue
Block a user