n8n-nodes-github-copilot 3.31.13 → 3.31.14
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.
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GitHubCopilotOpenAI = void 0;
|
|
4
4
|
const nodeProperties_1 = require("./nodeProperties");
|
|
5
|
+
const utils_1 = require("../GitHubCopilotChatAPI/utils");
|
|
6
|
+
const GitHubCopilotEndpoints_1 = require("../../shared/utils/GitHubCopilotEndpoints");
|
|
5
7
|
class GitHubCopilotOpenAI {
|
|
6
8
|
constructor() {
|
|
7
9
|
this.description = {
|
|
@@ -66,49 +68,73 @@ class GitHubCopilotOpenAI {
|
|
|
66
68
|
content: "Hello! How can you help me?",
|
|
67
69
|
});
|
|
68
70
|
}
|
|
71
|
+
let parsedTools = [];
|
|
72
|
+
if (tools && tools.trim()) {
|
|
73
|
+
try {
|
|
74
|
+
parsedTools = JSON.parse(tools);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
throw new Error(`Failed to parse tools JSON: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const max_tokens = this.getNodeParameter("max_tokens", i, 4096);
|
|
81
|
+
const seed = this.getNodeParameter("seed", i, 0);
|
|
82
|
+
const advancedOptions = this.getNodeParameter("advancedOptions", i, {});
|
|
83
|
+
let response_format = undefined;
|
|
84
|
+
if (advancedOptions.response_format && typeof advancedOptions.response_format === 'string') {
|
|
85
|
+
try {
|
|
86
|
+
response_format = JSON.parse(advancedOptions.response_format);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
}
|
|
90
|
+
}
|
|
69
91
|
const modelMapping = {
|
|
70
92
|
"gpt-4": "gpt-4o",
|
|
71
93
|
"gpt-4o": "gpt-4o",
|
|
72
94
|
"gpt-4o-mini": "gpt-4o-mini",
|
|
95
|
+
"gpt-4-turbo": "gpt-4o",
|
|
73
96
|
"claude-3-5-sonnet": "claude-3.5-sonnet",
|
|
97
|
+
"claude-3.5-sonnet-20241022": "claude-3.5-sonnet",
|
|
98
|
+
"o1": "o1",
|
|
99
|
+
"o1-preview": "o1-preview",
|
|
100
|
+
"o1-mini": "o1-mini",
|
|
74
101
|
};
|
|
75
|
-
const copilotModel = modelMapping[model] ||
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
102
|
+
const copilotModel = modelMapping[model] || model;
|
|
103
|
+
const requestBody = {
|
|
104
|
+
model: copilotModel,
|
|
105
|
+
messages,
|
|
106
|
+
stream: false,
|
|
107
|
+
temperature,
|
|
108
|
+
max_tokens,
|
|
109
|
+
};
|
|
110
|
+
if (parsedTools.length > 0) {
|
|
111
|
+
requestBody.tools = parsedTools;
|
|
112
|
+
}
|
|
113
|
+
if (response_format) {
|
|
114
|
+
requestBody.response_format = response_format;
|
|
115
|
+
}
|
|
116
|
+
if (seed > 0) {
|
|
117
|
+
requestBody.seed = seed;
|
|
118
|
+
}
|
|
119
|
+
const response = await (0, utils_1.makeApiRequest)(this, GitHubCopilotEndpoints_1.GITHUB_COPILOT_API.ENDPOINTS.CHAT_COMPLETIONS, requestBody, false);
|
|
120
|
+
const openAIResponse = {
|
|
121
|
+
id: response.id || `chatcmpl-${Date.now()}`,
|
|
122
|
+
object: response.object || "chat.completion",
|
|
123
|
+
created: response.created || Math.floor(Date.now() / 1000),
|
|
80
124
|
model: model,
|
|
81
|
-
choices:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
- Messages: ${messages.length}
|
|
91
|
-
- Temperature: ${temperature}
|
|
92
|
-
- Tools: ${tools ? "Yes" : "No"}
|
|
93
|
-
|
|
94
|
-
**Sample Messages:**
|
|
95
|
-
${messages
|
|
96
|
-
.map((msg, idx) => `${idx + 1}. [${msg.role}]: ${msg.content.substring(0, 100)}${msg.content.length > 100 ? "..." : ""}`)
|
|
97
|
-
.join("\n")}
|
|
98
|
-
|
|
99
|
-
This is a mock response. The real GitHub Copilot integration will be implemented next.`,
|
|
100
|
-
},
|
|
101
|
-
finish_reason: "stop",
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
usage: {
|
|
105
|
-
prompt_tokens: 50,
|
|
106
|
-
completion_tokens: 125,
|
|
107
|
-
total_tokens: 175,
|
|
125
|
+
choices: response.choices.map((choice) => ({
|
|
126
|
+
index: choice.index,
|
|
127
|
+
message: choice.message,
|
|
128
|
+
finish_reason: choice.finish_reason,
|
|
129
|
+
})),
|
|
130
|
+
usage: response.usage || {
|
|
131
|
+
prompt_tokens: 0,
|
|
132
|
+
completion_tokens: 0,
|
|
133
|
+
total_tokens: 0,
|
|
108
134
|
},
|
|
109
135
|
};
|
|
110
136
|
returnData.push({
|
|
111
|
-
json:
|
|
137
|
+
json: openAIResponse,
|
|
112
138
|
pairedItem: { item: i },
|
|
113
139
|
});
|
|
114
140
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-github-copilot",
|
|
3
|
-
"version": "3.31.
|
|
3
|
+
"version": "3.31.14",
|
|
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.
|
|
3
|
+
"version": "3.31.14",
|
|
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",
|