n8n-nodes-github-copilot 3.38.23 → 3.38.25
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.
|
@@ -15,6 +15,10 @@ class GitHubCopilotChatOpenAI extends openai_1.ChatOpenAI {
|
|
|
15
15
|
this.options = options;
|
|
16
16
|
}
|
|
17
17
|
async _generate(messages, options) {
|
|
18
|
+
var _a;
|
|
19
|
+
if (!messages || messages.length === 0) {
|
|
20
|
+
throw new Error("No messages provided for generation");
|
|
21
|
+
}
|
|
18
22
|
let copilotMessages = messages.map(msg => {
|
|
19
23
|
let role;
|
|
20
24
|
switch (msg._getType()) {
|
|
@@ -28,11 +32,26 @@ class GitHubCopilotChatOpenAI extends openai_1.ChatOpenAI {
|
|
|
28
32
|
role = 'system';
|
|
29
33
|
break;
|
|
30
34
|
default:
|
|
35
|
+
console.warn(`⚠️ Unknown message type: ${msg._getType()}, defaulting to 'user'`);
|
|
31
36
|
role = 'user';
|
|
32
37
|
}
|
|
38
|
+
let content = msg.content;
|
|
39
|
+
if (typeof content === 'string') {
|
|
40
|
+
}
|
|
41
|
+
else if (Array.isArray(content)) {
|
|
42
|
+
console.warn(`⚠️ Complex content detected, stringifying:`, content);
|
|
43
|
+
content = JSON.stringify(content);
|
|
44
|
+
}
|
|
45
|
+
else if (content === null || content === undefined) {
|
|
46
|
+
content = '';
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
console.warn(`⚠️ Non-string content detected, stringifying:`, typeof content);
|
|
50
|
+
content = JSON.stringify(content);
|
|
51
|
+
}
|
|
33
52
|
return {
|
|
34
53
|
role,
|
|
35
|
-
content
|
|
54
|
+
content,
|
|
36
55
|
};
|
|
37
56
|
});
|
|
38
57
|
if (this.options.systemMessage && this.options.systemMessage.trim()) {
|
|
@@ -42,39 +61,66 @@ class GitHubCopilotChatOpenAI extends openai_1.ChatOpenAI {
|
|
|
42
61
|
role: 'system',
|
|
43
62
|
content: this.options.systemMessage,
|
|
44
63
|
});
|
|
64
|
+
console.log(`🔧 Added system message from options`);
|
|
45
65
|
}
|
|
46
66
|
}
|
|
67
|
+
const validMessages = copilotMessages.filter(msg => {
|
|
68
|
+
if (!msg.content || msg.content.trim() === '') {
|
|
69
|
+
console.warn(`⚠️ Filtering out empty message with role: ${msg.role}`);
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
});
|
|
74
|
+
if (validMessages.length === 0) {
|
|
75
|
+
throw new Error("No valid messages after filtering empty content");
|
|
76
|
+
}
|
|
47
77
|
const requestBody = {
|
|
48
78
|
model: this.modelName || this.model,
|
|
49
|
-
messages:
|
|
79
|
+
messages: validMessages,
|
|
50
80
|
temperature: this.temperature,
|
|
51
81
|
max_tokens: this.maxTokens,
|
|
52
82
|
top_p: this.topP,
|
|
53
|
-
stream: false,
|
|
83
|
+
stream: this.options.enableStreaming || false,
|
|
54
84
|
};
|
|
55
85
|
if (this.options.tools && this.options.tools.length > 0) {
|
|
56
86
|
requestBody.tools = this.options.tools;
|
|
57
87
|
requestBody.tool_choice = this.options.tool_choice || "auto";
|
|
88
|
+
console.log(`🔧 Request includes ${this.options.tools.length} tools`);
|
|
58
89
|
}
|
|
90
|
+
const startTime = Date.now();
|
|
59
91
|
try {
|
|
60
92
|
const response = await (0, GitHubCopilotApiUtils_1.makeGitHubCopilotRequest)(this.context, GitHubCopilotEndpoints_1.GITHUB_COPILOT_API.ENDPOINTS.CHAT_COMPLETIONS, requestBody, false);
|
|
93
|
+
const endTime = Date.now();
|
|
94
|
+
const latency = endTime - startTime;
|
|
95
|
+
console.log(`⏱️ GitHub Copilot API call completed in ${latency}ms`);
|
|
96
|
+
if (!response.choices || response.choices.length === 0) {
|
|
97
|
+
throw new Error("GitHub Copilot API returned no choices in response");
|
|
98
|
+
}
|
|
61
99
|
const choice = response.choices[0];
|
|
100
|
+
if (!choice.message) {
|
|
101
|
+
throw new Error("GitHub Copilot API returned choice without message");
|
|
102
|
+
}
|
|
62
103
|
const langchainMessage = {
|
|
63
104
|
_getType: () => choice.message.role,
|
|
64
105
|
content: choice.message.content || "",
|
|
65
106
|
tool_calls: choice.message.tool_calls,
|
|
66
107
|
};
|
|
108
|
+
console.log(`📝 Response: role=${choice.message.role}, content_length=${((_a = choice.message.content) === null || _a === void 0 ? void 0 : _a.length) || 0}, finish_reason=${choice.finish_reason}`);
|
|
67
109
|
return {
|
|
68
|
-
generations: [{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
110
|
+
generations: [[{
|
|
111
|
+
text: choice.message.content || "",
|
|
112
|
+
generationInfo: {
|
|
113
|
+
finish_reason: choice.finish_reason,
|
|
114
|
+
},
|
|
115
|
+
message: langchainMessage,
|
|
116
|
+
}]],
|
|
117
|
+
tokenUsage: response.usage,
|
|
75
118
|
};
|
|
76
119
|
}
|
|
77
120
|
catch (error) {
|
|
121
|
+
const endTime = Date.now();
|
|
122
|
+
const latency = endTime - startTime;
|
|
123
|
+
console.error(`❌ GitHub Copilot API call failed after ${latency}ms:`, error);
|
|
78
124
|
throw new Error(`GitHub Copilot API error: ${error instanceof Error ? error.message : String(error)}`);
|
|
79
125
|
}
|
|
80
126
|
}
|
|
@@ -151,11 +197,11 @@ class GitHubCopilotChatModel {
|
|
|
151
197
|
type: "number",
|
|
152
198
|
},
|
|
153
199
|
{
|
|
154
|
-
displayName: "Enable
|
|
155
|
-
name: "
|
|
200
|
+
displayName: "Enable Streaming",
|
|
201
|
+
name: "enableStreaming",
|
|
156
202
|
type: "boolean",
|
|
157
|
-
default:
|
|
158
|
-
description: "
|
|
203
|
+
default: false,
|
|
204
|
+
description: "Enable streaming responses for real-time output (experimental)",
|
|
159
205
|
},
|
|
160
206
|
{
|
|
161
207
|
displayName: "System Message",
|
|
@@ -175,15 +221,14 @@ class GitHubCopilotChatModel {
|
|
|
175
221
|
description: "Automatically retry requests when hitting TPM (Transactions Per Minute) quota limits (HTTP 403)",
|
|
176
222
|
},
|
|
177
223
|
{
|
|
178
|
-
displayName: "
|
|
179
|
-
name: "
|
|
224
|
+
displayName: "Request Timeout (seconds)",
|
|
225
|
+
name: "timeout",
|
|
180
226
|
type: "number",
|
|
181
|
-
default:
|
|
182
|
-
description: "Maximum
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
},
|
|
227
|
+
default: 120,
|
|
228
|
+
description: "Maximum time to wait for API response (in seconds)",
|
|
229
|
+
typeOptions: {
|
|
230
|
+
minValue: 10,
|
|
231
|
+
maxValue: 300,
|
|
187
232
|
},
|
|
188
233
|
},
|
|
189
234
|
{
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-github-copilot",
|
|
3
|
-
"version": "3.38.
|
|
3
|
+
"version": "3.38.25",
|
|
4
4
|
"description": "n8n community node for GitHub Copilot with CLI integration, Chat API access, and AI Chat Model for workflows with full tools and function calling support - 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",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-github-copilot",
|
|
3
|
-
"version": "3.38.
|
|
3
|
+
"version": "3.38.25",
|
|
4
4
|
"description": "n8n community node for GitHub Copilot with CLI integration, Chat API access, and AI Chat Model for workflows with full tools and function calling support - 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",
|