mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-30 14:14:20 +01:00
add optional headers field to model config (#3546)
This commit is contained in:
@@ -37,6 +37,7 @@ export namespace ModelsDev {
|
||||
experimental: z.boolean().optional(),
|
||||
status: z.enum(["alpha", "beta"]).optional(),
|
||||
options: z.record(z.string(), z.any()),
|
||||
headers: z.record(z.string(), z.string()).optional(),
|
||||
provider: z.object({ npm: z.string() }).optional(),
|
||||
})
|
||||
.meta({
|
||||
|
||||
@@ -306,6 +306,7 @@ export namespace Provider {
|
||||
input: ["text"],
|
||||
output: ["text"],
|
||||
},
|
||||
headers: model.headers,
|
||||
provider: model.provider ?? existing?.provider,
|
||||
}
|
||||
if (model.id && model.id !== modelID) {
|
||||
|
||||
@@ -150,6 +150,7 @@ export namespace SessionCompaction {
|
||||
maxRetries: 0,
|
||||
model: model.language,
|
||||
providerOptions: ProviderTransform.providerOptions(model.npm, model.providerID, model.info.options),
|
||||
headers: model.info.headers,
|
||||
abortSignal: signal,
|
||||
onError(error) {
|
||||
log.error("stream error", {
|
||||
|
||||
@@ -270,13 +270,15 @@ export namespace SessionPrompt {
|
||||
toolName: "invalid",
|
||||
}
|
||||
},
|
||||
headers:
|
||||
model.providerID === "opencode"
|
||||
headers: {
|
||||
...(model.providerID === "opencode"
|
||||
? {
|
||||
"x-opencode-session": input.sessionID,
|
||||
"x-opencode-request": userMsg.info.id,
|
||||
}
|
||||
: undefined,
|
||||
: undefined),
|
||||
...model.info.headers,
|
||||
},
|
||||
// set to 0, we handle loop
|
||||
maxRetries: 0,
|
||||
activeTools: Object.keys(tools).filter((x) => x !== "invalid"),
|
||||
@@ -1816,6 +1818,7 @@ export namespace SessionPrompt {
|
||||
},
|
||||
]),
|
||||
],
|
||||
headers: small.info.headers,
|
||||
model: small.language,
|
||||
})
|
||||
.then((result) => {
|
||||
|
||||
@@ -84,6 +84,7 @@ export namespace SessionSummary {
|
||||
content: textPart?.text ?? "",
|
||||
},
|
||||
],
|
||||
headers:small.info.headers,
|
||||
model: small.language,
|
||||
})
|
||||
log.info("title", { title: result.text })
|
||||
@@ -116,6 +117,7 @@ export namespace SessionSummary {
|
||||
`,
|
||||
},
|
||||
],
|
||||
headers: small.info.headers
|
||||
})
|
||||
summary = result.text
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user