n8n-nodes-github-copilot 3.2.1 → 3.2.2
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.
|
@@ -118,9 +118,16 @@ class GitHubCopilotChatAPI {
|
|
|
118
118
|
if (includeAudio) {
|
|
119
119
|
const audioResult = await processAudioFileLegacy(this, i);
|
|
120
120
|
if (audioResult.dataUrl) {
|
|
121
|
+
contentArray.push({
|
|
122
|
+
type: 'input_audio',
|
|
123
|
+
input_audio: {
|
|
124
|
+
data: audioResult.dataUrl.split(',')[1],
|
|
125
|
+
format: audioResult.dataUrl.includes('mp3') ? 'mp3' : 'wav'
|
|
126
|
+
},
|
|
127
|
+
});
|
|
121
128
|
contentArray.push({
|
|
122
129
|
type: 'text',
|
|
123
|
-
text: `
|
|
130
|
+
text: `Please transcribe this audio: ${audioResult.description}`,
|
|
124
131
|
});
|
|
125
132
|
}
|
|
126
133
|
else {
|
|
@@ -142,7 +149,8 @@ class GitHubCopilotChatAPI {
|
|
|
142
149
|
stream: false,
|
|
143
150
|
...advancedOptions,
|
|
144
151
|
};
|
|
145
|
-
const
|
|
152
|
+
const hasMedia = includeImage || includeAudio;
|
|
153
|
+
const response = await (0, utils_1.makeApiRequest)(this, '/chat/completions', requestBody, hasMedia);
|
|
146
154
|
const result = {
|
|
147
155
|
message: ((_b = (_a = response.choices[0]) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.content) || '',
|
|
148
156
|
model,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { IExecuteFunctions } from 'n8n-workflow';
|
|
4
4
|
import { CopilotResponse } from './types';
|
|
5
|
-
export declare function makeApiRequest(context: IExecuteFunctions, endpoint: string, body: Record<string, unknown>,
|
|
5
|
+
export declare function makeApiRequest(context: IExecuteFunctions, endpoint: string, body: Record<string, unknown>, hasMedia?: boolean): Promise<CopilotResponse>;
|
|
6
6
|
export declare function downloadFileFromUrl(url: string): Promise<Buffer>;
|
|
7
7
|
export declare function getFileFromBinary(context: IExecuteFunctions, itemIndex: number, propertyName: string): Promise<Buffer>;
|
|
8
8
|
export declare function getImageMimeType(filename: string): string;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.truncateToTokenLimit = exports.validateTokenLimit = exports.estimateTokens = exports.validateFileSize = exports.getAudioMimeType = exports.getImageMimeType = exports.getFileFromBinary = exports.downloadFileFromUrl = exports.makeApiRequest = void 0;
|
|
4
|
-
async function makeApiRequest(context, endpoint, body,
|
|
4
|
+
async function makeApiRequest(context, endpoint, body, hasMedia = false) {
|
|
5
5
|
const credentials = await context.getCredentials('githubApi');
|
|
6
6
|
const headers = {
|
|
7
7
|
'Authorization': `Bearer ${credentials.accessToken}`,
|
|
8
8
|
'Content-Type': 'application/json',
|
|
9
9
|
'User-Agent': 'n8n-github-copilot-chat-api-node',
|
|
10
10
|
};
|
|
11
|
-
if (
|
|
11
|
+
if (hasMedia) {
|
|
12
12
|
headers['Copilot-Vision-Request'] = 'true';
|
|
13
|
+
headers['Copilot-Media-Request'] = 'true';
|
|
13
14
|
}
|
|
14
15
|
const options = {
|
|
15
16
|
method: 'POST',
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { IExecuteFunctions } from 'n8n-workflow';
|
|
2
2
|
export interface ChatMessage {
|
|
3
3
|
role: 'system' | 'user' | 'assistant';
|
|
4
|
-
content: string | Array<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
content: string | Array<ChatMessageContent>;
|
|
5
|
+
}
|
|
6
|
+
export interface ChatMessageContent {
|
|
7
|
+
type: string;
|
|
8
|
+
text?: string;
|
|
9
|
+
image_url?: {
|
|
10
|
+
url: string;
|
|
11
|
+
};
|
|
12
|
+
input_audio?: {
|
|
13
|
+
data: string;
|
|
14
|
+
format: string;
|
|
15
|
+
};
|
|
11
16
|
}
|
|
12
17
|
export interface CopilotResponse {
|
|
13
18
|
choices: Array<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-github-copilot",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "n8n community node for GitHub Copilot with CLI integration and official Chat API access to GPT-5, Claude, Gemini and more using your existing Copilot credits",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/sufficit/n8n-nodes-github-copilot",
|