n8n-nodes-github-copilot 3.38.21 → 3.38.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.
@@ -7,6 +7,53 @@ const GitHubCopilotEndpoints_1 = require("../../shared/utils/GitHubCopilotEndpoi
7
7
  const DynamicModelLoader_1 = require("../../shared/models/DynamicModelLoader");
8
8
  const ModelProperties_1 = require("../../shared/properties/ModelProperties");
9
9
  const ModelVersionRequirements_1 = require("../../shared/models/ModelVersionRequirements");
10
+ const GitHubCopilotApiUtils_1 = require("../../shared/utils/GitHubCopilotApiUtils");
11
+ class GitHubCopilotChatOpenAI extends openai_1.ChatOpenAI {
12
+ constructor(context, options, config) {
13
+ super(config);
14
+ this.context = context;
15
+ this.options = options;
16
+ }
17
+ async _generate(messages, options) {
18
+ const copilotMessages = messages.map(msg => ({
19
+ role: msg._getType(),
20
+ content: typeof msg.content === 'string' ? msg.content : JSON.stringify(msg.content),
21
+ }));
22
+ const requestBody = {
23
+ model: this.modelName || this.model,
24
+ messages: copilotMessages,
25
+ temperature: this.temperature,
26
+ max_tokens: this.maxTokens,
27
+ top_p: this.topP,
28
+ stream: false,
29
+ };
30
+ if (this.options.tools && this.options.tools.length > 0) {
31
+ requestBody.tools = this.options.tools;
32
+ requestBody.tool_choice = this.options.tool_choice || "auto";
33
+ }
34
+ try {
35
+ const response = await (0, GitHubCopilotApiUtils_1.makeGitHubCopilotRequest)(this.context, GitHubCopilotEndpoints_1.GITHUB_COPILOT_API.ENDPOINTS.CHAT_COMPLETIONS, requestBody, false);
36
+ const choice = response.choices[0];
37
+ const langchainMessage = {
38
+ _getType: () => choice.message.role,
39
+ content: choice.message.content || "",
40
+ tool_calls: choice.message.tool_calls,
41
+ };
42
+ return {
43
+ generations: [{
44
+ text: choice.message.content || "",
45
+ message: langchainMessage,
46
+ }],
47
+ llmOutput: {
48
+ tokenUsage: response.usage,
49
+ },
50
+ };
51
+ }
52
+ catch (error) {
53
+ throw new Error(`GitHub Copilot API error: ${error instanceof Error ? error.message : String(error)}`);
54
+ }
55
+ }
56
+ }
10
57
  class GitHubCopilotChatModel {
11
58
  constructor() {
12
59
  this.description = {
@@ -245,7 +292,7 @@ class GitHubCopilotChatModel {
245
292
  },
246
293
  },
247
294
  };
248
- const chatModel = new openai_1.ChatOpenAI(modelConfig);
295
+ const chatModel = new GitHubCopilotChatOpenAI(this, options, modelConfig);
249
296
  return {
250
297
  response: chatModel,
251
298
  };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "3.38.21",
3
+ "version": "3.38.22",
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": "3.38.21",
3
+ "version": "3.38.22",
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",