n8n-nodes-github-copilot 3.31.26 โ 3.31.28
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.
|
@@ -44,7 +44,15 @@ class GitHubCopilotOpenAI {
|
|
|
44
44
|
if (messagesInputMode === "json") {
|
|
45
45
|
const messagesJson = this.getNodeParameter("messagesJson", i, "[]");
|
|
46
46
|
try {
|
|
47
|
-
|
|
47
|
+
let parsed;
|
|
48
|
+
if (typeof messagesJson === 'object') {
|
|
49
|
+
parsed = messagesJson;
|
|
50
|
+
console.log('๐ฅ Received messages as direct object/array (no parsing needed)');
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
parsed = JSON.parse(messagesJson);
|
|
54
|
+
console.log('๐ฅ Parsed messages from JSON string');
|
|
55
|
+
}
|
|
48
56
|
if (Array.isArray(parsed)) {
|
|
49
57
|
messages = parsed;
|
|
50
58
|
}
|
|
@@ -81,9 +89,16 @@ class GitHubCopilotOpenAI {
|
|
|
81
89
|
});
|
|
82
90
|
}
|
|
83
91
|
let parsedTools = [];
|
|
84
|
-
if (tools
|
|
92
|
+
if (tools) {
|
|
85
93
|
try {
|
|
86
|
-
|
|
94
|
+
if (typeof tools === 'object' && Array.isArray(tools)) {
|
|
95
|
+
parsedTools = tools;
|
|
96
|
+
console.log('๐ฅ Received tools as direct array (no parsing needed)');
|
|
97
|
+
}
|
|
98
|
+
else if (typeof tools === 'string' && tools.trim()) {
|
|
99
|
+
parsedTools = JSON.parse(tools);
|
|
100
|
+
console.log('๐ฅ Parsed tools from JSON string');
|
|
101
|
+
}
|
|
87
102
|
}
|
|
88
103
|
catch (error) {
|
|
89
104
|
throw new Error(`Failed to parse tools JSON: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -147,32 +162,30 @@ class GitHubCopilotOpenAI {
|
|
|
147
162
|
requestBody.seed = seed;
|
|
148
163
|
}
|
|
149
164
|
const response = await (0, utils_1.makeApiRequest)(this, GitHubCopilotEndpoints_1.GITHUB_COPILOT_API.ENDPOINTS.CHAT_COMPLETIONS, requestBody, false);
|
|
150
|
-
const
|
|
151
|
-
if (!content)
|
|
165
|
+
const cleanJsonFromMarkdown = (content) => {
|
|
166
|
+
if (!content || typeof content !== 'string') {
|
|
152
167
|
return content;
|
|
168
|
+
}
|
|
153
169
|
try {
|
|
154
170
|
const trimmed = content.trim();
|
|
155
|
-
console.log('
|
|
156
|
-
console.log('๐ parseJsonContent - First 50 chars:', trimmed.substring(0, 50));
|
|
171
|
+
console.log('๐งน cleanJsonFromMarkdown - Input length:', trimmed.length);
|
|
157
172
|
const jsonBlockRegex = /^```(?:json)?\s*\n([\s\S]*?)\n```\s*$/;
|
|
158
173
|
const match = trimmed.match(jsonBlockRegex);
|
|
159
|
-
let jsonString = trimmed;
|
|
160
174
|
if (match && match[1]) {
|
|
161
|
-
|
|
162
|
-
console.log('โ
|
|
175
|
+
const extracted = match[1].trim();
|
|
176
|
+
console.log('โ
cleanJsonFromMarkdown - Extracted from markdown block');
|
|
177
|
+
return extracted;
|
|
163
178
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return parsed;
|
|
179
|
+
console.log('โน๏ธ cleanJsonFromMarkdown - No markdown block found, returning as is');
|
|
180
|
+
return trimmed;
|
|
167
181
|
}
|
|
168
182
|
catch (error) {
|
|
169
|
-
console.error('โ
|
|
170
|
-
console.log('โ ๏ธ parseJsonContent - Returning original string');
|
|
183
|
+
console.error('โ cleanJsonFromMarkdown - Error:', error);
|
|
171
184
|
return content;
|
|
172
185
|
}
|
|
173
186
|
};
|
|
174
187
|
console.log('๐จ Building OpenAI response...');
|
|
175
|
-
console.log('๐ response_format check:', (response_format === null || response_format === void 0 ? void 0 : response_format.type) === 'json_object' ? 'WILL
|
|
188
|
+
console.log('๐ response_format check:', (response_format === null || response_format === void 0 ? void 0 : response_format.type) === 'json_object' ? 'WILL CLEAN MARKDOWN' : 'WILL KEEP AS IS');
|
|
176
189
|
const openAIResponse = {
|
|
177
190
|
id: response.id || `chatcmpl-${Date.now()}`,
|
|
178
191
|
object: response.object || "chat.completion",
|
|
@@ -188,12 +201,12 @@ class GitHubCopilotOpenAI {
|
|
|
188
201
|
let processedContent = choice.message.content;
|
|
189
202
|
if (choice.message.content !== null && choice.message.content !== undefined) {
|
|
190
203
|
if ((response_format === null || response_format === void 0 ? void 0 : response_format.type) === 'json_object') {
|
|
191
|
-
console.log('
|
|
192
|
-
processedContent =
|
|
204
|
+
console.log(' ๐งน Applying cleanJsonFromMarkdown (keeping as string)...');
|
|
205
|
+
processedContent = cleanJsonFromMarkdown(choice.message.content);
|
|
193
206
|
console.log(' โ
Processed content type:', typeof processedContent);
|
|
194
207
|
}
|
|
195
208
|
else {
|
|
196
|
-
console.log(' โน๏ธ Keeping content as
|
|
209
|
+
console.log(' โน๏ธ Keeping content as is');
|
|
197
210
|
}
|
|
198
211
|
}
|
|
199
212
|
return {
|
|
@@ -203,8 +216,11 @@ class GitHubCopilotOpenAI {
|
|
|
203
216
|
...(choice.message.content !== null && choice.message.content !== undefined && {
|
|
204
217
|
content: processedContent
|
|
205
218
|
}),
|
|
219
|
+
refusal: choice.message.refusal || null,
|
|
220
|
+
annotations: choice.message.annotations || [],
|
|
206
221
|
...(choice.message.tool_calls && { tool_calls: choice.message.tool_calls }),
|
|
207
222
|
},
|
|
223
|
+
logprobs: choice.logprobs || null,
|
|
208
224
|
finish_reason: choice.finish_reason,
|
|
209
225
|
};
|
|
210
226
|
}),
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-github-copilot",
|
|
3
|
-
"version": "3.31.
|
|
3
|
+
"version": "3.31.28",
|
|
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",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-github-copilot",
|
|
3
|
-
"version": "3.31.
|
|
3
|
+
"version": "3.31.28",
|
|
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",
|