

























@@ -113,13 +113,14 @@ describe("openrouter media understanding provider", () => {
113113fetchFn: fetch,
114114});
115115116-expect(postJsonRequestMock).toHaveBeenCalledWith(
117-expect.objectContaining({
118-body: expect.objectContaining({
119-temperature: 0.2,
120-}),
121-}),
122-);
116+expect(postJsonRequestMock.mock.calls.at(0)?.[0]?.body).toEqual({
117+model: "openai/whisper-large-v3-turbo",
118+input_audio: {
119+data: Buffer.from("audio").toString("base64"),
120+format: "webm",
121+},
122+temperature: 0.2,
123+});
123124});
124125125126it("falls back to filename extension when mime is missing", async () => {
@@ -137,13 +138,13 @@ describe("openrouter media understanding provider", () => {
137138fetchFn: fetch,
138139});
139140140-expect(postJsonRequestMock).toHaveBeenCalledWith(
141-expect.objectContaining({
142- body: expect.objectContaining({
143- input_audio: expect.objectContaining({ format: "ogg" }),
144-}),
145-}),
146-);
141+expect(postJsonRequestMock.mock.calls.at(0)?.[0]?.body).toEqual({
142+model: "openai/whisper-large-v3-turbo",
143+input_audio: {
144+data: Buffer.from("audio").toString("base64"),
145+format: "ogg",
146+},
147+});
147148});
148149149150it("maps mp4 filename extension to m4a when mime is missing", async () => {
@@ -161,13 +162,13 @@ describe("openrouter media understanding provider", () => {
161162fetchFn: fetch,
162163});
163164164-expect(postJsonRequestMock).toHaveBeenCalledWith(
165-expect.objectContaining({
166- body: expect.objectContaining({
167- input_audio: expect.objectContaining({ format: "m4a" }),
168-}),
169-}),
170-);
165+expect(postJsonRequestMock.mock.calls.at(0)?.[0]?.body).toEqual({
166+model: "openai/whisper-large-v3-turbo",
167+input_audio: {
168+data: Buffer.from("audio").toString("base64"),
169+format: "m4a",
170+},
171+});
171172});
172173173174it("normalizes parameterized mime for extensionless filenames", async () => {
@@ -186,13 +187,13 @@ describe("openrouter media understanding provider", () => {
186187fetchFn: fetch,
187188});
188189189-expect(postJsonRequestMock).toHaveBeenCalledWith(
190-expect.objectContaining({
191- body: expect.objectContaining({
192- input_audio: expect.objectContaining({ format: "ogg" }),
193-}),
194-}),
195-);
190+expect(postJsonRequestMock.mock.calls.at(0)?.[0]?.body).toEqual({
191+model: "openai/whisper-large-v3-turbo",
192+input_audio: {
193+data: Buffer.from("audio").toString("base64"),
194+format: "ogg",
195+},
196+});
196197});
197198198199it("throws when format cannot be resolved", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。