fix(opencode): normalize Muse Free tool choice
OpenCode Free returns HTTP 400 for muse-spark-1.3-contributor-free when tool_choice is non-auto. Declare forceAutoToolChoiceModels quirk and normalize explicit tool_choice to auto.
This commit is contained in:
@@ -411,6 +411,11 @@ export class OpenCodeExecutor extends BaseExecutor {
|
||||
transformRequest(model, body, stream, credentials) {
|
||||
if (body && typeof body === "object" && model && !body.model) body.model = model;
|
||||
if (isResponsesModel(model || body?.model) && body && typeof body === "object") {
|
||||
// ponytail: chỉ model đã xác nhận auto-only; mở allowlist khi có bằng chứng.
|
||||
if ("tool_choice" in body && body.tool_choice !== "auto"
|
||||
&& this.config.quirks?.forceAutoToolChoiceModels?.includes(baseModelId(model))) {
|
||||
body.tool_choice = "auto";
|
||||
}
|
||||
const normalized = normalizeResponsesInput(body.input);
|
||||
if (normalized) body.input = normalized;
|
||||
if (!Array.isArray(body.input) || body.input.length === 0) {
|
||||
|
||||
@@ -18,6 +18,9 @@ export default {
|
||||
"x-opencode-client": "desktop",
|
||||
},
|
||||
noAuth: true,
|
||||
quirks: {
|
||||
forceAutoToolChoiceModels: ["muse-spark-1.3-contributor-free"],
|
||||
},
|
||||
},
|
||||
models: [
|
||||
// Endpoint formats differ per model, so declare non-chat models explicitly.
|
||||
|
||||
Reference in New Issue
Block a user