set promptCacheKey for openai compatible providers (#4203)

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Shantur Rathore
2025-11-14 17:41:01 +00:00
committed by GitHub
parent 5fc26c958a
commit 986c60353e
2 changed files with 9 additions and 4 deletions

View File

@@ -128,10 +128,15 @@ export namespace ProviderTransform {
return undefined return undefined
} }
export function options(providerID: string, modelID: string, sessionID: string): Record<string, any> | undefined { export function options(
providerID: string,
modelID: string,
npm: string,
sessionID: string,
): Record<string, any> | undefined {
const result: Record<string, any> = {} const result: Record<string, any> = {}
if (providerID === "openai") { if (providerID === "openai" || npm.includes("openai")) {
result["promptCacheKey"] = sessionID result["promptCacheKey"] = sessionID
} }

View File

@@ -266,7 +266,7 @@ export namespace SessionPrompt {
: undefined, : undefined,
topP: agent.topP ?? ProviderTransform.topP(model.providerID, model.modelID), topP: agent.topP ?? ProviderTransform.topP(model.providerID, model.modelID),
options: { options: {
...ProviderTransform.options(model.providerID, model.modelID, input.sessionID), ...ProviderTransform.options(model.providerID, model.modelID, model.npm ?? "", input.sessionID),
...model.info.options, ...model.info.options,
...agent.options, ...agent.options,
}, },
@@ -1819,7 +1819,7 @@ export namespace SessionPrompt {
const small = const small =
(await Provider.getSmallModel(input.providerID)) ?? (await Provider.getModel(input.providerID, input.modelID)) (await Provider.getSmallModel(input.providerID)) ?? (await Provider.getModel(input.providerID, input.modelID))
const options = { const options = {
...ProviderTransform.options(small.providerID, small.modelID, input.session.id), ...ProviderTransform.options(small.providerID, small.modelID, small.npm ?? "", input.session.id),
...small.info.options, ...small.info.options,
} }
if (small.providerID === "openai" || small.modelID.includes("gpt-5")) { if (small.providerID === "openai" || small.modelID.includes("gpt-5")) {