fix(provider): deep merge providerOptions in applyCaching (#10323)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import type { APICallError, ModelMessage } from "ai"
|
import type { APICallError, ModelMessage } from "ai"
|
||||||
import { unique } from "remeda"
|
import { mergeDeep, unique } from "remeda"
|
||||||
import type { JSONSchema } from "zod/v4/core"
|
import type { JSONSchema } from "zod/v4/core"
|
||||||
import type { Provider } from "./provider"
|
import type { Provider } from "./provider"
|
||||||
import type { ModelsDev } from "./models"
|
import type { ModelsDev } from "./models"
|
||||||
@@ -186,18 +186,12 @@ export namespace ProviderTransform {
|
|||||||
if (shouldUseContentOptions) {
|
if (shouldUseContentOptions) {
|
||||||
const lastContent = msg.content[msg.content.length - 1]
|
const lastContent = msg.content[msg.content.length - 1]
|
||||||
if (lastContent && typeof lastContent === "object") {
|
if (lastContent && typeof lastContent === "object") {
|
||||||
lastContent.providerOptions = {
|
lastContent.providerOptions = mergeDeep(lastContent.providerOptions ?? {}, providerOptions)
|
||||||
...lastContent.providerOptions,
|
|
||||||
...providerOptions,
|
|
||||||
}
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.providerOptions = {
|
msg.providerOptions = mergeDeep(msg.providerOptions ?? {}, providerOptions)
|
||||||
...msg.providerOptions,
|
|
||||||
...providerOptions,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return msgs
|
return msgs
|
||||||
|
|||||||
Reference in New Issue
Block a user