2025-12-02 18:54:14 +08:00

1.0 KiB
Raw Permalink Blame History

变更:修复 DashScope 视频文件路径格式问题

原因

当前实现使用 file:// URL 格式传递视频文件路径给 DashScope API但 API 返回错误:"The provided URL does not appear to be valid"。

根据 DashScope 文档示例,应该直接传递绝对路径字符串,而不是 file:// URL 格式。文档中的示例代码显示:

local_path = "xxx/test.mp4"  # 绝对路径
video_path = f"file://{local_path}"

但实际上DashScope Python SDK 可能期望直接接收文件路径字符串,而不是 file:// URL。

变更内容

  • 修改 DashScopeService.analyze_video 方法,直接传递文件路径字符串而不是 file:// URL
  • 修改 DashScopeService.compare_videos 方法,同样使用路径字符串
  • 根据 DashScope SDK 的实际行为调整实现
  • 如果路径包含空格或特殊字符,确保正确处理

影响

  • 受影响的文件:app/services/dashscope_service.py
  • 修复后视频分析功能可以正常工作
  • 不影响其他功能