mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-17 14:45:11 +08:00
Merge pull request #142 from CJackHwang/dev
Merge pull request #141 from CJackHwang/codex/investigate-json-leakage-in-vercel-deployment-rh84s1 Fix raw tool-call JSON leaks when feature_match mode is off
This commit is contained in:
@@ -128,8 +128,8 @@ func (h *Handler) handleStream(w http.ResponseWriter, r *http.Request, resp *htt
|
|||||||
}
|
}
|
||||||
|
|
||||||
created := time.Now().Unix()
|
created := time.Now().Unix()
|
||||||
bufferToolContent := len(toolNames) > 0 && h.toolcallFeatureMatchEnabled()
|
bufferToolContent := len(toolNames) > 0
|
||||||
emitEarlyToolDeltas := h.toolcallEarlyEmitHighConfidence()
|
emitEarlyToolDeltas := h.toolcallFeatureMatchEnabled() && h.toolcallEarlyEmitHighConfidence()
|
||||||
initialType := "text"
|
initialType := "text"
|
||||||
if thinkingEnabled {
|
if thinkingEnabled {
|
||||||
initialType = "thinking"
|
initialType = "thinking"
|
||||||
|
|||||||
@@ -146,8 +146,8 @@ func (h *Handler) handleResponsesStream(w http.ResponseWriter, r *http.Request,
|
|||||||
if thinkingEnabled {
|
if thinkingEnabled {
|
||||||
initialType = "thinking"
|
initialType = "thinking"
|
||||||
}
|
}
|
||||||
bufferToolContent := len(toolNames) > 0 && h.toolcallFeatureMatchEnabled()
|
bufferToolContent := len(toolNames) > 0
|
||||||
emitEarlyToolDeltas := h.toolcallEarlyEmitHighConfidence()
|
emitEarlyToolDeltas := h.toolcallFeatureMatchEnabled() && h.toolcallEarlyEmitHighConfidence()
|
||||||
|
|
||||||
streamRuntime := newResponsesStreamRuntime(
|
streamRuntime := newResponsesStreamRuntime(
|
||||||
w,
|
w,
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ function resolveToolcallPolicy(prepBody, payloadTools) {
|
|||||||
const preparedToolNames = normalizePreparedToolNames(prepBody && prepBody.tool_names);
|
const preparedToolNames = normalizePreparedToolNames(prepBody && prepBody.tool_names);
|
||||||
const toolNames = preparedToolNames.length > 0 ? preparedToolNames : extractToolNames(payloadTools);
|
const toolNames = preparedToolNames.length > 0 ? preparedToolNames : extractToolNames(payloadTools);
|
||||||
const featureMatchEnabled = boolDefaultTrue(prepBody && prepBody.toolcall_feature_match);
|
const featureMatchEnabled = boolDefaultTrue(prepBody && prepBody.toolcall_feature_match);
|
||||||
const emitEarlyToolDeltas = boolDefaultTrue(prepBody && prepBody.toolcall_early_emit_high);
|
const emitEarlyToolDeltas = featureMatchEnabled && boolDefaultTrue(prepBody && prepBody.toolcall_early_emit_high);
|
||||||
return {
|
return {
|
||||||
toolNames,
|
toolNames,
|
||||||
toolSieveEnabled: toolNames.length > 0 && featureMatchEnabled,
|
toolSieveEnabled: toolNames.length > 0,
|
||||||
emitEarlyToolDeltas,
|
emitEarlyToolDeltas,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ test('resolveToolcallPolicy respects prepare flags and prepared tool names', ()
|
|||||||
[{ type: 'function', function: { name: 'fallback_tool', parameters: { type: 'object' } } }],
|
[{ type: 'function', function: { name: 'fallback_tool', parameters: { type: 'object' } } }],
|
||||||
);
|
);
|
||||||
assert.deepEqual(policy.toolNames, ['prepped_tool']);
|
assert.deepEqual(policy.toolNames, ['prepped_tool']);
|
||||||
assert.equal(policy.toolSieveEnabled, false);
|
assert.equal(policy.toolSieveEnabled, true);
|
||||||
assert.equal(policy.emitEarlyToolDeltas, false);
|
assert.equal(policy.emitEarlyToolDeltas, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user