n8n-nodes-github-copilot 3.3.0 → 3.5.0

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.
Files changed (37) hide show
  1. package/dist/credentials/GitHubApi.credentials.d.ts +8 -8
  2. package/dist/credentials/GitHubApi.credentials.js +50 -50
  3. package/dist/credentials/GitHubApiManual.credentials.d.ts +7 -7
  4. package/dist/credentials/GitHubApiManual.credentials.js +33 -33
  5. package/dist/nodes/GitHubCopilot/GitHubCopilot.node.d.ts +5 -5
  6. package/dist/nodes/GitHubCopilot/GitHubCopilot.node.js +324 -324
  7. package/dist/nodes/GitHubCopilotChatAPI/GitHubCopilotChatAPI.node.d.ts +5 -5
  8. package/dist/nodes/GitHubCopilotChatAPI/GitHubCopilotChatAPI.node.js +141 -146
  9. package/dist/nodes/GitHubCopilotChatAPI/nodeProperties.d.ts +2 -2
  10. package/dist/nodes/GitHubCopilotChatAPI/nodeProperties.js +172 -202
  11. package/dist/nodes/GitHubCopilotChatAPI/utils/helpers.d.ts +19 -21
  12. package/dist/nodes/GitHubCopilotChatAPI/utils/helpers.js +130 -131
  13. package/dist/nodes/GitHubCopilotChatAPI/utils/imageProcessor.d.ts +8 -8
  14. package/dist/nodes/GitHubCopilotChatAPI/utils/imageProcessor.js +100 -101
  15. package/dist/nodes/GitHubCopilotChatAPI/utils/index.d.ts +3 -3
  16. package/dist/nodes/GitHubCopilotChatAPI/utils/index.js +19 -19
  17. package/dist/nodes/GitHubCopilotChatAPI/utils/mediaDetection.d.ts +14 -14
  18. package/dist/nodes/GitHubCopilotChatAPI/utils/mediaDetection.js +70 -71
  19. package/dist/nodes/GitHubCopilotChatAPI/utils/modelCapabilities.d.ts +5 -5
  20. package/dist/nodes/GitHubCopilotChatAPI/utils/modelCapabilities.js +113 -113
  21. package/dist/nodes/GitHubCopilotChatAPI/utils/types.d.ts +57 -57
  22. package/dist/nodes/GitHubCopilotChatAPI/utils/types.js +2 -2
  23. package/dist/nodes/GitHubCopilotChatModel/GitHubCopilotChatModel.node.d.ts +5 -0
  24. package/dist/nodes/GitHubCopilotChatModel/GitHubCopilotChatModel.node.js +140 -0
  25. package/dist/nodes/GitHubCopilotChatModel/copilot.svg +34 -0
  26. package/dist/shared/models/GitHubCopilotModels.d.ts +43 -0
  27. package/dist/shared/models/GitHubCopilotModels.js +218 -0
  28. package/package.json +7 -6
  29. package/dist/nodes/GitHubCopilotChatAPI/GitHubCopilotChatAPI.node.backup.d.ts +0 -5
  30. package/dist/nodes/GitHubCopilotChatAPI/GitHubCopilotChatAPI.node.backup.js +0 -651
  31. package/dist/nodes/GitHubCopilotChatAPI/utils/audioProcessor.d.ts +0 -11
  32. package/dist/nodes/GitHubCopilotChatAPI/utils/audioProcessor.js +0 -86
  33. package/dist/nodes/N8nAiAgent/N8nAiAgent.node.d.ts +0 -5
  34. package/dist/nodes/N8nAiAgent/N8nAiAgent.node.js +0 -214
  35. package/dist/nodes/N8nAiAgent/n8n-ai.svg +0 -35
  36. package/dist/nodes/N8nAiAgent/nodeProperties.d.ts +0 -2
  37. package/dist/nodes/N8nAiAgent/nodeProperties.js +0 -432
@@ -1,71 +1,70 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.suggestImageConversion = exports.getFileExtensionFromMimeType = exports.validateImageFormat = exports.isImageMimeType = exports.processMediaFile = void 0;
4
- const index_1 = require("./index");
5
- async function processMediaFile(context, itemIndex, source, mediaFile, mediaUrl, binaryProperty) {
6
- try {
7
- const imageResult = await (0, index_1.processImageFile)(context, itemIndex, source, mediaFile, mediaUrl, binaryProperty);
8
- const formatValidation = validateImageFormat(imageResult.mimeType);
9
- if (!formatValidation.isValid) {
10
- throw new Error(suggestImageConversion(imageResult.mimeType));
11
- }
12
- return {
13
- type: 'image',
14
- dataUrl: `data:${imageResult.mimeType};base64,${imageResult.data}`,
15
- description: `Image file: ${imageResult.filename} (${Math.round(imageResult.size / 1024)}KB, ${imageResult.mimeType})`,
16
- mimeType: imageResult.mimeType,
17
- };
18
- }
19
- catch (error) {
20
- return {
21
- type: 'unknown',
22
- description: `Error processing image file: ${error instanceof Error ? error.message : 'Unknown error'}`,
23
- mimeType: 'unknown',
24
- };
25
- }
26
- }
27
- exports.processMediaFile = processMediaFile;
28
- function isImageMimeType(mimeType) {
29
- const supportedFormats = [
30
- 'image/png',
31
- 'image/jpeg',
32
- 'image/jpg',
33
- 'image/gif',
34
- 'image/webp'
35
- ];
36
- return supportedFormats.includes(mimeType.toLowerCase());
37
- }
38
- exports.isImageMimeType = isImageMimeType;
39
- function validateImageFormat(mimeType) {
40
- if (!isImageMimeType(mimeType)) {
41
- const supportedFormats = ['PNG', 'JPEG', 'GIF', 'WebP'];
42
- return {
43
- isValid: false,
44
- error: `Unsupported image format: ${mimeType}. GitHub Copilot API only supports: ${supportedFormats.join(', ')}`
45
- };
46
- }
47
- return { isValid: true };
48
- }
49
- exports.validateImageFormat = validateImageFormat;
50
- function getFileExtensionFromMimeType(mimeType) {
51
- const mimeToExt = {
52
- 'image/png': 'png',
53
- 'image/jpeg': 'jpg',
54
- 'image/jpg': 'jpg',
55
- 'image/gif': 'gif',
56
- 'image/webp': 'webp',
57
- 'image/bmp': 'bmp',
58
- 'image/tiff': 'tiff',
59
- 'image/svg+xml': 'svg',
60
- };
61
- return mimeToExt[mimeType.toLowerCase()] || 'unknown';
62
- }
63
- exports.getFileExtensionFromMimeType = getFileExtensionFromMimeType;
64
- function suggestImageConversion(mimeType) {
65
- const ext = getFileExtensionFromMimeType(mimeType);
66
- const supportedFormats = ['PNG', 'JPEG', 'GIF', 'WebP'];
67
- return `Image format ${ext.toUpperCase()} is not supported by GitHub Copilot API. ` +
68
- `Please convert your image to one of these formats: ${supportedFormats.join(', ')}. ` +
69
- `Recommended: Convert to PNG or WebP for best compatibility.`;
70
- }
71
- exports.suggestImageConversion = suggestImageConversion;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processMediaFile = processMediaFile;
4
+ exports.isImageMimeType = isImageMimeType;
5
+ exports.validateImageFormat = validateImageFormat;
6
+ exports.getFileExtensionFromMimeType = getFileExtensionFromMimeType;
7
+ exports.suggestImageConversion = suggestImageConversion;
8
+ const index_1 = require("./index");
9
+ async function processMediaFile(context, itemIndex, source, mediaFile, mediaUrl, binaryProperty) {
10
+ try {
11
+ const imageResult = await (0, index_1.processImageFile)(context, itemIndex, source, mediaFile, mediaUrl, binaryProperty);
12
+ const formatValidation = validateImageFormat(imageResult.mimeType);
13
+ if (!formatValidation.isValid) {
14
+ throw new Error(suggestImageConversion(imageResult.mimeType));
15
+ }
16
+ return {
17
+ type: 'image',
18
+ dataUrl: `data:${imageResult.mimeType};base64,${imageResult.data}`,
19
+ description: `Image file: ${imageResult.filename} (${Math.round(imageResult.size / 1024)}KB, ${imageResult.mimeType})`,
20
+ mimeType: imageResult.mimeType,
21
+ };
22
+ }
23
+ catch (error) {
24
+ return {
25
+ type: 'unknown',
26
+ description: `Error processing image file: ${error instanceof Error ? error.message : 'Unknown error'}`,
27
+ mimeType: 'unknown',
28
+ };
29
+ }
30
+ }
31
+ function isImageMimeType(mimeType) {
32
+ const supportedFormats = [
33
+ 'image/png',
34
+ 'image/jpeg',
35
+ 'image/jpg',
36
+ 'image/gif',
37
+ 'image/webp'
38
+ ];
39
+ return supportedFormats.includes(mimeType.toLowerCase());
40
+ }
41
+ function validateImageFormat(mimeType) {
42
+ if (!isImageMimeType(mimeType)) {
43
+ const supportedFormats = ['PNG', 'JPEG', 'GIF', 'WebP'];
44
+ return {
45
+ isValid: false,
46
+ error: `Unsupported image format: ${mimeType}. GitHub Copilot API only supports: ${supportedFormats.join(', ')}`
47
+ };
48
+ }
49
+ return { isValid: true };
50
+ }
51
+ function getFileExtensionFromMimeType(mimeType) {
52
+ const mimeToExt = {
53
+ 'image/png': 'png',
54
+ 'image/jpeg': 'jpg',
55
+ 'image/jpg': 'jpg',
56
+ 'image/gif': 'gif',
57
+ 'image/webp': 'webp',
58
+ 'image/bmp': 'bmp',
59
+ 'image/tiff': 'tiff',
60
+ 'image/svg+xml': 'svg',
61
+ };
62
+ return mimeToExt[mimeType.toLowerCase()] || 'unknown';
63
+ }
64
+ function suggestImageConversion(mimeType) {
65
+ const ext = getFileExtensionFromMimeType(mimeType);
66
+ const supportedFormats = ['PNG', 'JPEG', 'GIF', 'WebP'];
67
+ return `Image format ${ext.toUpperCase()} is not supported by GitHub Copilot API. ` +
68
+ `Please convert your image to one of these formats: ${supportedFormats.join(', ')}. ` +
69
+ `Recommended: Convert to PNG or WebP for best compatibility.`;
70
+ }
@@ -1,5 +1,5 @@
1
- import { ModelCapabilities, ModelValidationResult } from './types';
2
- export declare const MODEL_CAPABILITIES: Record<string, ModelCapabilities>;
3
- export declare function validateModelCapabilities(model: string, includeImage: boolean, includeAudio: boolean): ModelValidationResult;
4
- export declare function getSupportedModels(requireImages?: boolean, requireAudio?: boolean): string[];
5
- export declare function getModelInfo(model: string): ModelCapabilities | null;
1
+ import { ModelCapabilities, ModelValidationResult } from './types';
2
+ export declare const MODEL_CAPABILITIES: Record<string, ModelCapabilities>;
3
+ export declare function validateModelCapabilities(model: string, includeImage: boolean, includeAudio: boolean): ModelValidationResult;
4
+ export declare function getSupportedModels(requireImages?: boolean, requireAudio?: boolean): string[];
5
+ export declare function getModelInfo(model: string): ModelCapabilities | null;
@@ -1,113 +1,113 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getModelInfo = exports.getSupportedModels = exports.validateModelCapabilities = exports.MODEL_CAPABILITIES = void 0;
4
- exports.MODEL_CAPABILITIES = {
5
- 'gpt-5': {
6
- supportsImages: true,
7
- supportsAudio: false,
8
- maxContextTokens: 200000,
9
- description: 'OpenAI GPT-5 with image support via GitHub Copilot API',
10
- },
11
- 'gpt-5-mini': {
12
- supportsImages: true,
13
- supportsAudio: false,
14
- maxContextTokens: 128000,
15
- description: 'OpenAI GPT-5 Mini with image support via GitHub Copilot API',
16
- },
17
- 'gpt-4.1-copilot': {
18
- supportsImages: true,
19
- supportsAudio: false,
20
- maxContextTokens: 128000,
21
- description: 'OpenAI GPT-4.1 with image support via GitHub Copilot API',
22
- },
23
- 'claude-opus-4.1': {
24
- supportsImages: false,
25
- supportsAudio: false,
26
- maxContextTokens: 200000,
27
- description: 'Anthropic Claude Opus 4.1 - Text only via GitHub Copilot API',
28
- },
29
- 'claude-3.5-sonnet': {
30
- supportsImages: false,
31
- supportsAudio: false,
32
- maxContextTokens: 200000,
33
- description: 'Anthropic Claude 3.5 Sonnet - Text only via GitHub Copilot API',
34
- },
35
- 'gemini-2.5-pro': {
36
- supportsImages: true,
37
- supportsAudio: false,
38
- maxContextTokens: 1000000,
39
- description: 'Google Gemini 2.5 Pro with image support via GitHub Copilot API',
40
- },
41
- 'gemini-2.0-flash': {
42
- supportsImages: true,
43
- supportsAudio: true,
44
- maxContextTokens: 1000000,
45
- description: 'Google Gemini 2.0 Flash with multimodal support via GitHub Copilot API',
46
- },
47
- 'grok-code-fast-1': {
48
- supportsImages: false,
49
- supportsAudio: false,
50
- maxContextTokens: 128000,
51
- description: 'xAI Grok Code Fast 1 - Text only via GitHub Copilot API',
52
- },
53
- 'o3': {
54
- supportsImages: false,
55
- supportsAudio: false,
56
- maxContextTokens: 200000,
57
- description: 'OpenAI o3 - Text only via GitHub Copilot API',
58
- },
59
- 'o3-mini': {
60
- supportsImages: false,
61
- supportsAudio: false,
62
- maxContextTokens: 128000,
63
- description: 'OpenAI o3-mini - Text only via GitHub Copilot API',
64
- },
65
- };
66
- function validateModelCapabilities(model, includeImage, includeAudio) {
67
- const capabilities = exports.MODEL_CAPABILITIES[model];
68
- if (!capabilities) {
69
- return {
70
- isValid: false,
71
- errorMessage: `Unknown model: ${model}. Please check if the model name is correct.`,
72
- };
73
- }
74
- const warnings = [];
75
- let isValid = true;
76
- let errorMessage;
77
- if (includeImage && !capabilities.supportsImages) {
78
- isValid = false;
79
- errorMessage = `Model ${model} does not support image input. Please disable image upload or choose a different model (e.g., GPT-5, Gemini 2.5 Pro).`;
80
- }
81
- if (includeAudio && !capabilities.supportsAudio) {
82
- isValid = false;
83
- errorMessage = `Model ${model} does not support audio input. Please disable audio upload or choose a different model (e.g., GPT-5, Gemini 2.5 Pro).`;
84
- }
85
- if (model.includes('claude') && (includeImage || includeAudio)) {
86
- warnings.push('Claude models typically work best with text-only input via GitHub Copilot API.');
87
- }
88
- if (model.includes('grok') && (includeImage || includeAudio)) {
89
- warnings.push('Grok models are optimized for coding tasks and work best with text input.');
90
- }
91
- return {
92
- isValid,
93
- errorMessage,
94
- warnings: warnings.length > 0 ? warnings : undefined,
95
- };
96
- }
97
- exports.validateModelCapabilities = validateModelCapabilities;
98
- function getSupportedModels(requireImages = false, requireAudio = false) {
99
- return Object.entries(exports.MODEL_CAPABILITIES)
100
- .filter(([, capabilities]) => {
101
- if (requireImages && !capabilities.supportsImages)
102
- return false;
103
- if (requireAudio && !capabilities.supportsAudio)
104
- return false;
105
- return true;
106
- })
107
- .map(([model]) => model);
108
- }
109
- exports.getSupportedModels = getSupportedModels;
110
- function getModelInfo(model) {
111
- return exports.MODEL_CAPABILITIES[model] || null;
112
- }
113
- exports.getModelInfo = getModelInfo;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MODEL_CAPABILITIES = void 0;
4
+ exports.validateModelCapabilities = validateModelCapabilities;
5
+ exports.getSupportedModels = getSupportedModels;
6
+ exports.getModelInfo = getModelInfo;
7
+ exports.MODEL_CAPABILITIES = {
8
+ 'gpt-5': {
9
+ supportsImages: true,
10
+ supportsAudio: false,
11
+ maxContextTokens: 200000,
12
+ description: 'OpenAI GPT-5 with image support via GitHub Copilot API',
13
+ },
14
+ 'gpt-5-mini': {
15
+ supportsImages: true,
16
+ supportsAudio: false,
17
+ maxContextTokens: 128000,
18
+ description: 'OpenAI GPT-5 Mini with image support via GitHub Copilot API',
19
+ },
20
+ 'gpt-4.1-copilot': {
21
+ supportsImages: true,
22
+ supportsAudio: false,
23
+ maxContextTokens: 128000,
24
+ description: 'OpenAI GPT-4.1 with image support via GitHub Copilot API',
25
+ },
26
+ 'claude-opus-4.1': {
27
+ supportsImages: false,
28
+ supportsAudio: false,
29
+ maxContextTokens: 200000,
30
+ description: 'Anthropic Claude Opus 4.1 - Text only via GitHub Copilot API',
31
+ },
32
+ 'claude-3.5-sonnet': {
33
+ supportsImages: false,
34
+ supportsAudio: false,
35
+ maxContextTokens: 200000,
36
+ description: 'Anthropic Claude 3.5 Sonnet - Text only via GitHub Copilot API',
37
+ },
38
+ 'gemini-2.5-pro': {
39
+ supportsImages: true,
40
+ supportsAudio: false,
41
+ maxContextTokens: 1000000,
42
+ description: 'Google Gemini 2.5 Pro with image support via GitHub Copilot API',
43
+ },
44
+ 'gemini-2.0-flash': {
45
+ supportsImages: true,
46
+ supportsAudio: true,
47
+ maxContextTokens: 1000000,
48
+ description: 'Google Gemini 2.0 Flash with multimodal support via GitHub Copilot API',
49
+ },
50
+ 'grok-code-fast-1': {
51
+ supportsImages: false,
52
+ supportsAudio: false,
53
+ maxContextTokens: 128000,
54
+ description: 'xAI Grok Code Fast 1 - Text only via GitHub Copilot API',
55
+ },
56
+ 'o3': {
57
+ supportsImages: false,
58
+ supportsAudio: false,
59
+ maxContextTokens: 200000,
60
+ description: 'OpenAI o3 - Text only via GitHub Copilot API',
61
+ },
62
+ 'o3-mini': {
63
+ supportsImages: false,
64
+ supportsAudio: false,
65
+ maxContextTokens: 128000,
66
+ description: 'OpenAI o3-mini - Text only via GitHub Copilot API',
67
+ },
68
+ };
69
+ function validateModelCapabilities(model, includeImage, includeAudio) {
70
+ const capabilities = exports.MODEL_CAPABILITIES[model];
71
+ if (!capabilities) {
72
+ return {
73
+ isValid: false,
74
+ errorMessage: `Unknown model: ${model}. Please check if the model name is correct.`,
75
+ };
76
+ }
77
+ const warnings = [];
78
+ let isValid = true;
79
+ let errorMessage;
80
+ if (includeImage && !capabilities.supportsImages) {
81
+ isValid = false;
82
+ errorMessage = `Model ${model} does not support image input. Please disable image upload or choose a different model (e.g., GPT-5, Gemini 2.5 Pro).`;
83
+ }
84
+ if (includeAudio && !capabilities.supportsAudio) {
85
+ isValid = false;
86
+ errorMessage = `Model ${model} does not support audio input. Please disable audio upload or choose a different model (e.g., GPT-5, Gemini 2.5 Pro).`;
87
+ }
88
+ if (model.includes('claude') && (includeImage || includeAudio)) {
89
+ warnings.push('Claude models typically work best with text-only input via GitHub Copilot API.');
90
+ }
91
+ if (model.includes('grok') && (includeImage || includeAudio)) {
92
+ warnings.push('Grok models are optimized for coding tasks and work best with text input.');
93
+ }
94
+ return {
95
+ isValid,
96
+ errorMessage,
97
+ warnings: warnings.length > 0 ? warnings : undefined,
98
+ };
99
+ }
100
+ function getSupportedModels(requireImages = false, requireAudio = false) {
101
+ return Object.entries(exports.MODEL_CAPABILITIES)
102
+ .filter(([, capabilities]) => {
103
+ if (requireImages && !capabilities.supportsImages)
104
+ return false;
105
+ if (requireAudio && !capabilities.supportsAudio)
106
+ return false;
107
+ return true;
108
+ })
109
+ .map(([model]) => model);
110
+ }
111
+ function getModelInfo(model) {
112
+ return exports.MODEL_CAPABILITIES[model] || null;
113
+ }
@@ -1,57 +1,57 @@
1
- import { IExecuteFunctions } from 'n8n-workflow';
2
- export interface ChatMessage {
3
- role: 'system' | 'user' | 'assistant';
4
- content: string | Array<ChatMessageContent>;
5
- }
6
- export interface ChatMessageContent {
7
- type: string;
8
- text?: string;
9
- image_url?: {
10
- url: string;
11
- };
12
- }
13
- export interface CopilotResponse {
14
- choices: Array<{
15
- message: {
16
- content: string;
17
- };
18
- finish_reason: string;
19
- }>;
20
- usage?: {
21
- prompt_tokens: number;
22
- completion_tokens: number;
23
- total_tokens: number;
24
- };
25
- }
26
- export interface FileProcessOptions {
27
- context: IExecuteFunctions;
28
- itemIndex: number;
29
- source: 'manual' | 'url' | 'binary';
30
- filePath?: string;
31
- url?: string;
32
- binaryProperty?: string;
33
- }
34
- export interface ProcessedFileResult {
35
- data: string;
36
- mimeType: string;
37
- filename: string;
38
- size: number;
39
- estimatedTokens: number;
40
- }
41
- export interface OptimizationOptions {
42
- maxWidth?: number;
43
- maxHeight?: number;
44
- quality?: number;
45
- maxSizeKB?: number;
46
- }
47
- export interface ModelCapabilities {
48
- supportsImages: boolean;
49
- supportsAudio: boolean;
50
- maxContextTokens: number;
51
- description: string;
52
- }
53
- export interface ModelValidationResult {
54
- isValid: boolean;
55
- errorMessage?: string;
56
- warnings?: string[];
57
- }
1
+ import { IExecuteFunctions } from 'n8n-workflow';
2
+ export interface ChatMessage {
3
+ role: 'system' | 'user' | 'assistant';
4
+ content: string | Array<ChatMessageContent>;
5
+ }
6
+ export interface ChatMessageContent {
7
+ type: string;
8
+ text?: string;
9
+ image_url?: {
10
+ url: string;
11
+ };
12
+ }
13
+ export interface CopilotResponse {
14
+ choices: Array<{
15
+ message: {
16
+ content: string;
17
+ };
18
+ finish_reason: string;
19
+ }>;
20
+ usage?: {
21
+ prompt_tokens: number;
22
+ completion_tokens: number;
23
+ total_tokens: number;
24
+ };
25
+ }
26
+ export interface FileProcessOptions {
27
+ context: IExecuteFunctions;
28
+ itemIndex: number;
29
+ source: 'manual' | 'url' | 'binary';
30
+ filePath?: string;
31
+ url?: string;
32
+ binaryProperty?: string;
33
+ }
34
+ export interface ProcessedFileResult {
35
+ data: string;
36
+ mimeType: string;
37
+ filename: string;
38
+ size: number;
39
+ estimatedTokens: number;
40
+ }
41
+ export interface OptimizationOptions {
42
+ maxWidth?: number;
43
+ maxHeight?: number;
44
+ quality?: number;
45
+ maxSizeKB?: number;
46
+ }
47
+ export interface ModelCapabilities {
48
+ supportsImages: boolean;
49
+ supportsAudio: boolean;
50
+ maxContextTokens: number;
51
+ description: string;
52
+ }
53
+ export interface ModelValidationResult {
54
+ isValid: boolean;
55
+ errorMessage?: string;
56
+ warnings?: string[];
57
+ }
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { INodeType, INodeTypeDescription, ISupplyDataFunctions, SupplyData } from 'n8n-workflow';
2
+ export declare class GitHubCopilotChatModel implements INodeType {
3
+ description: INodeTypeDescription;
4
+ supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData>;
5
+ }
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GitHubCopilotChatModel = void 0;
4
+ const openai_1 = require("@langchain/openai");
5
+ const GitHubCopilotModels_1 = require("../../shared/models/GitHubCopilotModels");
6
+ class GitHubCopilotChatModel {
7
+ constructor() {
8
+ this.description = {
9
+ displayName: 'GitHub Copilot Chat Model',
10
+ name: 'gitHubCopilotChatModel',
11
+ icon: 'file:copilot.svg',
12
+ group: ['transform'],
13
+ version: 1,
14
+ description: 'GitHub Copilot chat model for AI workflows - access GPT-5, Claude, Gemini and more using your Copilot subscription',
15
+ defaults: {
16
+ name: 'GitHub Copilot Chat Model',
17
+ },
18
+ codex: {
19
+ categories: ['AI'],
20
+ subcategories: {
21
+ AI: ['Language Models', 'Root Nodes'],
22
+ 'Language Models': ['Chat Models (Recommended)'],
23
+ },
24
+ resources: {
25
+ primaryDocumentation: [
26
+ {
27
+ url: 'https://docs.github.com/copilot/using-github-copilot/using-github-copilot-chat',
28
+ },
29
+ ],
30
+ },
31
+ },
32
+ inputs: [],
33
+ outputs: ["ai_languageModel"],
34
+ outputNames: ['Model'],
35
+ credentials: [
36
+ {
37
+ name: 'gitHubApiManual',
38
+ required: true,
39
+ },
40
+ ],
41
+ properties: [
42
+ {
43
+ displayName: 'Model',
44
+ name: 'model',
45
+ type: 'options',
46
+ default: GitHubCopilotModels_1.DEFAULT_MODELS.GENERAL,
47
+ description: 'The GitHub Copilot model to use',
48
+ options: GitHubCopilotModels_1.GitHubCopilotModelsManager.toN8nOptions(),
49
+ },
50
+ {
51
+ displayName: 'Options',
52
+ name: 'options',
53
+ placeholder: 'Add Option',
54
+ description: 'Additional options for the GitHub Copilot model',
55
+ type: 'collection',
56
+ default: {},
57
+ options: [
58
+ {
59
+ displayName: 'Temperature',
60
+ name: 'temperature',
61
+ default: 0.7,
62
+ typeOptions: { maxValue: 2, minValue: 0, numberPrecision: 1 },
63
+ description: 'Controls randomness in output. Lower values make responses more focused.',
64
+ type: 'number',
65
+ },
66
+ {
67
+ displayName: 'Maximum Number of Tokens',
68
+ name: 'maxTokens',
69
+ default: 1000,
70
+ description: 'The maximum number of tokens to generate',
71
+ type: 'number',
72
+ typeOptions: {
73
+ maxValue: 32768,
74
+ },
75
+ },
76
+ {
77
+ displayName: 'Top P',
78
+ name: 'topP',
79
+ default: 1,
80
+ typeOptions: { maxValue: 1, minValue: 0, numberPrecision: 2 },
81
+ description: 'Controls diversity of output by nucleus sampling',
82
+ type: 'number',
83
+ },
84
+ {
85
+ displayName: 'Enable Vision',
86
+ name: 'enableVision',
87
+ type: 'boolean',
88
+ default: true,
89
+ description: 'Whether to enable image processing capabilities',
90
+ },
91
+ {
92
+ displayName: 'System Message',
93
+ name: 'systemMessage',
94
+ type: 'string',
95
+ default: '',
96
+ description: 'System message to set the behavior of the assistant',
97
+ typeOptions: {
98
+ rows: 3,
99
+ },
100
+ },
101
+ ],
102
+ },
103
+ ],
104
+ };
105
+ }
106
+ async supplyData(itemIndex) {
107
+ const model = this.getNodeParameter('model', itemIndex);
108
+ const options = this.getNodeParameter('options', itemIndex, {});
109
+ const modelInfo = GitHubCopilotModels_1.GitHubCopilotModelsManager.getModelByValue(model);
110
+ const credentials = await this.getCredentials('gitHubApiManual');
111
+ const modelConfig = {
112
+ openAIApiKey: credentials.accessToken,
113
+ model: model,
114
+ temperature: options.temperature || 0.7,
115
+ maxTokens: Math.min(options.maxTokens || 1000, (modelInfo === null || modelInfo === void 0 ? void 0 : modelInfo.capabilities.maxOutputTokens) || 4096),
116
+ topP: options.topP || 1,
117
+ configuration: {
118
+ baseURL: 'https://api.githubcopilot.com/v1',
119
+ defaultHeaders: {
120
+ 'User-Agent': 'n8n-github-copilot-chat-model',
121
+ 'Content-Type': 'application/json',
122
+ ...(options.enableVision && (modelInfo === null || modelInfo === void 0 ? void 0 : modelInfo.capabilities.vision) && {
123
+ 'Copilot-Vision-Request': 'true',
124
+ 'Copilot-Media-Request': 'true'
125
+ }),
126
+ },
127
+ },
128
+ ...((modelInfo === null || modelInfo === void 0 ? void 0 : modelInfo.capabilities.toolsCalling) && {
129
+ modelKwargs: {
130
+ tool_choice: 'auto'
131
+ }
132
+ })
133
+ };
134
+ const chatModel = new openai_1.ChatOpenAI(modelConfig);
135
+ return {
136
+ response: chatModel,
137
+ };
138
+ }
139
+ }
140
+ exports.GitHubCopilotChatModel = GitHubCopilotChatModel;