n8n-nodes-github-copilot 3.31.24 ā 3.31.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.
|
@@ -40,10 +40,22 @@ class GitHubCopilotOpenAI {
|
|
|
40
40
|
const temperature = this.getNodeParameter("temperature", i, 1);
|
|
41
41
|
const tools = this.getNodeParameter("tools", i, "");
|
|
42
42
|
let messages = [];
|
|
43
|
+
let requestBodyFromJson = undefined;
|
|
43
44
|
if (messagesInputMode === "json") {
|
|
44
45
|
const messagesJson = this.getNodeParameter("messagesJson", i, "[]");
|
|
45
46
|
try {
|
|
46
|
-
|
|
47
|
+
const parsed = JSON.parse(messagesJson);
|
|
48
|
+
if (Array.isArray(parsed)) {
|
|
49
|
+
messages = parsed;
|
|
50
|
+
}
|
|
51
|
+
else if (parsed.messages && Array.isArray(parsed.messages)) {
|
|
52
|
+
messages = parsed.messages;
|
|
53
|
+
requestBodyFromJson = parsed;
|
|
54
|
+
console.log('š„ Full OpenAI request body received:', JSON.stringify(parsed, null, 2));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
messages = parsed;
|
|
58
|
+
}
|
|
47
59
|
}
|
|
48
60
|
catch (error) {
|
|
49
61
|
throw new Error(`Failed to parse messages JSON: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -79,15 +91,33 @@ class GitHubCopilotOpenAI {
|
|
|
79
91
|
}
|
|
80
92
|
const max_tokens = this.getNodeParameter("max_tokens", i, 4096);
|
|
81
93
|
const seed = this.getNodeParameter("seed", i, 0);
|
|
94
|
+
const response_format_ui = this.getNodeParameter("response_format", i, "text");
|
|
82
95
|
const advancedOptions = this.getNodeParameter("advancedOptions", i, {});
|
|
83
96
|
let response_format = undefined;
|
|
84
|
-
if (
|
|
97
|
+
if (requestBodyFromJson === null || requestBodyFromJson === void 0 ? void 0 : requestBodyFromJson.response_format) {
|
|
98
|
+
response_format = requestBodyFromJson.response_format;
|
|
99
|
+
console.log('š response_format from JSON request body:', JSON.stringify(response_format));
|
|
100
|
+
}
|
|
101
|
+
else if (response_format_ui && response_format_ui !== 'text') {
|
|
102
|
+
response_format = { type: response_format_ui };
|
|
103
|
+
console.log('š response_format from UI field:', JSON.stringify(response_format));
|
|
104
|
+
}
|
|
105
|
+
else if (advancedOptions.response_format && typeof advancedOptions.response_format === 'string') {
|
|
85
106
|
try {
|
|
86
107
|
response_format = JSON.parse(advancedOptions.response_format);
|
|
108
|
+
console.log('š response_format from advancedOptions:', JSON.stringify(response_format));
|
|
87
109
|
}
|
|
88
110
|
catch {
|
|
111
|
+
console.log('ā ļø Failed to parse response_format from advancedOptions');
|
|
89
112
|
}
|
|
90
113
|
}
|
|
114
|
+
if (response_format) {
|
|
115
|
+
console.log('ā
Final response_format:', JSON.stringify(response_format));
|
|
116
|
+
console.log('š response_format.type:', response_format.type);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
console.log('ā¹ļø No response_format specified - using default text format');
|
|
120
|
+
}
|
|
91
121
|
const modelMapping = {
|
|
92
122
|
"gpt-4": "gpt-4o",
|
|
93
123
|
"gpt-4o": "gpt-4o",
|
|
@@ -141,24 +171,43 @@ class GitHubCopilotOpenAI {
|
|
|
141
171
|
return content;
|
|
142
172
|
}
|
|
143
173
|
};
|
|
174
|
+
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 PARSE JSON' : 'WILL KEEP AS STRING');
|
|
144
176
|
const openAIResponse = {
|
|
145
177
|
id: response.id || `chatcmpl-${Date.now()}`,
|
|
146
178
|
object: response.object || "chat.completion",
|
|
147
179
|
created: response.created || Math.floor(Date.now() / 1000),
|
|
148
180
|
model: model,
|
|
149
|
-
choices: response.choices.map((choice) =>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
181
|
+
choices: response.choices.map((choice, choiceIndex) => {
|
|
182
|
+
var _a;
|
|
183
|
+
console.log(`\nš Processing choice ${choiceIndex}:`);
|
|
184
|
+
console.log(' - role:', choice.message.role);
|
|
185
|
+
console.log(' - content type:', typeof choice.message.content);
|
|
186
|
+
console.log(' - content length:', ((_a = choice.message.content) === null || _a === void 0 ? void 0 : _a.length) || 0);
|
|
187
|
+
console.log(' - has tool_calls:', !!choice.message.tool_calls);
|
|
188
|
+
let processedContent = choice.message.content;
|
|
189
|
+
if (choice.message.content !== null && choice.message.content !== undefined) {
|
|
190
|
+
if ((response_format === null || response_format === void 0 ? void 0 : response_format.type) === 'json_object') {
|
|
191
|
+
console.log(' š Applying parseJsonContent...');
|
|
192
|
+
processedContent = parseJsonContent(choice.message.content);
|
|
193
|
+
console.log(' ā
Processed content type:', typeof processedContent);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
console.log(' ā¹ļø Keeping content as string');
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
index: choice.index,
|
|
201
|
+
message: {
|
|
202
|
+
role: choice.message.role,
|
|
203
|
+
...(choice.message.content !== null && choice.message.content !== undefined && {
|
|
204
|
+
content: processedContent
|
|
205
|
+
}),
|
|
206
|
+
...(choice.message.tool_calls && { tool_calls: choice.message.tool_calls }),
|
|
207
|
+
},
|
|
208
|
+
finish_reason: choice.finish_reason,
|
|
209
|
+
};
|
|
210
|
+
}),
|
|
162
211
|
usage: response.usage || {
|
|
163
212
|
prompt_tokens: 0,
|
|
164
213
|
completion_tokens: 0,
|
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.26",
|
|
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.26",
|
|
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",
|