mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-19 00:34:23 +01:00
set promptCacheKey for openai compatible providers (#4203)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
@@ -128,10 +128,15 @@ export namespace ProviderTransform {
|
||||
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> = {}
|
||||
|
||||
if (providerID === "openai") {
|
||||
if (providerID === "openai" || npm.includes("openai")) {
|
||||
result["promptCacheKey"] = sessionID
|
||||
}
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ export namespace SessionPrompt {
|
||||
: undefined,
|
||||
topP: agent.topP ?? ProviderTransform.topP(model.providerID, model.modelID),
|
||||
options: {
|
||||
...ProviderTransform.options(model.providerID, model.modelID, input.sessionID),
|
||||
...ProviderTransform.options(model.providerID, model.modelID, model.npm ?? "", input.sessionID),
|
||||
...model.info.options,
|
||||
...agent.options,
|
||||
},
|
||||
@@ -1819,7 +1819,7 @@ export namespace SessionPrompt {
|
||||
const small =
|
||||
(await Provider.getSmallModel(input.providerID)) ?? (await Provider.getModel(input.providerID, input.modelID))
|
||||
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,
|
||||
}
|
||||
if (small.providerID === "openai" || small.modelID.includes("gpt-5")) {
|
||||
|
||||
Reference in New Issue
Block a user