mirror of
https://github.com/n8n-io/n8n.git
synced 2026-09-21 12:51:16 +08:00
feat(core): Add new Chat hub feature for chatting with LLMs and your n8n agent workflows (#23035)
This commit is contained in:
@@ -15,10 +15,7 @@ beforeEach(() => {
|
||||
|
||||
describe('eligibleModules', () => {
|
||||
it('should consider all default modules eligible', () => {
|
||||
// 'chat-hub' isn't (yet) an eligible module by default
|
||||
const NON_DEFAULT_MODULES = ['chat-hub'];
|
||||
const expectedModules = MODULE_NAMES.filter((name) => !NON_DEFAULT_MODULES.includes(name));
|
||||
expect(Container.get(ModuleRegistry).eligibleModules).toEqual(expectedModules);
|
||||
expect(Container.get(ModuleRegistry).eligibleModules).toEqual(MODULE_NAMES);
|
||||
});
|
||||
|
||||
it('should consider a module ineligible if it was disabled via env var', () => {
|
||||
@@ -31,6 +28,7 @@ describe('eligibleModules', () => {
|
||||
'provisioning',
|
||||
'breaking-changes',
|
||||
'dynamic-credentials',
|
||||
'chat-hub',
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -45,6 +43,7 @@ describe('eligibleModules', () => {
|
||||
'provisioning',
|
||||
'breaking-changes',
|
||||
'dynamic-credentials',
|
||||
'chat-hub',
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ export class ModuleRegistry {
|
||||
'provisioning',
|
||||
'breaking-changes',
|
||||
'dynamic-credentials',
|
||||
'chat-hub',
|
||||
];
|
||||
|
||||
private readonly activeModules: string[] = [];
|
||||
|
||||
@@ -8,10 +8,10 @@ export const MODULE_NAMES = [
|
||||
'community-packages',
|
||||
'data-table',
|
||||
'mcp',
|
||||
'chat-hub',
|
||||
'provisioning',
|
||||
'breaking-changes',
|
||||
'dynamic-credentials',
|
||||
'chat-hub',
|
||||
] as const;
|
||||
|
||||
export type ModuleName = (typeof MODULE_NAMES)[number];
|
||||
|
||||
@@ -1,21 +1,10 @@
|
||||
import { Logger } from '@n8n/backend-common';
|
||||
import type { ModuleInterface } from '@n8n/decorators';
|
||||
import { BackendModule, OnShutdown } from '@n8n/decorators';
|
||||
import { Container } from '@n8n/di';
|
||||
|
||||
const YELLOW = '\x1b[33m';
|
||||
const CLEAR = '\x1b[0m';
|
||||
const WARNING_MESSAGE =
|
||||
"[Chat] 'chat-hub' module is experimental, undocumented and subject to change. " +
|
||||
'Before its official release any features may become inaccessible at any point, ' +
|
||||
'and using the module could compromise the stability of your system. Use at your own risk!';
|
||||
|
||||
@BackendModule({ name: 'chat-hub' })
|
||||
export class ChatHubModule implements ModuleInterface {
|
||||
async init() {
|
||||
const logger = Container.get(Logger).scoped('chat-hub');
|
||||
logger.warn(`${YELLOW}${WARNING_MESSAGE}${CLEAR}`);
|
||||
|
||||
await import('./chat-hub.controller');
|
||||
await import('./chat-hub.settings.controller');
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ const SettingsChatHubView = async () =>
|
||||
export const ChatModule: FrontendModuleDescription = {
|
||||
id: 'chat-hub',
|
||||
name: 'Chat',
|
||||
description: 'Interact with various LLM models or your n8n AI agents.',
|
||||
description: 'Chat with LLM models or your n8n AI agents.',
|
||||
icon: 'chat',
|
||||
modals: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user