n8n-nodes-github-copilot 3.38.24 → 3.38.26
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/credentials/GitHubCopilotApi.credentials.d.ts +1 -1
- package/dist/credentials/GitHubCopilotApi.credentials.js +25 -25
- package/dist/nodes/GitHubCopilot/GitHubCopilot.node.d.ts +1 -1
- package/dist/nodes/GitHubCopilot/GitHubCopilot.node.js +166 -166
- package/dist/nodes/GitHubCopilotAuthHelper/GitHubCopilotAuthHelper.node.d.ts +1 -1
- package/dist/nodes/GitHubCopilotAuthHelper/GitHubCopilotAuthHelper.node.js +539 -539
- package/dist/nodes/GitHubCopilotChatAPI/GitHubCopilotChatAPI.node.d.ts +1 -1
- package/dist/nodes/GitHubCopilotChatAPI/GitHubCopilotChatAPI.node.js +46 -44
- package/dist/nodes/GitHubCopilotChatAPI/nodeProperties.d.ts +1 -1
- package/dist/nodes/GitHubCopilotChatAPI/nodeProperties.js +82 -82
- package/dist/nodes/GitHubCopilotChatAPI/utils/helpers.d.ts +2 -2
- package/dist/nodes/GitHubCopilotChatAPI/utils/helpers.js +26 -26
- package/dist/nodes/GitHubCopilotChatAPI/utils/imageProcessor.d.ts +2 -2
- package/dist/nodes/GitHubCopilotChatAPI/utils/imageProcessor.js +12 -12
- package/dist/nodes/GitHubCopilotChatAPI/utils/index.d.ts +4 -4
- package/dist/nodes/GitHubCopilotChatAPI/utils/mediaDetection.d.ts +3 -3
- package/dist/nodes/GitHubCopilotChatAPI/utils/mediaDetection.js +19 -19
- package/dist/nodes/GitHubCopilotChatAPI/utils/modelCapabilities.d.ts +1 -1
- package/dist/nodes/GitHubCopilotChatAPI/utils/modelCapabilities.js +23 -23
- package/dist/nodes/GitHubCopilotChatAPI/utils/types.d.ts +5 -5
- package/dist/nodes/GitHubCopilotChatModel/GitHubCopilotChatModel.node.d.ts +1 -1
- package/dist/nodes/GitHubCopilotChatModel/GitHubCopilotChatModel.node.js +163 -110
- package/dist/nodes/GitHubCopilotEmbeddings/GitHubCopilotEmbeddings.node.d.ts +1 -1
- package/dist/nodes/GitHubCopilotEmbeddings/GitHubCopilotEmbeddings.node.js +114 -114
- package/dist/nodes/GitHubCopilotOpenAI/GitHubCopilotOpenAI.node.d.ts +1 -1
- package/dist/nodes/GitHubCopilotOpenAI/GitHubCopilotOpenAI.node.js +74 -69
- package/dist/nodes/GitHubCopilotOpenAI/nodeProperties.d.ts +1 -1
- package/dist/nodes/GitHubCopilotOpenAI/nodeProperties.js +181 -181
- package/dist/nodes/GitHubCopilotOpenAI/utils/index.d.ts +2 -2
- package/dist/nodes/GitHubCopilotOpenAI/utils/openaiCompat.d.ts +10 -10
- package/dist/nodes/GitHubCopilotOpenAI/utils/openaiCompat.js +53 -53
- package/dist/nodes/GitHubCopilotOpenAI/utils/types.d.ts +12 -12
- package/dist/nodes/GitHubCopilotTest/GitHubCopilotTest.node.d.ts +1 -1
- package/dist/nodes/GitHubCopilotTest/GitHubCopilotTest.node.js +120 -116
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -9,190 +9,190 @@ const EmbeddingsApiUtils_1 = require("../../shared/utils/EmbeddingsApiUtils");
|
|
|
9
9
|
class GitHubCopilotEmbeddings {
|
|
10
10
|
constructor() {
|
|
11
11
|
this.description = {
|
|
12
|
-
displayName:
|
|
13
|
-
name:
|
|
14
|
-
icon:
|
|
15
|
-
group: [
|
|
12
|
+
displayName: 'GitHub Copilot Embeddings',
|
|
13
|
+
name: 'gitHubCopilotEmbeddings',
|
|
14
|
+
icon: 'file:../../shared/icons/copilot.svg',
|
|
15
|
+
group: ['transform'],
|
|
16
16
|
version: 1,
|
|
17
17
|
subtitle: '={{$parameter["model"]}}',
|
|
18
|
-
description:
|
|
18
|
+
description: 'Generate text embeddings using GitHub Copilot API',
|
|
19
19
|
defaults: {
|
|
20
|
-
name:
|
|
20
|
+
name: 'GitHub Copilot Embeddings',
|
|
21
21
|
},
|
|
22
|
-
inputs: [
|
|
23
|
-
outputs: [
|
|
22
|
+
inputs: ['main'],
|
|
23
|
+
outputs: ['main'],
|
|
24
24
|
credentials: [
|
|
25
25
|
{
|
|
26
|
-
name:
|
|
26
|
+
name: 'githubCopilotApi',
|
|
27
27
|
required: true,
|
|
28
28
|
},
|
|
29
29
|
],
|
|
30
30
|
properties: [
|
|
31
31
|
{
|
|
32
|
-
displayName:
|
|
33
|
-
name:
|
|
34
|
-
type:
|
|
32
|
+
displayName: 'Model',
|
|
33
|
+
name: 'model',
|
|
34
|
+
type: 'options',
|
|
35
35
|
typeOptions: {
|
|
36
|
-
loadOptionsMethod:
|
|
36
|
+
loadOptionsMethod: 'getAvailableEmbeddingModels',
|
|
37
37
|
},
|
|
38
38
|
options: [
|
|
39
39
|
{
|
|
40
|
-
name:
|
|
41
|
-
value:
|
|
40
|
+
name: 'Text Embedding 3 Small',
|
|
41
|
+
value: 'text-embedding-3-small',
|
|
42
42
|
description: "OpenAI's text-embedding-3-small model (recommended)",
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
|
-
name:
|
|
46
|
-
value:
|
|
47
|
-
description:
|
|
45
|
+
name: 'Text Embedding Ada 002',
|
|
46
|
+
value: 'text-embedding-ada-002',
|
|
47
|
+
description: 'Legacy embedding model',
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
|
-
name:
|
|
51
|
-
value:
|
|
52
|
-
description:
|
|
50
|
+
name: 'Text Embedding 3 Small (Inference)',
|
|
51
|
+
value: 'text-embedding-3-small-inference',
|
|
52
|
+
description: 'Optimized inference variant',
|
|
53
53
|
},
|
|
54
54
|
],
|
|
55
|
-
default:
|
|
56
|
-
description:
|
|
55
|
+
default: 'text-embedding-3-small',
|
|
56
|
+
description: 'The embedding model to use. Models are auto-discovered from your GitHub Copilot subscription.',
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
|
-
displayName:
|
|
60
|
-
name:
|
|
61
|
-
type:
|
|
62
|
-
default:
|
|
59
|
+
displayName: 'Custom Model Name',
|
|
60
|
+
name: 'customModel',
|
|
61
|
+
type: 'string',
|
|
62
|
+
default: '',
|
|
63
63
|
required: true,
|
|
64
|
-
placeholder:
|
|
65
|
-
description:
|
|
64
|
+
placeholder: 'e.g., text-embedding-3-large',
|
|
65
|
+
description: 'Enter the exact model name to use',
|
|
66
66
|
displayOptions: {
|
|
67
67
|
show: {
|
|
68
|
-
model: [
|
|
68
|
+
model: ['__manual__'],
|
|
69
69
|
},
|
|
70
70
|
},
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
|
-
displayName:
|
|
74
|
-
name:
|
|
75
|
-
type:
|
|
73
|
+
displayName: 'Input Mode',
|
|
74
|
+
name: 'inputMode',
|
|
75
|
+
type: 'options',
|
|
76
76
|
options: [
|
|
77
77
|
{
|
|
78
|
-
name:
|
|
79
|
-
value:
|
|
80
|
-
description:
|
|
78
|
+
name: 'Single Text',
|
|
79
|
+
value: 'single',
|
|
80
|
+
description: 'Embed a single text string',
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
|
-
name:
|
|
84
|
-
value:
|
|
85
|
-
description:
|
|
83
|
+
name: 'Batch (Array)',
|
|
84
|
+
value: 'batch',
|
|
85
|
+
description: 'Embed multiple texts in a single request (more efficient)',
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
|
-
name:
|
|
89
|
-
value:
|
|
90
|
-
description:
|
|
88
|
+
name: 'From Field',
|
|
89
|
+
value: 'field',
|
|
90
|
+
description: 'Embed text from a specific field in each input item',
|
|
91
91
|
},
|
|
92
92
|
],
|
|
93
|
-
default:
|
|
94
|
-
description:
|
|
93
|
+
default: 'single',
|
|
94
|
+
description: 'How to provide the text input',
|
|
95
95
|
},
|
|
96
96
|
{
|
|
97
|
-
displayName:
|
|
98
|
-
name:
|
|
99
|
-
type:
|
|
97
|
+
displayName: 'Text',
|
|
98
|
+
name: 'text',
|
|
99
|
+
type: 'string',
|
|
100
100
|
typeOptions: {
|
|
101
101
|
rows: 4,
|
|
102
102
|
},
|
|
103
|
-
default:
|
|
103
|
+
default: '',
|
|
104
104
|
required: true,
|
|
105
|
-
placeholder:
|
|
106
|
-
description:
|
|
105
|
+
placeholder: 'Enter text to embed',
|
|
106
|
+
description: 'The text to generate embeddings for',
|
|
107
107
|
displayOptions: {
|
|
108
108
|
show: {
|
|
109
|
-
inputMode: [
|
|
109
|
+
inputMode: ['single'],
|
|
110
110
|
},
|
|
111
111
|
},
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
|
-
displayName:
|
|
115
|
-
name:
|
|
116
|
-
type:
|
|
114
|
+
displayName: 'Texts',
|
|
115
|
+
name: 'texts',
|
|
116
|
+
type: 'string',
|
|
117
117
|
typeOptions: {
|
|
118
118
|
rows: 8,
|
|
119
119
|
},
|
|
120
|
-
default:
|
|
120
|
+
default: '',
|
|
121
121
|
required: true,
|
|
122
122
|
placeholder: '["Text 1", "Text 2", "Text 3"]',
|
|
123
|
-
description:
|
|
123
|
+
description: 'JSON array of texts to embed in a single request (more efficient than multiple calls)',
|
|
124
124
|
displayOptions: {
|
|
125
125
|
show: {
|
|
126
|
-
inputMode: [
|
|
126
|
+
inputMode: ['batch'],
|
|
127
127
|
},
|
|
128
128
|
},
|
|
129
129
|
},
|
|
130
130
|
{
|
|
131
|
-
displayName:
|
|
132
|
-
name:
|
|
133
|
-
type:
|
|
134
|
-
default:
|
|
131
|
+
displayName: 'Field Name',
|
|
132
|
+
name: 'fieldName',
|
|
133
|
+
type: 'string',
|
|
134
|
+
default: 'text',
|
|
135
135
|
required: true,
|
|
136
|
-
placeholder:
|
|
137
|
-
description:
|
|
136
|
+
placeholder: 'text',
|
|
137
|
+
description: 'Name of the field containing the text to embed',
|
|
138
138
|
displayOptions: {
|
|
139
139
|
show: {
|
|
140
|
-
inputMode: [
|
|
140
|
+
inputMode: ['field'],
|
|
141
141
|
},
|
|
142
142
|
},
|
|
143
143
|
},
|
|
144
144
|
{
|
|
145
|
-
displayName:
|
|
146
|
-
name:
|
|
147
|
-
type:
|
|
148
|
-
placeholder:
|
|
145
|
+
displayName: 'Options',
|
|
146
|
+
name: 'options',
|
|
147
|
+
type: 'collection',
|
|
148
|
+
placeholder: 'Add Option',
|
|
149
149
|
default: {},
|
|
150
150
|
options: [
|
|
151
151
|
{
|
|
152
|
-
displayName:
|
|
153
|
-
name:
|
|
154
|
-
type:
|
|
152
|
+
displayName: 'Dimensions',
|
|
153
|
+
name: 'dimensions',
|
|
154
|
+
type: 'number',
|
|
155
155
|
default: 1536,
|
|
156
|
-
description:
|
|
156
|
+
description: 'The number of dimensions for the embedding. Only supported by text-embedding-3-small.',
|
|
157
157
|
typeOptions: {
|
|
158
158
|
minValue: 1,
|
|
159
159
|
maxValue: 1536,
|
|
160
160
|
},
|
|
161
|
-
placeholder:
|
|
162
|
-
hint:
|
|
161
|
+
placeholder: '1536',
|
|
162
|
+
hint: 'Common values: 512, 768, 1024, 1536',
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
|
-
displayName:
|
|
166
|
-
name:
|
|
167
|
-
type:
|
|
165
|
+
displayName: 'Encoding Format',
|
|
166
|
+
name: 'encoding_format',
|
|
167
|
+
type: 'options',
|
|
168
168
|
options: [
|
|
169
169
|
{
|
|
170
|
-
name:
|
|
171
|
-
value:
|
|
172
|
-
description:
|
|
170
|
+
name: 'Float',
|
|
171
|
+
value: 'float',
|
|
172
|
+
description: 'Standard floating point format (default)',
|
|
173
173
|
},
|
|
174
174
|
{
|
|
175
|
-
name:
|
|
176
|
-
value:
|
|
177
|
-
description:
|
|
175
|
+
name: 'Base64',
|
|
176
|
+
value: 'base64',
|
|
177
|
+
description: 'Base64-encoded format (more compact)',
|
|
178
178
|
},
|
|
179
179
|
],
|
|
180
|
-
default:
|
|
181
|
-
description:
|
|
180
|
+
default: 'float',
|
|
181
|
+
description: 'The format to return the embeddings in',
|
|
182
182
|
},
|
|
183
183
|
{
|
|
184
|
-
displayName:
|
|
185
|
-
name:
|
|
186
|
-
type:
|
|
184
|
+
displayName: 'Enable Retry',
|
|
185
|
+
name: 'enableRetry',
|
|
186
|
+
type: 'boolean',
|
|
187
187
|
default: true,
|
|
188
|
-
description:
|
|
188
|
+
description: 'Whether to retry on TPM quota errors (403)',
|
|
189
189
|
},
|
|
190
190
|
{
|
|
191
|
-
displayName:
|
|
192
|
-
name:
|
|
193
|
-
type:
|
|
191
|
+
displayName: 'Max Retries',
|
|
192
|
+
name: 'maxRetries',
|
|
193
|
+
type: 'number',
|
|
194
194
|
default: 3,
|
|
195
|
-
description:
|
|
195
|
+
description: 'Maximum number of retry attempts',
|
|
196
196
|
displayOptions: {
|
|
197
197
|
show: {
|
|
198
198
|
enableRetry: [true],
|
|
@@ -216,11 +216,11 @@ class GitHubCopilotEmbeddings {
|
|
|
216
216
|
const returnData = [];
|
|
217
217
|
for (let i = 0; i < items.length; i++) {
|
|
218
218
|
try {
|
|
219
|
-
const selectedModel = this.getNodeParameter(
|
|
219
|
+
const selectedModel = this.getNodeParameter('model', i);
|
|
220
220
|
let model;
|
|
221
|
-
if (selectedModel ===
|
|
222
|
-
model = this.getNodeParameter(
|
|
223
|
-
if (!model || model.trim() ===
|
|
221
|
+
if (selectedModel === '__manual__') {
|
|
222
|
+
model = this.getNodeParameter('customModel', i);
|
|
223
|
+
if (!model || model.trim() === '') {
|
|
224
224
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Custom model name is required when selecting '✏️ Enter Custom Model Name'");
|
|
225
225
|
}
|
|
226
226
|
console.log(`✏️ Using manually entered embedding model: ${model}`);
|
|
@@ -229,12 +229,12 @@ class GitHubCopilotEmbeddings {
|
|
|
229
229
|
model = selectedModel;
|
|
230
230
|
console.log(`✅ Using embedding model from list: ${model}`);
|
|
231
231
|
}
|
|
232
|
-
const inputMode = this.getNodeParameter(
|
|
233
|
-
const options = this.getNodeParameter(
|
|
234
|
-
const credentials = await this.getCredentials(
|
|
232
|
+
const inputMode = this.getNodeParameter('inputMode', i);
|
|
233
|
+
const options = this.getNodeParameter('options', i, {});
|
|
234
|
+
const credentials = await this.getCredentials('githubCopilotApi', i);
|
|
235
235
|
const githubToken = credentials.token;
|
|
236
236
|
if (!githubToken) {
|
|
237
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(),
|
|
237
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'GitHub token is required');
|
|
238
238
|
}
|
|
239
239
|
if (!GitHubCopilotEndpoints_1.GitHubCopilotEndpoints.validateToken(githubToken)) {
|
|
240
240
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Invalid GitHub token format. Token must start with 'gho_' or 'github_pat_'");
|
|
@@ -244,28 +244,28 @@ class GitHubCopilotEmbeddings {
|
|
|
244
244
|
const maxRetries = options.maxRetries || 3;
|
|
245
245
|
let input;
|
|
246
246
|
switch (inputMode) {
|
|
247
|
-
case
|
|
248
|
-
input = this.getNodeParameter(
|
|
249
|
-
if (!input || input.trim() ===
|
|
250
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(),
|
|
247
|
+
case 'single':
|
|
248
|
+
input = this.getNodeParameter('text', i);
|
|
249
|
+
if (!input || input.trim() === '') {
|
|
250
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Text input cannot be empty');
|
|
251
251
|
}
|
|
252
252
|
input = [input];
|
|
253
253
|
break;
|
|
254
|
-
case
|
|
255
|
-
const textsStr = this.getNodeParameter(
|
|
254
|
+
case 'batch':
|
|
255
|
+
const textsStr = this.getNodeParameter('texts', i);
|
|
256
256
|
try {
|
|
257
257
|
const parsed = JSON.parse(textsStr);
|
|
258
258
|
if (!Array.isArray(parsed)) {
|
|
259
|
-
throw new Error(
|
|
259
|
+
throw new Error('Input must be a JSON array');
|
|
260
260
|
}
|
|
261
261
|
input = parsed;
|
|
262
262
|
}
|
|
263
263
|
catch (error) {
|
|
264
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid JSON array: ${error instanceof Error ? error.message :
|
|
264
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid JSON array: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
265
265
|
}
|
|
266
266
|
break;
|
|
267
|
-
case
|
|
268
|
-
const fieldName = this.getNodeParameter(
|
|
267
|
+
case 'field':
|
|
268
|
+
const fieldName = this.getNodeParameter('fieldName', i);
|
|
269
269
|
const fieldValue = items[i].json[fieldName];
|
|
270
270
|
if (!fieldValue) {
|
|
271
271
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Field '${fieldName}' not found in input data`);
|
|
@@ -287,9 +287,9 @@ class GitHubCopilotEmbeddings {
|
|
|
287
287
|
}
|
|
288
288
|
const result = await (0, EmbeddingsApiUtils_1.executeEmbeddingsRequest)(oauthToken, requestBody, enableRetry, maxRetries);
|
|
289
289
|
const openAIResponse = {
|
|
290
|
-
object:
|
|
290
|
+
object: 'list',
|
|
291
291
|
data: result.data.map((item) => ({
|
|
292
|
-
object:
|
|
292
|
+
object: 'embedding',
|
|
293
293
|
index: item.index,
|
|
294
294
|
embedding: item.embedding,
|
|
295
295
|
})),
|
|
@@ -305,7 +305,7 @@ class GitHubCopilotEmbeddings {
|
|
|
305
305
|
if (this.continueOnFail()) {
|
|
306
306
|
returnData.push({
|
|
307
307
|
json: {
|
|
308
|
-
error: error instanceof Error ? error.message :
|
|
308
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
309
309
|
},
|
|
310
310
|
pairedItem: { item: i },
|
|
311
311
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription, ILoadOptionsFunctions, INodePropertyOptions } from
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription, ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
|
|
2
2
|
export declare class GitHubCopilotOpenAI implements INodeType {
|
|
3
3
|
description: INodeTypeDescription;
|
|
4
4
|
methods: {
|