利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.
Python ai-video-generatorcontent-creationffmpeginstagram-reelsllmpythonshort-videosubtitlestext-to-speechtiktokvideo-automationvideo-workflowworkflow-automationyoutube-shorts
fix(state): preserve task fields in memory updates
Rudy Celeklid1b53f4ab41c
diff --git a/app/services/state.py b/app/services/state.pyindex 9fcdcc66..73a9c1fd 100644--- a/app/services/state.py+++ b/app/services/state.py@@ -76,6 +76,10 @@ class MemoryState(BaseState):with self._lock:self._tasks[task_id] = {+ # Keep fields from earlier pipeline stages, matching Redis+ # HSET updates. A progress-only update must not erase the+ # WebUI subject or diagnostic details already stored.+ **self._tasks.get(task_id, {}),"task_id": task_id,"state": state,"progress": progress,diff --git a/test/services/test_state.py b/test/services/test_state.pyindex c7726dfc..a66a4635 100644--- a/test/services/test_state.py+++ b/test/services/test_state.py@@ -73,6 +73,22 @@ class _FakeRedis:class TestMemoryState(unittest.TestCase):+ def test_progress_update_preserves_existing_task_details(self):+ state = MemoryState()+ state.update_task(+ "task-1",+ state=const.TASK_STATE_PROCESSING,+ video_subject="A day in Shanghai",+ material_sources=["source.mp4"],+ )++ state.update_task("task-1", progress=25)++ task = state.get_task("task-1")+ self.assertEqual(task["progress"], 25)+ self.assertEqual(task["video_subject"], "A day in Shanghai")+ self.assertEqual(task["material_sources"], ["source.mp4"])+def test_get_task_and_get_all_tasks_return_isolated_snapshots(self):state = MemoryState()state.update_task(