@dianshuv/copilot-api 0.2.2 → 0.2.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/dist/main.mjs +17 -10
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -1017,7 +1017,7 @@ const patchClaude = defineCommand({
|
|
|
1017
1017
|
|
|
1018
1018
|
//#endregion
|
|
1019
1019
|
//#region package.json
|
|
1020
|
-
var version = "0.2.
|
|
1020
|
+
var version = "0.2.3";
|
|
1021
1021
|
|
|
1022
1022
|
//#endregion
|
|
1023
1023
|
//#region src/lib/adaptive-rate-limiter.ts
|
|
@@ -6447,7 +6447,8 @@ const RESPONSES_ENDPOINT = "/responses";
|
|
|
6447
6447
|
const handleResponses = async (c) => {
|
|
6448
6448
|
const payload = await c.req.json();
|
|
6449
6449
|
consola.debug("Responses request payload:", JSON.stringify(payload));
|
|
6450
|
-
|
|
6450
|
+
const trackingId = c.get("trackingId");
|
|
6451
|
+
updateTrackerModel(trackingId, payload.model);
|
|
6451
6452
|
useFunctionApplyPatch(payload);
|
|
6452
6453
|
removeWebSearchTool(payload);
|
|
6453
6454
|
if (!((state.models?.data.find((model) => model.id === payload.model))?.supported_endpoints?.includes(RESPONSES_ENDPOINT) ?? false)) return c.json({ error: {
|
|
@@ -6464,14 +6465,20 @@ const handleResponses = async (c) => {
|
|
|
6464
6465
|
consola.debug("Forwarding native Responses stream");
|
|
6465
6466
|
return streamSSE(c, async (stream) => {
|
|
6466
6467
|
const idTracker = createStreamIdTracker();
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6468
|
+
try {
|
|
6469
|
+
for await (const chunk of response) {
|
|
6470
|
+
consola.debug("Responses stream chunk:", JSON.stringify(chunk));
|
|
6471
|
+
const processedData = fixStreamIds(chunk.data ?? "", chunk.event, idTracker);
|
|
6472
|
+
await stream.writeSSE({
|
|
6473
|
+
id: chunk.id,
|
|
6474
|
+
event: chunk.event,
|
|
6475
|
+
data: processedData
|
|
6476
|
+
});
|
|
6477
|
+
}
|
|
6478
|
+
completeTracking(trackingId, 0, 0);
|
|
6479
|
+
} catch (error) {
|
|
6480
|
+
failTracking(trackingId, error);
|
|
6481
|
+
throw error;
|
|
6475
6482
|
}
|
|
6476
6483
|
});
|
|
6477
6484
|
}
|