fix(fam-edge): schema 对齐新架构 - parse_vlm_json 必填改 global_summary/events(兼容旧 frame_details/entities_json 转换);NVIDIA PUT content-type 值改为 video/mp4 与 POST 一致(预签名校验)

This commit is contained in:
ericwyuan
2026-08-21 11:47:33 +08:00
parent daf0f8377b
commit ab5b706eeb
2 changed files with 48 additions and 41 deletions

View File

@@ -74,6 +74,7 @@ class NvidiaVisionAdapter(BaseModelAdapter):
def _upload_asset(self, video_path: str) -> Optional[str]:
"""用 NVIDIA Assets API 上传大视频文件,返回 asset_id 供 video_url 引用。"""
content_type = "video/mp4"
upload_timeout = max(self.timeout, 900)
try:
r = requests.post(
@@ -82,7 +83,7 @@ class NvidiaVisionAdapter(BaseModelAdapter):
"Authorization": f"Bearer {self.api_key}",
"Content-Type": "application/json",
},
json={"contentType": "video/mp4", "description": "fam-edge video asset"},
json={"contentType": content_type, "description": "fam-edge video asset"},
timeout=60,
)
except Exception as e:
@@ -106,8 +107,9 @@ class NvidiaVisionAdapter(BaseModelAdapter):
up = requests.put(
upload_url,
data=f,
# 注意:必须小写 header 名,预签名 S3 URL 的签名覆盖小写 content-type
headers={"content-type": "application/octet-stream",
# 必须小写 header 名且 content-type 值与 POST 的 contentType 一致:
# 预签名 S3 URL 签名覆盖这两个值,不一致会 SignatureDoesNotMatch
headers={"content-type": content_type,
"x-amz-meta-nvcf-asset-description": "fam-edge video asset"},
timeout=upload_timeout,
)