n8n-nodes-github-copilot 3.31.20 → 3.31.22

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,6 +117,17 @@ 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) => {
121
+ if (!content)
122
+ return content;
123
+ const trimmed = content.trim();
124
+ const jsonBlockRegex = /^```(?:json)?\s*\n([\s\S]*?)\n```\s*$/;
125
+ const match = trimmed.match(jsonBlockRegex);
126
+ if (match && match[1]) {
127
+ return match[1].trim();
128
+ }
129
+ return trimmed;
130
+ };
120
131
  const openAIResponse = {
121
132
  id: response.id || `chatcmpl-${Date.now()}`,
122
133
  object: response.object || "chat.completion",
@@ -126,7 +137,11 @@ class GitHubCopilotOpenAI {
126
137
  index: choice.index,
127
138
  message: {
128
139
  role: choice.message.role,
129
- ...(choice.message.content !== null && choice.message.content !== undefined && { content: choice.message.content }),
140
+ ...(choice.message.content !== null && choice.message.content !== undefined && {
141
+ content: (response_format === null || response_format === void 0 ? void 0 : response_format.type) === 'json_object'
142
+ ? cleanJsonContent(choice.message.content)
143
+ : choice.message.content
144
+ }),
130
145
  ...(choice.message.tool_calls && { tool_calls: choice.message.tool_calls }),
131
146
  },
132
147
  finish_reason: choice.finish_reason,
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "3.31.20",
3
+ "version": "3.31.22",
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.20",
3
+ "version": "3.31.22",
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",