copilot-api-plus 1.2.41 → 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 +24 -4
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1861,8 +1861,26 @@ function isToolChoiceForced(toolChoice) {
|
|
|
1861
1861
|
* /models endpoint doesn't expose thinking budget fields.
|
|
1862
1862
|
*/
|
|
1863
1863
|
function injectThinking(payload, resolvedModel) {
|
|
1864
|
-
if (payload.
|
|
1865
|
-
|
|
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
|
+
}
|
|
1874
|
+
if (payload.reasoning_effort || payload.thinking_budget) {
|
|
1875
|
+
if (payload.reasoning_effort && payload.reasoning_effort !== "medium" && payload.reasoning_effort !== "low") {
|
|
1876
|
+
const cap = reasoningEffortCap.get(resolvedModel);
|
|
1877
|
+
if (cap) return {
|
|
1878
|
+
...payload,
|
|
1879
|
+
reasoning_effort: cap
|
|
1880
|
+
};
|
|
1881
|
+
}
|
|
1882
|
+
return payload;
|
|
1883
|
+
}
|
|
1866
1884
|
const budget = getThinkingBudget(findModel(resolvedModel));
|
|
1867
1885
|
if (budget) return {
|
|
1868
1886
|
...payload,
|
|
@@ -2004,7 +2022,8 @@ async function createWithSingleAccount(payload) {
|
|
|
2004
2022
|
}
|
|
2005
2023
|
if (!response.ok) {
|
|
2006
2024
|
const errorBody = await response.text();
|
|
2007
|
-
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}`);
|
|
2008
2027
|
else consola.error("Failed to create chat completions", {
|
|
2009
2028
|
status: response.status,
|
|
2010
2029
|
statusText: response.statusText,
|
|
@@ -2174,7 +2193,8 @@ async function doFetch(payload, source, accountId) {
|
|
|
2174
2193
|
});
|
|
2175
2194
|
if (!response.ok) {
|
|
2176
2195
|
const errorBody = await response.text();
|
|
2177
|
-
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}`);
|
|
2178
2198
|
else consola.error("Failed to create chat completions", {
|
|
2179
2199
|
status: response.status,
|
|
2180
2200
|
statusText: response.statusText,
|