n8n-nodes-github-copilot 3.31.23 → 3.31.24

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.
@@ -117,22 +117,29 @@ class GitHubCopilotOpenAI {
117
117
  requestBody.seed = seed;
118
118
  }
119
119
  const response = await (0, utils_1.makeApiRequest)(this, GitHubCopilotEndpoints_1.GITHUB_COPILOT_API.ENDPOINTS.CHAT_COMPLETIONS, requestBody, false);
120
- const cleanJsonContent = (content) => {
120
+ const parseJsonContent = (content) => {
121
121
  if (!content)
122
122
  return content;
123
- const trimmed = content.trim();
124
- console.log('🔍 cleanJsonContent - Original length:', content.length);
125
- console.log('🔍 cleanJsonContent - Starts with:', trimmed.substring(0, 20));
126
- console.log('🔍 cleanJsonContent - Ends with:', trimmed.substring(trimmed.length - 20));
127
- const jsonBlockRegex = /^```(?:json)?\s*\n([\s\S]*?)\n```\s*$/;
128
- const match = trimmed.match(jsonBlockRegex);
129
- if (match && match[1]) {
130
- const cleaned = match[1].trim();
131
- console.log('✅ cleanJsonContent - Cleaned JSON (first 100 chars):', cleaned.substring(0, 100));
132
- return cleaned;
123
+ try {
124
+ const trimmed = content.trim();
125
+ console.log('🔍 parseJsonContent - Original length:', content.length);
126
+ console.log('🔍 parseJsonContent - First 50 chars:', trimmed.substring(0, 50));
127
+ const jsonBlockRegex = /^```(?:json)?\s*\n([\s\S]*?)\n```\s*$/;
128
+ const match = trimmed.match(jsonBlockRegex);
129
+ let jsonString = trimmed;
130
+ if (match && match[1]) {
131
+ jsonString = match[1].trim();
132
+ console.log('✅ parseJsonContent - Extracted from markdown block');
133
+ }
134
+ const parsed = JSON.parse(jsonString);
135
+ console.log('✅ parseJsonContent - Successfully parsed to object:', typeof parsed);
136
+ return parsed;
137
+ }
138
+ catch (error) {
139
+ console.error('❌ parseJsonContent - Parse error:', error);
140
+ console.log('⚠️ parseJsonContent - Returning original string');
141
+ return content;
133
142
  }
134
- console.log('⚠️ cleanJsonContent - No markdown block found, returning original');
135
- return content;
136
143
  };
137
144
  const openAIResponse = {
138
145
  id: response.id || `chatcmpl-${Date.now()}`,
@@ -145,7 +152,7 @@ class GitHubCopilotOpenAI {
145
152
  role: choice.message.role,
146
153
  ...(choice.message.content !== null && choice.message.content !== undefined && {
147
154
  content: (response_format === null || response_format === void 0 ? void 0 : response_format.type) === 'json_object'
148
- ? cleanJsonContent(choice.message.content)
155
+ ? parseJsonContent(choice.message.content)
149
156
  : choice.message.content
150
157
  }),
151
158
  ...(choice.message.tool_calls && { tool_calls: choice.message.tool_calls }),
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "3.31.23",
3
+ "version": "3.31.24",
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.23",
3
+ "version": "3.31.24",
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",