n8n 1.118.1 → 1.119.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.
- package/dist/build.tsbuildinfo +1 -1
- package/dist/controllers/oauth/oauth2-credential.controller.d.ts +2 -0
- package/dist/controllers/oauth/oauth2-credential.controller.js +85 -1
- package/dist/controllers/oauth/oauth2-credential.controller.js.map +1 -1
- package/dist/controllers/users.controller.d.ts +1 -1
- package/dist/credentials-helper.js +8 -0
- package/dist/credentials-helper.js.map +1 -1
- package/dist/environments.ee/source-control/source-control-status.service.ee.d.ts +2 -2
- package/dist/environments.ee/source-control/source-control.controller.ee.d.ts +4 -4
- package/dist/environments.ee/source-control/source-control.service.ee.d.ts +2 -2
- package/dist/errors/response-errors/abstract/response.error.d.ts +1 -0
- package/dist/errors/response-errors/abstract/response.error.js.map +1 -1
- package/dist/errors/response-errors/license-eula-required.error.d.ts +9 -0
- package/dist/errors/response-errors/license-eula-required.error.js +13 -0
- package/dist/errors/response-errors/license-eula-required.error.js.map +1 -0
- package/dist/events/relays/telemetry.event-relay.js +3 -0
- package/dist/events/relays/telemetry.event-relay.js.map +1 -1
- package/dist/license/license.controller.js +2 -2
- package/dist/license/license.controller.js.map +1 -1
- package/dist/license/license.service.d.ts +3 -1
- package/dist/license/license.service.js +30 -5
- package/dist/license/license.service.js.map +1 -1
- package/dist/license.d.ts +1 -1
- package/dist/license.js +2 -2
- package/dist/license.js.map +1 -1
- package/dist/modules/breaking-changes/breaking-changes.controller.d.ts +12 -0
- package/dist/modules/breaking-changes/breaking-changes.controller.js +50 -0
- package/dist/modules/breaking-changes/breaking-changes.controller.js.map +1 -0
- package/dist/modules/breaking-changes/breaking-changes.module.d.ts +4 -0
- package/dist/modules/breaking-changes/breaking-changes.module.js +53 -0
- package/dist/modules/breaking-changes/breaking-changes.module.js.map +1 -0
- package/dist/modules/breaking-changes/breaking-changes.rule-registry.service.d.ts +11 -0
- package/dist/modules/breaking-changes/breaking-changes.rule-registry.service.js +47 -0
- package/dist/modules/breaking-changes/breaking-changes.rule-registry.service.js.map +1 -0
- package/dist/modules/breaking-changes/breaking-changes.service.d.ts +24 -0
- package/dist/modules/breaking-changes/breaking-changes.service.js +189 -0
- package/dist/modules/breaking-changes/breaking-changes.service.js.map +1 -0
- package/dist/modules/breaking-changes/rules/index.d.ts +4 -0
- package/dist/modules/breaking-changes/rules/index.js +7 -0
- package/dist/modules/breaking-changes/rules/index.js.map +1 -0
- package/dist/modules/breaking-changes/rules/v2/file-access.rule.d.ts +10 -0
- package/dist/modules/breaking-changes/rules/v2/file-access.rule.js +52 -0
- package/dist/modules/breaking-changes/rules/v2/file-access.rule.js.map +1 -0
- package/dist/modules/breaking-changes/rules/v2/index.d.ts +3 -0
- package/dist/modules/breaking-changes/rules/v2/index.js +9 -0
- package/dist/modules/breaking-changes/rules/v2/index.js.map +1 -0
- package/dist/modules/breaking-changes/rules/v2/process-env-access.rule.d.ts +9 -0
- package/dist/modules/breaking-changes/rules/v2/process-env-access.rule.js +71 -0
- package/dist/modules/breaking-changes/rules/v2/process-env-access.rule.js.map +1 -0
- package/dist/modules/breaking-changes/rules/v2/removed-nodes.rule.d.ts +10 -0
- package/dist/modules/breaking-changes/rules/v2/removed-nodes.rule.js +56 -0
- package/dist/modules/breaking-changes/rules/v2/removed-nodes.rule.js.map +1 -0
- package/dist/modules/breaking-changes/types/detection.types.d.ts +11 -0
- package/dist/modules/breaking-changes/types/detection.types.js +3 -0
- package/dist/modules/breaking-changes/types/detection.types.js.map +1 -0
- package/dist/modules/breaking-changes/types/index.d.ts +2 -0
- package/dist/modules/breaking-changes/types/index.js +18 -0
- package/dist/modules/breaking-changes/types/index.js.map +1 -0
- package/dist/modules/breaking-changes/types/rule.types.d.ts +71 -0
- package/dist/modules/breaking-changes/types/rule.types.js +25 -0
- package/dist/modules/breaking-changes/types/rule.types.js.map +1 -0
- package/dist/modules/chat-hub/chat-hub-agent.entity.d.ts +14 -0
- package/dist/modules/chat-hub/chat-hub-agent.entity.js +63 -0
- package/dist/modules/chat-hub/chat-hub-agent.entity.js.map +1 -0
- package/dist/modules/chat-hub/chat-hub-agent.repository.d.ts +10 -0
- package/dist/modules/chat-hub/chat-hub-agent.repository.js +61 -0
- package/dist/modules/chat-hub/chat-hub-agent.repository.js.map +1 -0
- package/dist/modules/chat-hub/chat-hub-agent.service.d.ts +32 -0
- package/dist/modules/chat-hub/chat-hub-agent.service.js +107 -0
- package/dist/modules/chat-hub/chat-hub-agent.service.js.map +1 -0
- package/dist/modules/chat-hub/chat-hub-credentials.service.d.ts +15 -0
- package/dist/modules/chat-hub/chat-hub-credentials.service.js +54 -0
- package/dist/modules/chat-hub/chat-hub-credentials.service.js.map +1 -0
- package/dist/modules/chat-hub/chat-hub-message.entity.d.ts +1 -0
- package/dist/modules/chat-hub/chat-hub-message.entity.js +4 -0
- package/dist/modules/chat-hub/chat-hub-message.entity.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub-session.entity.d.ts +7 -4
- package/dist/modules/chat-hub/chat-hub-session.entity.js +9 -1
- package/dist/modules/chat-hub/chat-hub-session.entity.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub-workflow.service.d.ts +29 -0
- package/dist/modules/chat-hub/chat-hub-workflow.service.js +382 -0
- package/dist/modules/chat-hub/chat-hub-workflow.service.js.map +1 -0
- package/dist/modules/chat-hub/chat-hub.constants.d.ts +18 -0
- package/dist/modules/chat-hub/chat-hub.constants.js +30 -1
- package/dist/modules/chat-hub/chat-hub.constants.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.controller.d.ts +10 -3
- package/dist/modules/chat-hub/chat-hub.controller.js +68 -7
- package/dist/modules/chat-hub/chat-hub.controller.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.module.d.ts +1 -1
- package/dist/modules/chat-hub/chat-hub.module.js +2 -1
- package/dist/modules/chat-hub/chat-hub.module.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.service.d.ts +31 -11
- package/dist/modules/chat-hub/chat-hub.service.js +519 -498
- package/dist/modules/chat-hub/chat-hub.service.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.types.d.ts +2 -1
- package/dist/modules/chat-hub/chat-message.repository.js +3 -3
- package/dist/modules/chat-hub/chat-message.repository.js.map +1 -1
- package/dist/modules/chat-hub/chat-session.repository.d.ts +1 -0
- package/dist/modules/chat-hub/chat-session.repository.js +9 -0
- package/dist/modules/chat-hub/chat-session.repository.js.map +1 -1
- package/dist/modules/chat-hub/dto/chat-models-request.dto.d.ts +1 -1
- package/dist/modules/chat-hub/stream-capturer.d.ts +17 -2
- package/dist/modules/chat-hub/stream-capturer.js +90 -19
- package/dist/modules/chat-hub/stream-capturer.js.map +1 -1
- package/dist/modules/data-table/data-table-aggregate.service.js +4 -0
- package/dist/modules/data-table/data-table-aggregate.service.js.map +1 -1
- package/dist/modules/data-table/data-table.controller.d.ts +7 -1
- package/dist/modules/data-table/data-table.controller.js +35 -17
- package/dist/modules/data-table/data-table.controller.js.map +1 -1
- package/dist/modules/insights/database/repositories/insights-by-period-query.helper.js +1 -1
- package/dist/modules/insights/database/repositories/insights-by-period-query.helper.js.map +1 -1
- package/dist/modules/insights/database/repositories/insights-by-period.repository.js +1 -1
- package/dist/modules/insights/database/repositories/insights-by-period.repository.js.map +1 -1
- package/dist/modules/insights/insights-collection.service.js +1 -0
- package/dist/modules/insights/insights-collection.service.js.map +1 -1
- package/dist/modules/insights/insights.controller.js +2 -15
- package/dist/modules/insights/insights.controller.js.map +1 -1
- package/dist/modules/insights/insights.service.d.ts +1 -1
- package/dist/modules/insights/insights.service.js.map +1 -1
- package/dist/modules/workflow-index/workflow-index.service.d.ts +22 -0
- package/dist/modules/workflow-index/workflow-index.service.js +166 -0
- package/dist/modules/workflow-index/workflow-index.service.js.map +1 -0
- package/dist/public-api/v1/handlers/workflows/workflows.handler.js +1 -1
- package/dist/public-api/v1/handlers/workflows/workflows.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/workflows/workflows.service.d.ts +1 -1
- package/dist/public-api/v1/handlers/workflows/workflows.service.js +8 -2
- package/dist/public-api/v1/handlers/workflows/workflows.service.js.map +1 -1
- package/dist/public-api/v1/openapi.yml +47 -0
- package/dist/requests.d.ts +1 -0
- package/dist/response-helper.js +3 -0
- package/dist/response-helper.js.map +1 -1
- package/dist/server.d.ts +1 -0
- package/dist/server.js +11 -0
- package/dist/server.js.map +1 -1
- package/dist/services/frontend.service.d.ts +1 -1
- package/dist/services/frontend.service.js +7 -2
- package/dist/services/frontend.service.js.map +1 -1
- package/dist/services/import.service.d.ts +5 -1
- package/dist/services/import.service.js +15 -2
- package/dist/services/import.service.js.map +1 -1
- package/dist/services/workflow-statistics.service.js +1 -0
- package/dist/services/workflow-statistics.service.js.map +1 -1
- package/dist/sso.ee/oidc/oidc.service.ee.d.ts +2 -1
- package/dist/sso.ee/oidc/oidc.service.ee.js +28 -6
- package/dist/sso.ee/oidc/oidc.service.ee.js.map +1 -1
- package/dist/sso.ee/saml/routes/saml.controller.ee.d.ts +1 -0
- package/dist/sso.ee/saml/routes/saml.controller.ee.js +19 -4
- package/dist/sso.ee/saml/routes/saml.controller.ee.js.map +1 -1
- package/dist/sso.ee/saml/saml.service.ee.d.ts +1 -1
- package/dist/sso.ee/saml/saml.service.ee.js +9 -6
- package/dist/sso.ee/saml/saml.service.ee.js.map +1 -1
- package/dist/workflow-runner.js +2 -1
- package/dist/workflow-runner.js.map +1 -1
- package/dist/workflows/workflow-execution.service.d.ts +4 -1
- package/dist/workflows/workflow-execution.service.js +14 -0
- package/dist/workflows/workflow-execution.service.js.map +1 -1
- package/dist/workflows/workflow.service.d.ts +4 -11
- package/dist/workflows/workflow.service.js +10 -8
- package/dist/workflows/workflow.service.js.map +1 -1
- package/package.json +22 -19
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ChatHubAgentService = void 0;
|
|
13
|
+
const backend_common_1 = require("@n8n/backend-common");
|
|
14
|
+
const di_1 = require("@n8n/di");
|
|
15
|
+
const uuid_1 = require("uuid");
|
|
16
|
+
const not_found_error_1 = require("../../errors/response-errors/not-found.error");
|
|
17
|
+
const chat_hub_agent_repository_1 = require("./chat-hub-agent.repository");
|
|
18
|
+
const chat_hub_credentials_service_1 = require("./chat-hub-credentials.service");
|
|
19
|
+
let ChatHubAgentService = class ChatHubAgentService {
|
|
20
|
+
constructor(logger, chatAgentRepository, chatHubCredentialsService) {
|
|
21
|
+
this.logger = logger;
|
|
22
|
+
this.chatAgentRepository = chatAgentRepository;
|
|
23
|
+
this.chatHubCredentialsService = chatHubCredentialsService;
|
|
24
|
+
}
|
|
25
|
+
async getAgentsByUserIdAsModels(userId) {
|
|
26
|
+
const agents = await this.getAgentsByUserId(userId);
|
|
27
|
+
return {
|
|
28
|
+
models: agents.map((agent) => ({
|
|
29
|
+
name: agent.name,
|
|
30
|
+
description: agent.description ?? null,
|
|
31
|
+
model: {
|
|
32
|
+
provider: 'custom-agent',
|
|
33
|
+
agentId: agent.id,
|
|
34
|
+
},
|
|
35
|
+
createdAt: agent.createdAt.toISOString(),
|
|
36
|
+
updatedAt: agent.updatedAt.toISOString(),
|
|
37
|
+
})),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
async getAgentsByUserId(userId) {
|
|
41
|
+
return await this.chatAgentRepository.getManyByUserId(userId);
|
|
42
|
+
}
|
|
43
|
+
async getAgentById(id, userId) {
|
|
44
|
+
const agent = await this.chatAgentRepository.getOneById(id, userId);
|
|
45
|
+
if (!agent) {
|
|
46
|
+
throw new not_found_error_1.NotFoundError('Chat agent not found');
|
|
47
|
+
}
|
|
48
|
+
return agent;
|
|
49
|
+
}
|
|
50
|
+
async createAgent(user, data) {
|
|
51
|
+
await this.chatHubCredentialsService.ensureCredentialById(user, data.credentialId);
|
|
52
|
+
const id = (0, uuid_1.v4)();
|
|
53
|
+
const agent = await this.chatAgentRepository.createAgent({
|
|
54
|
+
id,
|
|
55
|
+
name: data.name,
|
|
56
|
+
description: data.description ?? null,
|
|
57
|
+
systemPrompt: data.systemPrompt,
|
|
58
|
+
ownerId: user.id,
|
|
59
|
+
credentialId: data.credentialId,
|
|
60
|
+
provider: data.provider,
|
|
61
|
+
model: data.model,
|
|
62
|
+
});
|
|
63
|
+
this.logger.info(`Chat agent created: ${id} by user ${user.id}`);
|
|
64
|
+
return agent;
|
|
65
|
+
}
|
|
66
|
+
async updateAgent(id, user, updates) {
|
|
67
|
+
const existingAgent = await this.chatAgentRepository.getOneById(id, user.id);
|
|
68
|
+
if (!existingAgent) {
|
|
69
|
+
throw new not_found_error_1.NotFoundError('Chat agent not found');
|
|
70
|
+
}
|
|
71
|
+
if (updates.credentialId !== undefined && updates.credentialId !== null) {
|
|
72
|
+
await this.chatHubCredentialsService.ensureCredentialById(user, updates.credentialId);
|
|
73
|
+
}
|
|
74
|
+
const updateData = {};
|
|
75
|
+
if (updates.name !== undefined)
|
|
76
|
+
updateData.name = updates.name;
|
|
77
|
+
if (updates.description !== undefined)
|
|
78
|
+
updateData.description = updates.description ?? null;
|
|
79
|
+
if (updates.systemPrompt !== undefined)
|
|
80
|
+
updateData.systemPrompt = updates.systemPrompt;
|
|
81
|
+
if (updates.credentialId !== undefined)
|
|
82
|
+
updateData.credentialId = updates.credentialId ?? null;
|
|
83
|
+
if (updates.provider !== undefined)
|
|
84
|
+
updateData.provider = updates.provider;
|
|
85
|
+
if (updates.model !== undefined)
|
|
86
|
+
updateData.model = updates.model ?? null;
|
|
87
|
+
const agent = await this.chatAgentRepository.updateAgent(id, updateData);
|
|
88
|
+
this.logger.info(`Chat agent updated: ${id} by user ${user.id}`);
|
|
89
|
+
return agent;
|
|
90
|
+
}
|
|
91
|
+
async deleteAgent(id, userId) {
|
|
92
|
+
const existingAgent = await this.chatAgentRepository.getOneById(id, userId);
|
|
93
|
+
if (!existingAgent) {
|
|
94
|
+
throw new not_found_error_1.NotFoundError('Chat agent not found');
|
|
95
|
+
}
|
|
96
|
+
await this.chatAgentRepository.deleteAgent(id);
|
|
97
|
+
this.logger.info(`Chat agent deleted: ${id} by user ${userId}`);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
exports.ChatHubAgentService = ChatHubAgentService;
|
|
101
|
+
exports.ChatHubAgentService = ChatHubAgentService = __decorate([
|
|
102
|
+
(0, di_1.Service)(),
|
|
103
|
+
__metadata("design:paramtypes", [backend_common_1.Logger,
|
|
104
|
+
chat_hub_agent_repository_1.ChatHubAgentRepository,
|
|
105
|
+
chat_hub_credentials_service_1.ChatHubCredentialsService])
|
|
106
|
+
], ChatHubAgentService);
|
|
107
|
+
//# sourceMappingURL=chat-hub-agent.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-hub-agent.service.js","sourceRoot":"","sources":["../../../src/modules/chat-hub/chat-hub-agent.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,wDAA6C;AAE7C,gCAAkC;AAClC,+BAAoC;AAEpC,8EAAyE;AAGzE,2EAAqE;AACrE,iFAA2E;AAGpE,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC/B,YACkB,MAAc,EACd,mBAA2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 @@
|
|
|
1
|
+
import { ChatHubLLMProvider } from '@n8n/api-types';
|
|
2
|
+
import type { User, CredentialsEntity } from '@n8n/db';
|
|
3
|
+
import type { EntityManager } from '@n8n/typeorm';
|
|
4
|
+
import type { INodeCredentials } from 'n8n-workflow';
|
|
5
|
+
import { CredentialsFinderService } from '../../credentials/credentials-finder.service';
|
|
6
|
+
export type CredentialWithProjectId = CredentialsEntity & {
|
|
7
|
+
projectId: string;
|
|
8
|
+
};
|
|
9
|
+
export declare class ChatHubCredentialsService {
|
|
10
|
+
private readonly credentialsFinderService;
|
|
11
|
+
constructor(credentialsFinderService: CredentialsFinderService);
|
|
12
|
+
ensureCredentials(user: User, provider: ChatHubLLMProvider, credentials: INodeCredentials, trx?: EntityManager): Promise<CredentialWithProjectId>;
|
|
13
|
+
ensureCredentialById(user: User, credentialId: string, trx?: EntityManager): Promise<CredentialWithProjectId>;
|
|
14
|
+
private pickCredentialId;
|
|
15
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ChatHubCredentialsService = void 0;
|
|
13
|
+
const api_types_1 = require("@n8n/api-types");
|
|
14
|
+
const di_1 = require("@n8n/di");
|
|
15
|
+
const credentials_finder_service_1 = require("../../credentials/credentials-finder.service");
|
|
16
|
+
const bad_request_error_1 = require("../../errors/response-errors/bad-request.error");
|
|
17
|
+
const forbidden_error_1 = require("../../errors/response-errors/forbidden.error");
|
|
18
|
+
let ChatHubCredentialsService = class ChatHubCredentialsService {
|
|
19
|
+
constructor(credentialsFinderService) {
|
|
20
|
+
this.credentialsFinderService = credentialsFinderService;
|
|
21
|
+
}
|
|
22
|
+
async ensureCredentials(user, provider, credentials, trx) {
|
|
23
|
+
const allCredentials = await this.credentialsFinderService.findAllCredentialsForUser(user, ['credential:read'], trx);
|
|
24
|
+
const credentialId = this.pickCredentialId(provider, credentials);
|
|
25
|
+
if (!credentialId) {
|
|
26
|
+
throw new bad_request_error_1.BadRequestError('No credentials provided for the selected model provider');
|
|
27
|
+
}
|
|
28
|
+
const credential = allCredentials.find((c) => c.id === credentialId);
|
|
29
|
+
if (!credential) {
|
|
30
|
+
throw new forbidden_error_1.ForbiddenError("You don't have access to the provided credentials");
|
|
31
|
+
}
|
|
32
|
+
return credential;
|
|
33
|
+
}
|
|
34
|
+
async ensureCredentialById(user, credentialId, trx) {
|
|
35
|
+
const allCredentials = await this.credentialsFinderService.findAllCredentialsForUser(user, ['credential:read'], trx);
|
|
36
|
+
const credential = allCredentials.find((c) => c.id === credentialId);
|
|
37
|
+
if (!credential) {
|
|
38
|
+
throw new forbidden_error_1.ForbiddenError("You don't have access to the provided credentials");
|
|
39
|
+
}
|
|
40
|
+
return credential;
|
|
41
|
+
}
|
|
42
|
+
pickCredentialId(provider, credentials) {
|
|
43
|
+
if (provider === 'n8n' || provider === 'custom-agent') {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return credentials[api_types_1.PROVIDER_CREDENTIAL_TYPE_MAP[provider]]?.id ?? null;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.ChatHubCredentialsService = ChatHubCredentialsService;
|
|
50
|
+
exports.ChatHubCredentialsService = ChatHubCredentialsService = __decorate([
|
|
51
|
+
(0, di_1.Service)(),
|
|
52
|
+
__metadata("design:paramtypes", [credentials_finder_service_1.CredentialsFinderService])
|
|
53
|
+
], ChatHubCredentialsService);
|
|
54
|
+
//# sourceMappingURL=chat-hub-credentials.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-hub-credentials.service.js","sourceRoot":"","sources":["../../../src/modules/chat-hub/chat-hub-credentials.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAIwB;AAExB,gCAAkC;AAIlC,yFAAoF;AACpF,kFAA6E;AAC7E,8EAA0E;AAKnE,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACrC,YAA6B,wBAAkD;QAAlD,6BAAwB,GAAxB,wBAAwB,CAA0B;IAAG,CAAC;IAEnF,KAAK,CAAC,iBAAiB,CACtB,IAAU,EACV,QAA4B,EAC5B,WAA6B,EAC7B,GAAmB;QAEnB,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,yBAAyB,CACnF,IAAI,EACJ,CAAC,iBAAiB,CAAC,EACnB,GAAG,CACH,CAAC;QAEF,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAClE,IAAI,CAAC,YAAY,EAAE,CAAC;YACnB,MAAM,IAAI,mCAAe,CAAC,yDAAyD,CAAC,CAAC;QACtF,CAAC;QAGD,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,YAAY,CAAC,CAAC;QACrE,IAAI,CAAC,UAAU,EAAE,CAAC;YACjB,MAAM,IAAI,gCAAc,CAAC,mDAAmD,CAAC,CAAC;QAC/E,CAAC;QACD,OAAO,UAAqC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,oBAAoB,CACzB,IAAU,EACV,YAAoB,EACpB,GAAmB;QAEnB,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,yBAAyB,CACnF,IAAI,EACJ,CAAC,iBAAiB,CAAC,EACnB,GAAG,CACH,CAAC;QAEF,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,YAAY,CAAC,CAAC;QACrE,IAAI,CAAC,UAAU,EAAE,CAAC;YACjB,MAAM,IAAI,gCAAc,CAAC,mDAAmD,CAAC,CAAC;QAC/E,CAAC;QACD,OAAO,UAAqC,CAAC;IAC9C,CAAC;IAEO,gBAAgB,CACvB,QAA8C,EAC9C,WAA6B;QAE7B,IAAI,QAAQ,KAAK,KAAK,IAAI,QAAQ,KAAK,cAAc,EAAE,CAAC;YACvD,OAAO,IAAI,CAAC;QACb,CAAC;QAED,OAAO,WAAW,CAAC,wCAA4B,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC;IACxE,CAAC;CACD,CAAA;AAxDY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,YAAO,GAAE;qCAE8C,qDAAwB;GADnE,yBAAyB,CAwDrC"}
|
|
@@ -13,6 +13,7 @@ export declare class ChatHubMessage extends WithTimestamps {
|
|
|
13
13
|
model: string | null;
|
|
14
14
|
workflowId: string | null;
|
|
15
15
|
workflow?: Relation<WorkflowEntity> | null;
|
|
16
|
+
agentId: string | null;
|
|
16
17
|
executionId: number | null;
|
|
17
18
|
execution?: Relation<ExecutionEntity> | null;
|
|
18
19
|
previousMessageId: string | null;
|
|
@@ -57,6 +57,10 @@ __decorate([
|
|
|
57
57
|
(0, typeorm_1.JoinColumn)({ name: 'workflowId' }),
|
|
58
58
|
__metadata("design:type", Object)
|
|
59
59
|
], ChatHubMessage.prototype, "workflow", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 36, nullable: true }),
|
|
62
|
+
__metadata("design:type", Object)
|
|
63
|
+
], ChatHubMessage.prototype, "agentId", void 0);
|
|
60
64
|
__decorate([
|
|
61
65
|
(0, typeorm_1.Column)({ type: 'int', nullable: true }),
|
|
62
66
|
__metadata("design:type", Object)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-hub-message.entity.js","sourceRoot":"","sources":["../../../src/modules/chat-hub/chat-hub-message.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,gCAA0E;AAC1E,0CAQsB;AAKf,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,mBAAc;
|
|
1
|
+
{"version":3,"file":"chat-hub-message.entity.js","sourceRoot":"","sources":["../../../src/modules/chat-hub/chat-hub-message.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,gCAA0E;AAC1E,0CAQsB;AAKf,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,mBAAc;CA0JjD,CAAA;AA1JY,wCAAc;AAE1B;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;0CACpB;AAMX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACP;AAOlB;IAFC,IAAA,mBAAS,EAAC,gBAAgB,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAChE,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;;+CACA;AAMlC;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;4CACf;AAMzB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;4CAC5B;AAMb;IADC,IAAA,gBAAM,EAAC,MAAM,CAAC;;+CACC;AAOhB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EA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GACzB,cAAc,CA0J1B"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { ChatHubProvider } from '@n8n/api-types';
|
|
2
2
|
import { WithTimestamps, User, CredentialsEntity, WorkflowEntity } from '@n8n/db';
|
|
3
|
+
import { type Relation } from '@n8n/typeorm';
|
|
3
4
|
import type { ChatHubMessage } from './chat-hub-message.entity';
|
|
4
5
|
export declare class ChatHubSession extends WithTimestamps {
|
|
5
6
|
id: string;
|
|
6
7
|
title: string;
|
|
7
8
|
ownerId: string;
|
|
8
|
-
owner?: User
|
|
9
|
+
owner?: Relation<User>;
|
|
9
10
|
lastMessageAt: Date | null;
|
|
10
11
|
credentialId: string | null;
|
|
11
|
-
credential?: CredentialsEntity | null;
|
|
12
|
+
credential?: Relation<CredentialsEntity> | null;
|
|
12
13
|
provider: ChatHubProvider | null;
|
|
13
14
|
model: string | null;
|
|
14
15
|
workflowId: string | null;
|
|
15
|
-
workflow?: WorkflowEntity | null;
|
|
16
|
-
|
|
16
|
+
workflow?: Relation<WorkflowEntity> | null;
|
|
17
|
+
agentId: string | null;
|
|
18
|
+
agentName: string | null;
|
|
19
|
+
messages?: Array<Relation<ChatHubMessage>>;
|
|
17
20
|
}
|
|
@@ -30,7 +30,7 @@ __decorate([
|
|
|
30
30
|
__decorate([
|
|
31
31
|
(0, typeorm_1.ManyToOne)('User', { onDelete: 'CASCADE' }),
|
|
32
32
|
(0, typeorm_1.JoinColumn)({ name: 'ownerId' }),
|
|
33
|
-
__metadata("design:type",
|
|
33
|
+
__metadata("design:type", Object)
|
|
34
34
|
], ChatHubSession.prototype, "owner", void 0);
|
|
35
35
|
__decorate([
|
|
36
36
|
(0, db_1.DateTimeColumn)({ nullable: true }),
|
|
@@ -62,6 +62,14 @@ __decorate([
|
|
|
62
62
|
(0, typeorm_1.JoinColumn)({ name: 'workflowId' }),
|
|
63
63
|
__metadata("design:type", Object)
|
|
64
64
|
], ChatHubSession.prototype, "workflow", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 36, nullable: true }),
|
|
67
|
+
__metadata("design:type", Object)
|
|
68
|
+
], ChatHubSession.prototype, "agentId", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 128, nullable: true }),
|
|
71
|
+
__metadata("design:type", Object)
|
|
72
|
+
], ChatHubSession.prototype, "agentName", void 0);
|
|
65
73
|
__decorate([
|
|
66
74
|
(0, typeorm_1.OneToMany)('ChatHubMessage', 'session'),
|
|
67
75
|
__metadata("design:type", Array)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-hub-session.entity.js","sourceRoot":"","sources":["../../../src/modules/chat-hub/chat-hub-session.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,gCAAkG;AAClG,
|
|
1
|
+
{"version":3,"file":"chat-hub-session.entity.js","sourceRoot":"","sources":["../../../src/modules/chat-hub/chat-hub-session.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,gCAAkG;AAClG,0CAQsB;AAKf,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,mBAAc;CAyFjD,CAAA;AAzFY,wCAAc;AAE1B;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;0CACpB;AAOX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;6CAC3B;AAMd;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CACT;AAOhB;IAFC,IAAA,mBAAS,EAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC1C,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;6CACT;AAOvB;IADC,IAAA,mBAAc,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACR;AAM3B;IADC,IAAA,gBAAM,EAAC,EAA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AAC;GACzB,cAAc,CAyF1B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ChatHubConversationModel, ChatSessionId } from '@n8n/api-types';
|
|
2
|
+
import { Logger } from '@n8n/backend-common';
|
|
3
|
+
import { SharedWorkflowRepository, WorkflowRepository } from '@n8n/db';
|
|
4
|
+
import { EntityManager } from '@n8n/typeorm';
|
|
5
|
+
import { INodeCredentials, IRunExecutionData, IWorkflowBase } from 'n8n-workflow';
|
|
6
|
+
import { ChatHubMessage } from './chat-hub-message.entity';
|
|
7
|
+
export declare class ChatHubWorkflowService {
|
|
8
|
+
private readonly logger;
|
|
9
|
+
private readonly workflowRepository;
|
|
10
|
+
private readonly sharedWorkflowRepository;
|
|
11
|
+
constructor(logger: Logger, workflowRepository: WorkflowRepository, sharedWorkflowRepository: SharedWorkflowRepository);
|
|
12
|
+
createChatWorkflow(userId: string, sessionId: ChatSessionId, projectId: string, history: ChatHubMessage[], humanMessage: string, credentials: INodeCredentials, model: ChatHubConversationModel, systemMessage?: string, trx?: EntityManager): Promise<{
|
|
13
|
+
workflowData: IWorkflowBase;
|
|
14
|
+
executionData: IRunExecutionData;
|
|
15
|
+
}>;
|
|
16
|
+
createTitleGenerationWorkflow(userId: string, sessionId: ChatSessionId, projectId: string, humanMessage: string, credentials: INodeCredentials, model: ChatHubConversationModel, trx?: EntityManager): Promise<{
|
|
17
|
+
workflowData: IWorkflowBase;
|
|
18
|
+
executionData: IRunExecutionData;
|
|
19
|
+
}>;
|
|
20
|
+
private buildChatWorkflow;
|
|
21
|
+
private buildTitleGenerationWorkflow;
|
|
22
|
+
private buildChatTriggerNode;
|
|
23
|
+
private buildToolsAgentNode;
|
|
24
|
+
private buildModelNode;
|
|
25
|
+
private buildMemoryNode;
|
|
26
|
+
private buildRestoreMemoryNode;
|
|
27
|
+
private buildClearMemoryNode;
|
|
28
|
+
private buildTitleGeneratorAgentNode;
|
|
29
|
+
}
|