n8n-nodes-github-copilot 3.38.15 → 3.38.17

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.
@@ -91,48 +91,46 @@ class GitHubCopilotChatAPI {
91
91
  content: systemMessage,
92
92
  });
93
93
  }
94
- let userContent = userMessage;
95
94
  if (includeMedia) {
96
95
  const mediaSource = this.getNodeParameter("mediaSource", i);
97
96
  const mediaFile = this.getNodeParameter("mediaFile", i, "");
98
97
  const mediaUrl = this.getNodeParameter("mediaUrl", i, "");
99
98
  const mediaBinaryProperty = this.getNodeParameter("mediaBinaryProperty", i, "");
100
- const contentArray = [];
101
99
  if (userMessage.trim()) {
102
- contentArray.push({
103
- type: "text",
104
- text: userMessage,
100
+ messages.push({
101
+ role: "user",
102
+ content: userMessage,
105
103
  });
106
104
  }
107
105
  try {
108
106
  const mediaResult = await (0, mediaDetection_1.processMediaFile)(this, i, mediaSource, mediaFile, mediaUrl, mediaBinaryProperty);
109
107
  if (mediaResult.type === "image" && mediaResult.dataUrl) {
110
- contentArray.push({
111
- type: "image_url",
112
- image_url: {
113
- url: mediaResult.dataUrl,
114
- },
108
+ messages.push({
109
+ role: "user",
110
+ content: mediaResult.dataUrl,
111
+ type: "file",
115
112
  });
116
113
  }
117
114
  else {
118
- contentArray.push({
119
- type: "text",
120
- text: `[Image processing failed: ${mediaResult.description}]`,
115
+ messages.push({
116
+ role: "user",
117
+ content: `[Image processing failed: ${mediaResult.description}]`,
121
118
  });
122
119
  }
123
120
  }
124
121
  catch (error) {
125
- contentArray.push({
126
- type: "text",
127
- text: `[Media processing error: ${error instanceof Error ? error.message : "Unknown error"}]`,
122
+ messages.push({
123
+ role: "user",
124
+ content: `[Media processing error: ${error instanceof Error ? error.message : "Unknown error"}]`,
128
125
  });
129
126
  }
130
- userContent = contentArray;
131
127
  }
132
- messages.push({
133
- role: "user",
134
- content: userContent,
135
- });
128
+ else {
129
+ messages.push({
130
+ role: "user",
131
+ content: userMessage,
132
+ });
133
+ }
136
134
  const requestBody = {
137
135
  model,
138
136
  messages,
@@ -4,6 +4,7 @@ export { CopilotResponse };
4
4
  export interface ChatMessage {
5
5
  role: "system" | "user" | "assistant";
6
6
  content: string | Array<ChatMessageContent>;
7
+ type?: "file";
7
8
  }
8
9
  export interface ChatMessageContent {
9
10
  type: string;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "3.38.15",
3
+ "version": "3.38.17",
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",
@@ -90,6 +90,11 @@ async function makeGitHubCopilotRequest(context, endpoint, body, hasMedia = fals
90
90
  }
91
91
  if (!response.ok) {
92
92
  const errorText = await response.text();
93
+ if (response.status === 400) {
94
+ console.log(`🚫 400 Bad Request detected - not retrying`);
95
+ const enhancedError = `GitHub Copilot API error: ${response.status} ${response.statusText}. ${errorText}`;
96
+ throw new Error(enhancedError);
97
+ }
93
98
  const tokenPrefix = token.substring(0, 4);
94
99
  const tokenSuffix = token.substring(token.length - 5);
95
100
  const tokenInfo = `${tokenPrefix}...${tokenSuffix}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "3.38.15",
3
+ "version": "3.38.17",
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",