mirror of
https://github.com/n8n-io/n8n
synced 2026-04-21 15:47:20 +00:00
refactor: Remove persistBuilderSessions feature flag (#27481)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1963d9775d
commit
f54453a419
5 changed files with 3 additions and 16 deletions
|
|
@ -43,8 +43,6 @@ N8N_AI_ENABLED=
|
||||||
# Base URL of the AI assistant service.
|
# Base URL of the AI assistant service.
|
||||||
# When set, requests are sent to this URL instead of the default provider endpoint.
|
# When set, requests are sent to this URL instead of the default provider endpoint.
|
||||||
N8N_AI_ASSISTANT_BASE_URL=
|
N8N_AI_ASSISTANT_BASE_URL=
|
||||||
# Whether to persist AI workflow builder sessions to the database.
|
|
||||||
N8N_AI_PERSIST_BUILDER_SESSIONS=
|
|
||||||
# API key for the Anthropic (Claude) provider used by the AI workflow builder.
|
# API key for the Anthropic (Claude) provider used by the AI workflow builder.
|
||||||
# When set, enables AI-powered workflow and node building.
|
# When set, enables AI-powered workflow and node building.
|
||||||
N8N_AI_ANTHROPIC_KEY=
|
N8N_AI_ANTHROPIC_KEY=
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,6 @@ export class AiConfig {
|
||||||
@Env('N8N_AI_ALLOW_SENDING_PARAMETER_VALUES')
|
@Env('N8N_AI_ALLOW_SENDING_PARAMETER_VALUES')
|
||||||
allowSendingParameterValues: boolean = true;
|
allowSendingParameterValues: boolean = true;
|
||||||
|
|
||||||
/** Whether to persist AI workflow builder sessions to the database. */
|
|
||||||
@Env('N8N_AI_PERSIST_BUILDER_SESSIONS')
|
|
||||||
persistBuilderSessions: boolean = false;
|
|
||||||
|
|
||||||
get openAiDefaultHeaders(): Record<string, string> {
|
get openAiDefaultHeaders(): Record<string, string> {
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
return { 'openai-platform': 'org-qkmJQuJ2WnvoIKMr2UJwIJkZ' };
|
return { 'openai-platform': 'org-qkmJQuJ2WnvoIKMr2UJwIJkZ' };
|
||||||
|
|
|
||||||
|
|
@ -449,7 +449,6 @@ describe('GlobalConfig', () => {
|
||||||
// @ts-expect-error structuredClone ignores properties defined as a getter
|
// @ts-expect-error structuredClone ignores properties defined as a getter
|
||||||
ai: {
|
ai: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
persistBuilderSessions: false,
|
|
||||||
timeout: 3600000,
|
timeout: 3600000,
|
||||||
allowSendingParameterValues: true,
|
allowSendingParameterValues: true,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,6 @@ describe('WorkflowBuilderService', () => {
|
||||||
(mockLicense.getConsumerId as jest.Mock).mockReturnValue('test-consumer-id');
|
(mockLicense.getConsumerId as jest.Mock).mockReturnValue('test-consumer-id');
|
||||||
(mockInstanceSettings.instanceId as unknown) = 'test-instance-id';
|
(mockInstanceSettings.instanceId as unknown) = 'test-instance-id';
|
||||||
mockConfig.aiAssistant = { baseUrl: '' };
|
mockConfig.aiAssistant = { baseUrl: '' };
|
||||||
(mockConfig.ai as { persistBuilderSessions: boolean }) = { persistBuilderSessions: false };
|
|
||||||
|
|
||||||
// Reset the mocked AiWorkflowBuilderService
|
// Reset the mocked AiWorkflowBuilderService
|
||||||
MockedAiWorkflowBuilderService.mockClear();
|
MockedAiWorkflowBuilderService.mockClear();
|
||||||
|
|
@ -138,7 +137,7 @@ describe('WorkflowBuilderService', () => {
|
||||||
|
|
||||||
expect(MockedAiWorkflowBuilderService).toHaveBeenCalledWith(
|
expect(MockedAiWorkflowBuilderService).toHaveBeenCalledWith(
|
||||||
mockNodeTypeDescriptions,
|
mockNodeTypeDescriptions,
|
||||||
undefined, // No session storage when persistBuilderSessions is false
|
mockSessionRepository,
|
||||||
undefined, // No client when baseUrl is not set
|
undefined, // No client when baseUrl is not set
|
||||||
mockLogger,
|
mockLogger,
|
||||||
'test-instance-id', // instanceId
|
'test-instance-id', // instanceId
|
||||||
|
|
@ -183,7 +182,7 @@ describe('WorkflowBuilderService', () => {
|
||||||
|
|
||||||
expect(MockedAiWorkflowBuilderService).toHaveBeenCalledWith(
|
expect(MockedAiWorkflowBuilderService).toHaveBeenCalledWith(
|
||||||
mockNodeTypeDescriptions,
|
mockNodeTypeDescriptions,
|
||||||
undefined, // No session storage when persistBuilderSessions is false
|
mockSessionRepository,
|
||||||
expect.any(AiAssistantClient),
|
expect.any(AiAssistantClient),
|
||||||
mockLogger,
|
mockLogger,
|
||||||
'test-instance-id', // instanceId
|
'test-instance-id', // instanceId
|
||||||
|
|
|
||||||
|
|
@ -148,14 +148,9 @@ export class WorkflowBuilderService {
|
||||||
await this.loadNodesAndCredentials.postProcessLoaders();
|
await this.loadNodesAndCredentials.postProcessLoaders();
|
||||||
const { nodes: nodeTypeDescriptions } = await this.loadNodesAndCredentials.collectTypes();
|
const { nodes: nodeTypeDescriptions } = await this.loadNodesAndCredentials.collectTypes();
|
||||||
|
|
||||||
// Use persistent session storage if feature flag is enabled
|
|
||||||
const sessionStorage = this.config.ai.persistBuilderSessions
|
|
||||||
? this.sessionRepository
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
this.service = new AiWorkflowBuilderService(
|
this.service = new AiWorkflowBuilderService(
|
||||||
nodeTypeDescriptions,
|
nodeTypeDescriptions,
|
||||||
sessionStorage,
|
this.sessionRepository,
|
||||||
this.client,
|
this.client,
|
||||||
this.logger,
|
this.logger,
|
||||||
this.instanceSettings.instanceId,
|
this.instanceSettings.instanceId,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue