n8n-nodes-github-copilot 3.38.24 → 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,28 +61,51 @@ 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`);
|
|
65
|
+
}
|
|
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;
|
|
45
71
|
}
|
|
72
|
+
return true;
|
|
73
|
+
});
|
|
74
|
+
if (validMessages.length === 0) {
|
|
75
|
+
throw new Error("No valid messages after filtering empty content");
|
|
46
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
110
|
generations: [[{
|
|
69
111
|
text: choice.message.content || "",
|
|
@@ -76,6 +118,9 @@ class GitHubCopilotChatOpenAI extends openai_1.ChatOpenAI {
|
|
|
76
118
|
};
|
|
77
119
|
}
|
|
78
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);
|
|
79
124
|
throw new Error(`GitHub Copilot API error: ${error instanceof Error ? error.message : String(error)}`);
|
|
80
125
|
}
|
|
81
126
|
}
|
|
@@ -152,11 +197,11 @@ class GitHubCopilotChatModel {
|
|
|
152
197
|
type: "number",
|
|
153
198
|
},
|
|
154
199
|
{
|
|
155
|
-
displayName: "Enable
|
|
156
|
-
name: "
|
|
200
|
+
displayName: "Enable Streaming",
|
|
201
|
+
name: "enableStreaming",
|
|
157
202
|
type: "boolean",
|
|
158
|
-
default:
|
|
159
|
-
description: "
|
|
203
|
+
default: false,
|
|
204
|
+
description: "Enable streaming responses for real-time output (experimental)",
|
|
160
205
|
},
|
|
161
206
|
{
|
|
162
207
|
displayName: "System Message",
|
|
@@ -176,15 +221,14 @@ class GitHubCopilotChatModel {
|
|
|
176
221
|
description: "Automatically retry requests when hitting TPM (Transactions Per Minute) quota limits (HTTP 403)",
|
|
177
222
|
},
|
|
178
223
|
{
|
|
179
|
-
displayName: "
|
|
180
|
-
name: "
|
|
224
|
+
displayName: "Request Timeout (seconds)",
|
|
225
|
+
name: "timeout",
|
|
181
226
|
type: "number",
|
|
182
|
-
default:
|
|
183
|
-
description: "Maximum
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
},
|
|
227
|
+
default: 120,
|
|
228
|
+
description: "Maximum time to wait for API response (in seconds)",
|
|
229
|
+
typeOptions: {
|
|
230
|
+
minValue: 10,
|
|
231
|
+
maxValue: 300,
|
|
188
232
|
},
|
|
189
233
|
},
|
|
190
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",
|