惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
博客园 - Franky
罗磊的独立博客
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
P
Proofpoint News Feed
Recent Announcements
Recent Announcements
V
V2EX
F
Fortinet All Blogs
阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
U
Unit 42
GbyAI
GbyAI
A
About on SuperTechFans
WordPress大学
WordPress大学
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
Martin Fowler
Martin Fowler
D
DataBreaches.Net
The Cloudflare Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MongoDB | Blog
MongoDB | Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(google): download direct veo video uri · openclaw/ope...
steipete · 2026-04-25 · via Recent Commits to openclaw:main

@@ -1,23 +1,25 @@

11

import { afterEach, describe, expect, it, vi } from "vitest";

223-

const { createGoogleGenAIMock, generateVideosMock, getVideosOperationMock } = vi.hoisted(() => {

4-

const generateVideosMock = vi.fn();

5-

const getVideosOperationMock = vi.fn();

6-

const createGoogleGenAIMock = vi.fn(() => {

7-

return {

8-

models: {

9-

generateVideos: generateVideosMock,

10-

},

11-

operations: {

12-

getVideosOperation: getVideosOperationMock,

13-

},

14-

files: {

15-

download: vi.fn(),

16-

},

17-

};

3+

const { createGoogleGenAIMock, downloadMock, generateVideosMock, getVideosOperationMock } =

4+

vi.hoisted(() => {

5+

const generateVideosMock = vi.fn();

6+

const getVideosOperationMock = vi.fn();

7+

const downloadMock = vi.fn();

8+

const createGoogleGenAIMock = vi.fn(() => {

9+

return {

10+

models: {

11+

generateVideos: generateVideosMock,

12+

},

13+

operations: {

14+

getVideosOperation: getVideosOperationMock,

15+

},

16+

files: {

17+

download: downloadMock,

18+

},

19+

};

20+

});

21+

return { createGoogleGenAIMock, downloadMock, generateVideosMock, getVideosOperationMock };

1822

});

19-

return { createGoogleGenAIMock, generateVideosMock, getVideosOperationMock };

20-

});

21232224

vi.mock("./google-genai-runtime.js", () => ({

2325

createGoogleGenAI: createGoogleGenAIMock,

@@ -30,6 +32,8 @@ import { buildGoogleVideoGenerationProvider } from "./video-generation-provider.

3032

describe("google video generation provider", () => {

3133

afterEach(() => {

3234

vi.restoreAllMocks();

35+

vi.unstubAllGlobals();

36+

downloadMock.mockReset();

3337

generateVideosMock.mockReset();

3438

getVideosOperationMock.mockReset();

3539

createGoogleGenAIMock.mockClear();

@@ -139,6 +143,51 @@ describe("google video generation provider", () => {

139143

);

140144

});

141145146+

it("downloads MLDev direct video uri responses without routing through the Files API", async () => {

147+

vi.spyOn(providerAuthRuntime, "resolveApiKeyForProvider").mockResolvedValue({

148+

apiKey: "google-key",

149+

source: "env",

150+

mode: "api-key",

151+

});

152+

generateVideosMock.mockResolvedValue({

153+

done: true,

154+

response: {

155+

generatedVideos: [

156+

{

157+

video: {

158+

uri: "https://generativelanguage.googleapis.com/v1beta/files/generated-video:download?alt=media",

159+

mimeType: "video/mp4",

160+

},

161+

},

162+

],

163+

},

164+

});

165+

const fetchMock = vi.fn(async () => {

166+

return new Response("direct-mp4", {

167+

status: 200,

168+

statusText: "OK",

169+

headers: { "content-type": "video/mp4" },

170+

});

171+

});

172+

vi.stubGlobal("fetch", fetchMock);

173+174+

const provider = buildGoogleVideoGenerationProvider();

175+

const result = await provider.generateVideo({

176+

provider: "google",

177+

model: "veo-3.1-fast-generate-preview",

178+

prompt: "A tiny robot watering a windowsill garden",

179+

cfg: {},

180+

durationSeconds: 3,

181+

});

182+183+

expect(fetchMock).toHaveBeenCalledWith(

184+

"https://generativelanguage.googleapis.com/v1beta/files/generated-video:download?alt=media&key=google-key",

185+

);

186+

expect(downloadMock).not.toHaveBeenCalled();

187+

expect(result.videos[0]?.buffer).toEqual(Buffer.from("direct-mp4"));

188+

expect(result.videos[0]?.mimeType).toBe("video/mp4");

189+

});

190+142191

it("does NOT strip /v1beta when it appears mid-path (end-anchor proof)", async () => {

143192

vi.spyOn(providerAuthRuntime, "resolveApiKeyForProvider").mockResolvedValue({

144193

apiKey: "google-key",