mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-20 09:14:22 +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
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user