n8n-nodes-github-copilot 3.37.1 โ 3.37.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/nodes/GitHubCopilotEmbeddings/GitHubCopilotEmbeddings.node.js +3 -39
- package/dist/nodes/GitHubCopilotTest/GitHubCopilotTest.node.js +18 -34
- package/dist/package.json +1 -1
- package/dist/shared/utils/EmbeddingsApiUtils.d.ts +22 -0
- package/dist/shared/utils/EmbeddingsApiUtils.js +54 -0
- package/package.json +1 -1
|
@@ -5,43 +5,7 @@ const n8n_workflow_1 = require("n8n-workflow");
|
|
|
5
5
|
const OAuthTokenManager_1 = require("../../shared/utils/OAuthTokenManager");
|
|
6
6
|
const GitHubCopilotEndpoints_1 = require("../../shared/utils/GitHubCopilotEndpoints");
|
|
7
7
|
const DynamicModelLoader_1 = require("../../shared/models/DynamicModelLoader");
|
|
8
|
-
|
|
9
|
-
let lastError = null;
|
|
10
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
11
|
-
try {
|
|
12
|
-
const response = await fetch(`${GitHubCopilotEndpoints_1.GITHUB_COPILOT_API.BASE_URL}${GitHubCopilotEndpoints_1.GITHUB_COPILOT_API.ENDPOINTS.EMBEDDINGS}`, {
|
|
13
|
-
method: "POST",
|
|
14
|
-
headers: GitHubCopilotEndpoints_1.GitHubCopilotEndpoints.getEmbeddingsHeaders(oauthToken),
|
|
15
|
-
body: JSON.stringify(requestBody),
|
|
16
|
-
});
|
|
17
|
-
if (!response.ok) {
|
|
18
|
-
const errorText = await response.text();
|
|
19
|
-
if (GitHubCopilotEndpoints_1.GitHubCopilotEndpoints.isTpmQuotaError(response.status) &&
|
|
20
|
-
enableRetry &&
|
|
21
|
-
attempt < maxRetries) {
|
|
22
|
-
const delay = GitHubCopilotEndpoints_1.GitHubCopilotEndpoints.getRetryDelay(attempt + 1);
|
|
23
|
-
console.log(`Attempt ${attempt + 1} failed with ${response.status}, retrying in ${delay}ms...`);
|
|
24
|
-
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
throw new Error(`API Error ${response.status}: ${errorText}`);
|
|
28
|
-
}
|
|
29
|
-
const data = (await response.json());
|
|
30
|
-
return data;
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
lastError = error instanceof Error ? error : new Error(String(error));
|
|
34
|
-
if (attempt < maxRetries && enableRetry) {
|
|
35
|
-
const delay = GitHubCopilotEndpoints_1.GitHubCopilotEndpoints.getRetryDelay(attempt + 1);
|
|
36
|
-
console.log(`Attempt ${attempt + 1} failed, retrying in ${delay}ms...`);
|
|
37
|
-
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
throw lastError;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
throw lastError || new Error("Maximum retry attempts exceeded");
|
|
44
|
-
}
|
|
8
|
+
const EmbeddingsApiUtils_1 = require("../../shared/utils/EmbeddingsApiUtils");
|
|
45
9
|
class GitHubCopilotEmbeddings {
|
|
46
10
|
constructor() {
|
|
47
11
|
this.description = {
|
|
@@ -336,7 +300,7 @@ class GitHubCopilotEmbeddings {
|
|
|
336
300
|
}
|
|
337
301
|
const requestBody = {
|
|
338
302
|
model,
|
|
339
|
-
input,
|
|
303
|
+
input: input,
|
|
340
304
|
};
|
|
341
305
|
if (options.dimensions) {
|
|
342
306
|
requestBody.dimensions = options.dimensions;
|
|
@@ -344,7 +308,7 @@ class GitHubCopilotEmbeddings {
|
|
|
344
308
|
if (options.encoding_format) {
|
|
345
309
|
requestBody.encoding_format = options.encoding_format;
|
|
346
310
|
}
|
|
347
|
-
const result = await
|
|
311
|
+
const result = await (0, EmbeddingsApiUtils_1.executeEmbeddingsRequest)(oauthToken, requestBody, enableRetry, maxRetries);
|
|
348
312
|
const returnFullResponse = options.returnFullResponse === true;
|
|
349
313
|
if (returnFullResponse) {
|
|
350
314
|
returnData.push({
|
|
@@ -4,6 +4,7 @@ exports.GitHubCopilotTest = void 0;
|
|
|
4
4
|
const GitHubCopilotEndpoints_1 = require("../../shared/utils/GitHubCopilotEndpoints");
|
|
5
5
|
const DynamicModelsManager_1 = require("../../shared/utils/DynamicModelsManager");
|
|
6
6
|
const OAuthTokenManager_1 = require("../../shared/utils/OAuthTokenManager");
|
|
7
|
+
const EmbeddingsApiUtils_1 = require("../../shared/utils/EmbeddingsApiUtils");
|
|
7
8
|
async function listAvailableModels(token, enableRetry = true, maxRetries = 3) {
|
|
8
9
|
const retryInfo = {
|
|
9
10
|
attempts: 1,
|
|
@@ -408,15 +409,16 @@ function generateTestRecommendations(testResults) {
|
|
|
408
409
|
});
|
|
409
410
|
return recommendations;
|
|
410
411
|
}
|
|
411
|
-
async function testEmbeddingModels(
|
|
412
|
+
async function testEmbeddingModels(githubToken, enableRetry = true, maxRetries = 3) {
|
|
412
413
|
var _a, _b, _c, _d;
|
|
413
414
|
const testStartTime = Date.now();
|
|
414
415
|
try {
|
|
415
416
|
console.log("๐งช Testing embedding models...");
|
|
417
|
+
const oauthToken = await OAuthTokenManager_1.OAuthTokenManager.getValidOAuthToken(githubToken);
|
|
416
418
|
const modelsUrl = `${GitHubCopilotEndpoints_1.GITHUB_COPILOT_API.URLS.MODELS}`;
|
|
417
419
|
const modelsResponse = await fetch(modelsUrl, {
|
|
418
420
|
method: "GET",
|
|
419
|
-
headers: GitHubCopilotEndpoints_1.GitHubCopilotEndpoints.getAuthHeaders(
|
|
421
|
+
headers: GitHubCopilotEndpoints_1.GitHubCopilotEndpoints.getAuthHeaders(oauthToken),
|
|
420
422
|
});
|
|
421
423
|
if (!modelsResponse.ok) {
|
|
422
424
|
throw new Error(`Failed to fetch models: ${modelsResponse.status}`);
|
|
@@ -453,37 +455,19 @@ async function testEmbeddingModels(token, enableRetry = true, maxRetries = 3) {
|
|
|
453
455
|
model: model.id,
|
|
454
456
|
input: [testText],
|
|
455
457
|
};
|
|
456
|
-
const
|
|
457
|
-
method: "POST",
|
|
458
|
-
headers: GitHubCopilotEndpoints_1.GitHubCopilotEndpoints.getEmbeddingsHeaders(token),
|
|
459
|
-
body: JSON.stringify(requestBody),
|
|
460
|
-
});
|
|
458
|
+
const data = await (0, EmbeddingsApiUtils_1.executeEmbeddingsRequestSimple)(oauthToken, requestBody);
|
|
461
459
|
const testDuration = Date.now() - testStart;
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
modelResults.summary.totalResponseTime += testDuration;
|
|
474
|
-
console.log(` โ
Test ${testNum}/${testsPerModel}: Success (${testDuration}ms, ${embeddingLength}D)`);
|
|
475
|
-
}
|
|
476
|
-
else {
|
|
477
|
-
const errorText = await response.text();
|
|
478
|
-
modelResults.tests.push({
|
|
479
|
-
testNumber: testNum,
|
|
480
|
-
success: false,
|
|
481
|
-
responseTime: testDuration,
|
|
482
|
-
error: `HTTP ${response.status}: ${errorText.substring(0, 100)}`,
|
|
483
|
-
});
|
|
484
|
-
modelResults.summary.failureCount++;
|
|
485
|
-
console.log(` โ Test ${testNum}/${testsPerModel}: Failed (${response.status})`);
|
|
486
|
-
}
|
|
460
|
+
const embeddingLength = ((_c = (_b = (_a = data.data) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.embedding) === null || _c === void 0 ? void 0 : _c.length) || 0;
|
|
461
|
+
modelResults.tests.push({
|
|
462
|
+
testNumber: testNum,
|
|
463
|
+
success: true,
|
|
464
|
+
responseTime: testDuration,
|
|
465
|
+
embeddingDimensions: embeddingLength,
|
|
466
|
+
tokensUsed: ((_d = data.usage) === null || _d === void 0 ? void 0 : _d.total_tokens) || 0,
|
|
467
|
+
});
|
|
468
|
+
modelResults.summary.successCount++;
|
|
469
|
+
modelResults.summary.totalResponseTime += testDuration;
|
|
470
|
+
console.log(` โ
Test ${testNum}/${testsPerModel}: Success (${testDuration}ms, ${embeddingLength}D)`);
|
|
487
471
|
}
|
|
488
472
|
catch (error) {
|
|
489
473
|
const testDuration = Date.now() - testStart;
|
|
@@ -591,9 +575,9 @@ class GitHubCopilotTest {
|
|
|
591
575
|
description: "Test all embedding models (text-embedding-*) with sample text generation",
|
|
592
576
|
},
|
|
593
577
|
{
|
|
594
|
-
name: "
|
|
578
|
+
name: "Test Chat Models",
|
|
595
579
|
value: "consolidatedTest",
|
|
596
|
-
description: "Test all available models 5 times each and generate comprehensive report โ ๏ธ This test may take up to 2 minutes to complete",
|
|
580
|
+
description: "Test all available chat models 5 times each and generate comprehensive report โ ๏ธ This test may take up to 2 minutes to complete",
|
|
597
581
|
},
|
|
598
582
|
],
|
|
599
583
|
default: "listModels",
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-github-copilot",
|
|
3
|
-
"version": "3.37.
|
|
3
|
+
"version": "3.37.3",
|
|
4
4
|
"description": "n8n community node for GitHub Copilot with CLI integration, Chat API access, and AI Chat Model for workflows - access GPT-5, Claude, Gemini and more using your Copilot subscription",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/sufficit/n8n-nodes-github-copilot",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface EmbeddingResponse {
|
|
2
|
+
object: string;
|
|
3
|
+
data: Array<{
|
|
4
|
+
object: string;
|
|
5
|
+
index: number;
|
|
6
|
+
embedding: number[];
|
|
7
|
+
}>;
|
|
8
|
+
model: string;
|
|
9
|
+
usage: {
|
|
10
|
+
prompt_tokens: number;
|
|
11
|
+
total_tokens: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface EmbeddingRequest {
|
|
15
|
+
model: string;
|
|
16
|
+
input: string[];
|
|
17
|
+
dimensions?: number;
|
|
18
|
+
encoding_format?: "float" | "base64";
|
|
19
|
+
user?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function executeEmbeddingsRequest(oauthToken: string, requestBody: EmbeddingRequest, enableRetry?: boolean, maxRetries?: number): Promise<EmbeddingResponse>;
|
|
22
|
+
export declare function executeEmbeddingsRequestSimple(oauthToken: string, requestBody: EmbeddingRequest): Promise<EmbeddingResponse>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeEmbeddingsRequest = executeEmbeddingsRequest;
|
|
4
|
+
exports.executeEmbeddingsRequestSimple = executeEmbeddingsRequestSimple;
|
|
5
|
+
const GitHubCopilotEndpoints_1 = require("./GitHubCopilotEndpoints");
|
|
6
|
+
async function executeEmbeddingsRequest(oauthToken, requestBody, enableRetry = true, maxRetries = 3) {
|
|
7
|
+
let lastError = null;
|
|
8
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
9
|
+
try {
|
|
10
|
+
const response = await fetch(GitHubCopilotEndpoints_1.GitHubCopilotEndpoints.getEmbeddingsUrl(), {
|
|
11
|
+
method: "POST",
|
|
12
|
+
headers: GitHubCopilotEndpoints_1.GitHubCopilotEndpoints.getEmbeddingsHeaders(oauthToken),
|
|
13
|
+
body: JSON.stringify(requestBody),
|
|
14
|
+
});
|
|
15
|
+
if (!response.ok) {
|
|
16
|
+
const errorText = await response.text();
|
|
17
|
+
if (GitHubCopilotEndpoints_1.GitHubCopilotEndpoints.isTpmQuotaError(response.status) &&
|
|
18
|
+
enableRetry &&
|
|
19
|
+
attempt < maxRetries) {
|
|
20
|
+
const delay = GitHubCopilotEndpoints_1.GitHubCopilotEndpoints.getRetryDelay(attempt + 1);
|
|
21
|
+
console.log(`Embeddings attempt ${attempt + 1} failed with ${response.status}, retrying in ${delay}ms...`);
|
|
22
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
throw new Error(`Embeddings API Error ${response.status}: ${errorText}`);
|
|
26
|
+
}
|
|
27
|
+
const data = (await response.json());
|
|
28
|
+
return data;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
32
|
+
if (attempt < maxRetries && enableRetry) {
|
|
33
|
+
const delay = GitHubCopilotEndpoints_1.GitHubCopilotEndpoints.getRetryDelay(attempt + 1);
|
|
34
|
+
console.log(`Embeddings attempt ${attempt + 1} failed, retrying in ${delay}ms...`);
|
|
35
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
throw lastError;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
throw lastError || new Error("Maximum retry attempts exceeded for embeddings request");
|
|
42
|
+
}
|
|
43
|
+
async function executeEmbeddingsRequestSimple(oauthToken, requestBody) {
|
|
44
|
+
const response = await fetch(GitHubCopilotEndpoints_1.GitHubCopilotEndpoints.getEmbeddingsUrl(), {
|
|
45
|
+
method: "POST",
|
|
46
|
+
headers: GitHubCopilotEndpoints_1.GitHubCopilotEndpoints.getEmbeddingsHeaders(oauthToken),
|
|
47
|
+
body: JSON.stringify(requestBody),
|
|
48
|
+
});
|
|
49
|
+
if (!response.ok) {
|
|
50
|
+
const errorText = await response.text();
|
|
51
|
+
throw new Error(`Embeddings API Error ${response.status}: ${errorText}`);
|
|
52
|
+
}
|
|
53
|
+
return (await response.json());
|
|
54
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-github-copilot",
|
|
3
|
-
"version": "3.37.
|
|
3
|
+
"version": "3.37.3",
|
|
4
4
|
"description": "n8n community node for GitHub Copilot with CLI integration, Chat API access, and AI Chat Model for workflows - access GPT-5, Claude, Gemini and more using your Copilot subscription",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/sufficit/n8n-nodes-github-copilot",
|