opencode-thinking-fix 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/proxy/proxy.js +28 -8
package/package.json
CHANGED
package/proxy/proxy.js
CHANGED
|
@@ -257,16 +257,36 @@ const server = http.createServer((req, res) => {
|
|
|
257
257
|
// Patch request body if this is a reasoning provider
|
|
258
258
|
let bodyToSend = rawBody
|
|
259
259
|
if (shouldPatch && rawBody.length > 0) {
|
|
260
|
-
// Inject reasoning_split for MiniMax models (avoids <think> tags in content)
|
|
261
|
-
const isMiniMax = modelName.toLowerCase().startsWith('minimax') || modelName.toLowerCase().startsWith('mimo')
|
|
262
260
|
let bodyStr = rawBody.toString('utf8')
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
261
|
+
try {
|
|
262
|
+
const bj = JSON.parse(bodyStr)
|
|
263
|
+
|
|
264
|
+
// Strip unsupported params for Kimi/Moonshot thinking mode
|
|
265
|
+
// Moonshot hardcodes sampling params for thinking models and rejects
|
|
266
|
+
// explicit values. Docs: https://platform.kimi.ai/docs/api/models-overview
|
|
267
|
+
const isKimi = modelName.toLowerCase().startsWith('kimi') || modelName.toLowerCase().startsWith('moonshot')
|
|
268
|
+
if (isKimi) {
|
|
269
|
+
delete bj.temperature
|
|
270
|
+
delete bj.top_p
|
|
271
|
+
delete bj.top_k
|
|
272
|
+
delete bj.presence_penalty
|
|
273
|
+
delete bj.frequency_penalty
|
|
274
|
+
delete bj.n
|
|
275
|
+
// K2.7 thinking is always on; do not send thinking/reasoning_effort controls
|
|
276
|
+
if (modelName.toLowerCase().startsWith('kimi-k2.7')) {
|
|
277
|
+
delete bj.thinking
|
|
278
|
+
delete bj.reasoning_effort
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Inject reasoning_split for MiniMax models (avoids <think> tags in content)
|
|
283
|
+
const isMiniMax = modelName.toLowerCase().startsWith('minimax') || modelName.toLowerCase().startsWith('mimo')
|
|
284
|
+
if (isMiniMax) {
|
|
266
285
|
bj.reasoning_split = true
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
bodyStr = JSON.stringify(bj)
|
|
289
|
+
} catch { /* pass */ }
|
|
270
290
|
const patched = patchRequestBody(bodyStr, sessionId)
|
|
271
291
|
bodyToSend = Buffer.from(patched, 'utf8')
|
|
272
292
|
}
|