@dianshuv/copilot-api 0.2.1 → 0.2.2
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 +29 -8
- package/package.json +2 -2
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.2";
|
|
1021
1021
|
|
|
1022
1022
|
//#endregion
|
|
1023
1023
|
//#region src/lib/adaptive-rate-limiter.ts
|
|
@@ -1406,7 +1406,7 @@ function recordResponse(id, response, durationMs) {
|
|
|
1406
1406
|
}
|
|
1407
1407
|
}
|
|
1408
1408
|
function getHistory(options = {}) {
|
|
1409
|
-
const { page = 1, limit = 50, model, endpoint,
|
|
1409
|
+
const { page = 1, limit = 50, model, endpoint, status, from, to, search, sessionId } = options;
|
|
1410
1410
|
let filtered = [...historyState.entries];
|
|
1411
1411
|
if (sessionId) filtered = filtered.filter((e) => e.sessionId === sessionId);
|
|
1412
1412
|
if (model) {
|
|
@@ -1414,7 +1414,21 @@ function getHistory(options = {}) {
|
|
|
1414
1414
|
filtered = filtered.filter((e) => e.request.model.toLowerCase().includes(modelLower) || e.response?.model.toLowerCase().includes(modelLower));
|
|
1415
1415
|
}
|
|
1416
1416
|
if (endpoint) filtered = filtered.filter((e) => e.endpoint === endpoint);
|
|
1417
|
-
|
|
1417
|
+
let effectiveStatus = status;
|
|
1418
|
+
const legacySuccess = options.success;
|
|
1419
|
+
if (!effectiveStatus && legacySuccess !== void 0) effectiveStatus = legacySuccess ? "success" : "error";
|
|
1420
|
+
switch (effectiveStatus) {
|
|
1421
|
+
case "success":
|
|
1422
|
+
filtered = filtered.filter((e) => e.response?.success === true);
|
|
1423
|
+
break;
|
|
1424
|
+
case "error":
|
|
1425
|
+
filtered = filtered.filter((e) => e.response !== void 0 && !e.response.success);
|
|
1426
|
+
break;
|
|
1427
|
+
case "pending":
|
|
1428
|
+
filtered = filtered.filter((e) => !e.response);
|
|
1429
|
+
break;
|
|
1430
|
+
default: break;
|
|
1431
|
+
}
|
|
1418
1432
|
if (from) filtered = filtered.filter((e) => e.timestamp >= from);
|
|
1419
1433
|
if (to) filtered = filtered.filter((e) => e.timestamp <= to);
|
|
1420
1434
|
if (search) {
|
|
@@ -3278,6 +3292,11 @@ function handleGetEntries(c) {
|
|
|
3278
3292
|
model: query.model || void 0,
|
|
3279
3293
|
endpoint: query.endpoint,
|
|
3280
3294
|
success: query.success ? query.success === "true" : void 0,
|
|
3295
|
+
status: [
|
|
3296
|
+
"success",
|
|
3297
|
+
"error",
|
|
3298
|
+
"pending"
|
|
3299
|
+
].includes(query.status) ? query.status : void 0,
|
|
3281
3300
|
from: query.from ? Number.parseInt(query.from, 10) : void 0,
|
|
3282
3301
|
to: query.to ? Number.parseInt(query.to, 10) : void 0,
|
|
3283
3302
|
search: query.search || void 0,
|
|
@@ -3554,11 +3573,11 @@ async function loadEntries() {
|
|
|
3554
3573
|
if (currentSessionId) params.set('sessionId', currentSessionId);
|
|
3555
3574
|
|
|
3556
3575
|
const endpoint = document.getElementById('filter-endpoint').value;
|
|
3557
|
-
const
|
|
3576
|
+
const status = document.getElementById('filter-status').value;
|
|
3558
3577
|
const search = document.getElementById('filter-search').value;
|
|
3559
3578
|
|
|
3560
3579
|
if (endpoint) params.set('endpoint', endpoint);
|
|
3561
|
-
if (
|
|
3580
|
+
if (status) params.set('status', status);
|
|
3562
3581
|
if (search) params.set('search', search);
|
|
3563
3582
|
|
|
3564
3583
|
try {
|
|
@@ -4311,10 +4330,11 @@ const template = `
|
|
|
4311
4330
|
<option value="anthropic">Anthropic</option>
|
|
4312
4331
|
<option value="openai">OpenAI</option>
|
|
4313
4332
|
</select>
|
|
4314
|
-
<select id="filter-
|
|
4333
|
+
<select id="filter-status" onchange="loadEntries()">
|
|
4315
4334
|
<option value="">All Status</option>
|
|
4316
|
-
<option value="
|
|
4317
|
-
<option value="
|
|
4335
|
+
<option value="success">Success</option>
|
|
4336
|
+
<option value="error">Failed</option>
|
|
4337
|
+
<option value="pending">Pending</option>
|
|
4318
4338
|
</select>
|
|
4319
4339
|
</div>
|
|
4320
4340
|
|
|
@@ -4361,6 +4381,7 @@ function getHistoryUI() {
|
|
|
4361
4381
|
<meta charset="UTF-8">
|
|
4362
4382
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
4363
4383
|
<title>Copilot API - Request History</title>
|
|
4384
|
+
<link rel="icon" href="data:,">
|
|
4364
4385
|
<style>${styles}</style>
|
|
4365
4386
|
</head>
|
|
4366
4387
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dianshuv/copilot-api",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Turn GitHub Copilot into OpenAI/Anthropic API compatible server. Usable with Claude Code!",
|
|
5
5
|
"author": "dianshuv",
|
|
6
6
|
"type": "module",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"prepack": "npm run build",
|
|
20
20
|
"prepare": "npm run build && (command -v bun >/dev/null 2>&1 && simple-git-hooks || true)",
|
|
21
21
|
"prepublishOnly": "npm run typecheck && npm run lint:all && npm run test",
|
|
22
|
-
"release": "npm publish --access public",
|
|
22
|
+
"release": "npm publish --access public --//registry.npmjs.org/:_authToken=$NPM_TOKEN",
|
|
23
23
|
"start": "NODE_ENV=production bun run ./src/main.ts",
|
|
24
24
|
"test": "bun test tests/*.test.ts",
|
|
25
25
|
"test:all": "bun test tests/*.test.ts && bun test tests/integration/",
|