fix(fam-edge): 上传端点与签名修正 - Gemini 上传改用 /upload/v1beta/files 端点(原 /v1beta/files 非上传端点);NVIDIA PUT 用全小写 content-type 头(S3 预签名校验)
This commit is contained in:
@@ -126,7 +126,8 @@ class GeminiAdapter(BaseModelAdapter):
|
|||||||
name = os.path.basename(video_path)
|
name = os.path.basename(video_path)
|
||||||
size = os.path.getsize(video_path)
|
size = os.path.getsize(video_path)
|
||||||
upload_timeout = max(self.timeout, 900)
|
upload_timeout = max(self.timeout, 900)
|
||||||
base = f"{self._base_url}/files?key={self.api_key}"
|
# 上传端点必须是 /upload/v1beta/files(/v1beta/files 只是元数据端点,不接受上传协议)
|
||||||
|
base = f"https://generativelanguage.googleapis.com/upload/v1beta/files?key={self.api_key}"
|
||||||
# 1) 创建可续传上传会话
|
# 1) 创建可续传上传会话
|
||||||
try:
|
try:
|
||||||
r0 = requests.post(
|
r0 = requests.post(
|
||||||
|
|||||||
@@ -106,7 +106,9 @@ class NvidiaVisionAdapter(BaseModelAdapter):
|
|||||||
up = requests.put(
|
up = requests.put(
|
||||||
upload_url,
|
upload_url,
|
||||||
data=f,
|
data=f,
|
||||||
headers={"Content-Type": "application/octet-stream"},
|
# 注意:必须用小写 header 名,预签名 S3 URL 的签名覆盖小写 content-type
|
||||||
|
headers={"content-type": "application/octet-stream",
|
||||||
|
"x-amz-meta-nvcf-asset-description": "fam-edge video asset"},
|
||||||
timeout=upload_timeout,
|
timeout=upload_timeout,
|
||||||
)
|
)
|
||||||
except requests.Timeout:
|
except requests.Timeout:
|
||||||
|
|||||||
Reference in New Issue
Block a user