jihuaqiang hai 4 días
pai
achega
dc30327a2e
Modificáronse 3 ficheiros con 15 adicións e 12 borrados
  1. 8 3
      examples/demo.json
  2. 5 7
      examples/run_decode_script.py
  3. 2 2
      src/workflows/decode_workflow.py

+ 8 - 3
examples/demo.json

@@ -1,7 +1,12 @@
 [
     {
-        "channel_content_id": "58840748",
-        "video": "https://rescdn.yishihui.com/longvideo/transcode/video/vpc/20250929/ce8968e2f346103b83b75c0c8100028e.mp4",
-        "title": "🔴😂笑死了!让狗咬了,还要粘住嘴"
+        "video_id": "61626151",
+        "video_url": "https://rescdn.yishihui.com/pipeline/video/f522fd33-1556-4928-ab5a-c5afdd3c9688.mp4",
+        "title": "🔴退伍军人二次入伍的感人画面!若有战,召必回"
+    },
+    {
+        "video_id": "59287338",
+        "video_url": "https://rescdn.yishihui.com/longvideo/transcode/video/vpc/20251009/e60b87ac151510852f8c8f0447970983.mp4",
+        "title": "🔴那个年代穷吗?听听这段心里话!💔"
     }
 ]

+ 5 - 7
examples/run_decode_script.py

@@ -51,13 +51,11 @@ def save_json(path: Path, data: Dict[str, Any]) -> None:
 def build_decode_input(video_data: Dict[str, Any]) -> Dict[str, Any]:
     """根据视频数据构造 DecodeWorkflow 的输入结构"""
     return {
-        "video": video_data.get("video", ""),
-        "video_id": video_data.get("video_id", "") or video_data.get("channel_content_id", ""),  # 兼容旧字段名
+        "video_url": video_data.get("video_url", ""),
+        "video_id": video_data.get("video_id", ""),
         "title": video_data.get("title", ""),
-        "body_text": video_data.get("body_text", ""),
     }
 
-
 def main() -> None:
     """主函数"""
     base_dir = Path(__file__).parent
@@ -97,8 +95,8 @@ def main() -> None:
     existing_results: List[Dict[str, Any]] = output_data.get("results", []) or []
     # 用 video_id + video URL 去重,避免重复处理(兼容旧字段名 channel_content_id)
     processed_keys = {
-        f"{item.get('video_data', {}).get('video_id', '') or item.get('video_data', {}).get('channel_content_id', '')}|"
-        f"{item.get('video_data', {}).get('video', '')}"
+        f"{item.get('video_data', {}).get('video_id', '')}|"
+        f"{item.get('video_data', {}).get('video_url', '')}"
         for item in existing_results
     }
 
@@ -109,7 +107,7 @@ def main() -> None:
 
     # 处理每个视频
     for idx, video_data in enumerate(video_list, 1):
-        video_url = video_data.get("video", "")
+        video_url = video_data.get("video_url", "")
         video_id = video_data.get("video_id", "") or video_data.get("channel_content_id", "")  # 兼容旧字段名
         title = video_data.get("title", "")
 

+ 2 - 2
src/workflows/decode_workflow.py

@@ -882,13 +882,13 @@ class DecodeWorkflow(BaseGraphAgent):
             最终解码结果
         """
         logger.info("=== 开始执行解码工作流(视频分析) ===")
-
+        logger.info(f"input_data: {input_data}")
         # 确保工作流已初始化
         if not self.is_initialized:
             self.initialize()
 
         # 验证输入参数
-        video_url = input_data.get("video_", "")
+        video_url = input_data.get("video_url", "")
         if not video_url:
             error_msg = "未提供视频URL,无法执行工作流"
             logger.error(error_msg)