copilot-api-plus 1.2.42 → 1.2.43
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/dist/main.js +14 -3
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1861,6 +1861,16 @@ function isToolChoiceForced(toolChoice) {
|
|
|
1861
1861
|
* /models endpoint doesn't expose thinking budget fields.
|
|
1862
1862
|
*/
|
|
1863
1863
|
function injectThinking(payload, resolvedModel) {
|
|
1864
|
+
if (isToolChoiceForced(payload.tool_choice)) {
|
|
1865
|
+
if (payload.reasoning_effort || payload.thinking_budget) {
|
|
1866
|
+
const stripped = { ...payload };
|
|
1867
|
+
delete stripped.reasoning_effort;
|
|
1868
|
+
delete stripped.thinking_budget;
|
|
1869
|
+
consola.debug(`Thinking: stripped reasoning params for "${resolvedModel}" because tool_choice forces tool use`);
|
|
1870
|
+
return stripped;
|
|
1871
|
+
}
|
|
1872
|
+
return payload;
|
|
1873
|
+
}
|
|
1864
1874
|
if (payload.reasoning_effort || payload.thinking_budget) {
|
|
1865
1875
|
if (payload.reasoning_effort && payload.reasoning_effort !== "medium" && payload.reasoning_effort !== "low") {
|
|
1866
1876
|
const cap = reasoningEffortCap.get(resolvedModel);
|
|
@@ -1871,7 +1881,6 @@ function injectThinking(payload, resolvedModel) {
|
|
|
1871
1881
|
}
|
|
1872
1882
|
return payload;
|
|
1873
1883
|
}
|
|
1874
|
-
if (isToolChoiceForced(payload.tool_choice)) return payload;
|
|
1875
1884
|
const budget = getThinkingBudget(findModel(resolvedModel));
|
|
1876
1885
|
if (budget) return {
|
|
1877
1886
|
...payload,
|
|
@@ -2013,7 +2022,8 @@ async function createWithSingleAccount(payload) {
|
|
|
2013
2022
|
}
|
|
2014
2023
|
if (!response.ok) {
|
|
2015
2024
|
const errorBody = await response.text();
|
|
2016
|
-
if (response.status === 400) consola.
|
|
2025
|
+
if (response.status === 400) if (errorBody.includes("reasoning_effort") || errorBody.includes("invalid_reasoning_effort") || errorBody.includes("does not support reasoning")) consola.debug(`400 (auto-handled): ${errorBody}`);
|
|
2026
|
+
else consola.warn(`400: ${errorBody}`);
|
|
2017
2027
|
else consola.error("Failed to create chat completions", {
|
|
2018
2028
|
status: response.status,
|
|
2019
2029
|
statusText: response.statusText,
|
|
@@ -2183,7 +2193,8 @@ async function doFetch(payload, source, accountId) {
|
|
|
2183
2193
|
});
|
|
2184
2194
|
if (!response.ok) {
|
|
2185
2195
|
const errorBody = await response.text();
|
|
2186
|
-
if (response.status === 400) consola.
|
|
2196
|
+
if (response.status === 400) if (errorBody.includes("reasoning_effort") || errorBody.includes("invalid_reasoning_effort") || errorBody.includes("does not support reasoning")) consola.debug(`400 (auto-handled): ${errorBody}`);
|
|
2197
|
+
else consola.warn(`400: ${errorBody}`);
|
|
2187
2198
|
else consola.error("Failed to create chat completions", {
|
|
2188
2199
|
status: response.status,
|
|
2189
2200
|
statusText: response.statusText,
|