n8n-nodes-github-copilot 4.4.4 → 4.4.6

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.
@@ -113,7 +113,44 @@ class GitHubCopilotOpenAI {
113
113
  role: msg.role,
114
114
  content: msg.content,
115
115
  };
116
- if (msg.type && (msg.type === 'text' || msg.type === 'image_url')) {
116
+ const msgType = msg.type || 'text';
117
+ if (msgType === 'file') {
118
+ const binaryKeyData = items[i].binary;
119
+ const keyToUse = msg.binaryPropertyName || 'data';
120
+ if (binaryKeyData && binaryKeyData[keyToUse]) {
121
+ try {
122
+ const binaryData = binaryKeyData[keyToUse];
123
+ const mimeType = binaryData.mimeType || 'application/octet-stream';
124
+ const buffer = await this.helpers.getBinaryDataBuffer(i, keyToUse);
125
+ const base64 = buffer.toString('base64');
126
+ const dataUrl = `data:${mimeType};base64,${base64}`;
127
+ const contentArray = [];
128
+ if (message.content && message.content.trim() !== '') {
129
+ contentArray.push({
130
+ type: 'text',
131
+ text: message.content,
132
+ });
133
+ }
134
+ contentArray.push({
135
+ type: 'image_url',
136
+ image_url: {
137
+ url: dataUrl,
138
+ },
139
+ });
140
+ message.content = contentArray;
141
+ console.log(`📎 Attached binary file '${keyToUse}' (${mimeType}) as image_url`);
142
+ }
143
+ catch (err) {
144
+ console.error(`❌ Failed to read binary data for '${keyToUse}':`, err);
145
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to read binary file '${keyToUse}'. Ensure the binary data exists.`, { itemIndex: i });
146
+ }
147
+ }
148
+ else {
149
+ const available = binaryKeyData ? Object.keys(binaryKeyData).join(', ') : 'none';
150
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Binary property '${keyToUse}' not found. Available binary properties: ${available}`, { itemIndex: i });
151
+ }
152
+ }
153
+ else if (msg.type && (msg.type === 'text' || msg.type === 'image_url')) {
117
154
  message.type = msg.type;
118
155
  }
119
156
  messages.push(message);
@@ -152,6 +189,18 @@ class GitHubCopilotOpenAI {
152
189
  }
153
190
  }
154
191
  console.log('📤 Final messages being sent to API:', JSON.stringify(messages, null, 2));
192
+ for (let msgIndex = 0; msgIndex < messages.length; msgIndex++) {
193
+ const msg = messages[msgIndex];
194
+ if (msg.content !== null &&
195
+ msg.content !== undefined &&
196
+ typeof msg.content === 'object' &&
197
+ !Array.isArray(msg.content)) {
198
+ const originalContent = msg.content;
199
+ msg.content = JSON.stringify(msg.content, null, 2);
200
+ console.log(`🔄 Auto-converted message[${msgIndex}].content from object to JSON string`);
201
+ console.log(' Original type:', typeof originalContent);
202
+ }
203
+ }
155
204
  const advancedOptions = this.getNodeParameter('advancedOptions', i, {});
156
205
  let parsedTools = [];
157
206
  const tools = advancedOptions.tools;
@@ -118,12 +118,25 @@ exports.nodeProperties = [
118
118
  {
119
119
  name: 'File',
120
120
  value: 'file',
121
- description: 'File attachment (use content as data URL or base64)',
121
+ description: 'File attachment from binary input',
122
122
  },
123
123
  ],
124
124
  default: 'text',
125
125
  description: 'The type of message content (optional)',
126
126
  },
127
+ {
128
+ displayName: 'Input Binary Field',
129
+ name: 'binaryPropertyName',
130
+ type: 'string',
131
+ default: 'data',
132
+ required: true,
133
+ displayOptions: {
134
+ show: {
135
+ type: ['file'],
136
+ },
137
+ },
138
+ description: 'The name of the binary property that contains the file to upload',
139
+ },
127
140
  ],
128
141
  },
129
142
  ],
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "4.4.4",
3
+ "version": "4.4.6",
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": "4.4.4",
3
+ "version": "4.4.6",
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",