@jeffreycao/copilot-api 1.6.0-beta.1 → 1.6.0
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/README.md +35 -31
- package/README.zh-CN.md +723 -0
- package/dist/main.js +1 -1
- package/dist/{server-BZfT6g7P.js → server-DYDw_yEw.js} +7 -7
- package/dist/server-DYDw_yEw.js.map +1 -0
- package/dist/{start-BBJU_Vu_.js → start-JMKr-2eK.js} +2 -2
- package/dist/{start-BBJU_Vu_.js.map → start-JMKr-2eK.js.map} +1 -1
- package/package.json +1 -1
- package/dist/server-BZfT6g7P.js.map +0 -1
package/dist/main.js
CHANGED
|
@@ -23,7 +23,7 @@ if (typeof args["enterprise-url"] === "string") process.env.COPILOT_API_ENTERPRI
|
|
|
23
23
|
const { auth } = await import("./auth-DAlTk9BR.js");
|
|
24
24
|
const { checkUsage } = await import("./check-usage-B-1bXEu4.js");
|
|
25
25
|
const { debug } = await import("./debug-DcC7ZPH0.js");
|
|
26
|
-
const { start } = await import("./start-
|
|
26
|
+
const { start } = await import("./start-JMKr-2eK.js");
|
|
27
27
|
const main = defineCommand({
|
|
28
28
|
meta: {
|
|
29
29
|
name: "copilot-api",
|
|
@@ -1997,8 +1997,10 @@ const stripToolReferenceTurnBoundary = (anthropicPayload) => {
|
|
|
1997
1997
|
msg.content = msg.content.filter((block) => block.type !== "text" || block.text.trim() !== TOOL_REFERENCE_TURN_BOUNDARY);
|
|
1998
1998
|
}
|
|
1999
1999
|
};
|
|
2000
|
-
const mergeToolResultForClaude = (anthropicPayload) => {
|
|
2001
|
-
|
|
2000
|
+
const mergeToolResultForClaude = (anthropicPayload, options) => {
|
|
2001
|
+
const lastMessageIndex = anthropicPayload.messages.length - 1;
|
|
2002
|
+
for (const [index, msg] of anthropicPayload.messages.entries()) {
|
|
2003
|
+
if (options?.skipLastMessage && index === lastMessageIndex) continue;
|
|
2002
2004
|
if (msg.role !== "user" || !Array.isArray(msg.content)) continue;
|
|
2003
2005
|
const toolResults = [];
|
|
2004
2006
|
const textBlocks = [];
|
|
@@ -2511,10 +2513,8 @@ async function handleCompletion(c) {
|
|
|
2511
2513
|
const noTools = !anthropicPayload.tools || anthropicPayload.tools.length === 0;
|
|
2512
2514
|
if (anthropicBeta && noTools && compactType === 0) anthropicPayload.model = getSmallModel();
|
|
2513
2515
|
if (compactType) logger$5.debug("Compact request type:", compactType);
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
mergeToolResultForClaude(anthropicPayload);
|
|
2517
|
-
}
|
|
2516
|
+
stripToolReferenceTurnBoundary(anthropicPayload);
|
|
2517
|
+
mergeToolResultForClaude(anthropicPayload, { skipLastMessage: compactType === COMPACT_REQUEST });
|
|
2518
2518
|
const requestId = generateRequestIdFromPayload(anthropicPayload, sessionId);
|
|
2519
2519
|
logger$5.debug("Generated request ID:", requestId);
|
|
2520
2520
|
if (state.manualApprove) await awaitApproval();
|
|
@@ -3026,4 +3026,4 @@ server.route("/:provider/v1/models", providerModelRoutes);
|
|
|
3026
3026
|
|
|
3027
3027
|
//#endregion
|
|
3028
3028
|
export { server };
|
|
3029
|
-
//# sourceMappingURL=server-
|
|
3029
|
+
//# sourceMappingURL=server-DYDw_yEw.js.map
|