@miller-tech/uap 1.4.2 → 1.4.3
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
CHANGED
|
@@ -32,9 +32,10 @@ const PROXY_PORT = parseInt(process.env.PROXY_PORT || '11435', 10);
|
|
|
32
32
|
const TARGET_URL = process.env.TARGET_URL || 'http://127.0.0.1:8080';
|
|
33
33
|
const FORCE_TOOL_CHOICE = process.env.FORCE_TOOL_CHOICE || 'required';
|
|
34
34
|
|
|
35
|
-
// Temperature cap: clamp temperature to this value when tools are present
|
|
36
|
-
//
|
|
37
|
-
|
|
35
|
+
// Temperature cap: clamp temperature to this value when tools are present.
|
|
36
|
+
// Must be >= the wrapper's dynamic_temp_floor (0.2 for Qwen3.5) to avoid
|
|
37
|
+
// overriding the wrapper's retry temperature strategy. Set to 0 to disable.
|
|
38
|
+
const MAX_TOOL_TEMPERATURE = parseFloat(process.env.MAX_TOOL_TEMPERATURE || '0.4');
|
|
38
39
|
|
|
39
40
|
// Budget: stop forcing tool calls after this many chat/completions requests
|
|
40
41
|
const SOFT_BUDGET = parseInt(process.env.PROXY_SOFT_BUDGET || '35', 10);
|
|
@@ -224,6 +225,13 @@ const server = http.createServer((req, res) => {
|
|
|
224
225
|
},
|
|
225
226
|
},
|
|
226
227
|
(proxyRes) => {
|
|
228
|
+
// CRITICAL: writeHead MUST be called before any res.write() calls.
|
|
229
|
+
// Previously this was after the event listener setup, causing a race
|
|
230
|
+
// condition where data events could fire before headers were sent,
|
|
231
|
+
// producing malformed HTTP responses that broke OpenAI client parsing
|
|
232
|
+
// and caused Qwen3.5 tool call test failures.
|
|
233
|
+
res.writeHead(proxyRes.statusCode || 200, proxyRes.headers);
|
|
234
|
+
|
|
227
235
|
// === Track response for output-diff detection ===
|
|
228
236
|
const responseChunks = [];
|
|
229
237
|
proxyRes.on('data', (chunk) => {
|
|
@@ -265,8 +273,6 @@ const server = http.createServer((req, res) => {
|
|
|
265
273
|
}
|
|
266
274
|
}
|
|
267
275
|
});
|
|
268
|
-
|
|
269
|
-
res.writeHead(proxyRes.statusCode || 200, proxyRes.headers);
|
|
270
276
|
}
|
|
271
277
|
);
|
|
272
278
|
|