feat(editor): Improve how we show default Agent prompt and Memory session parameters (#11491)

This commit is contained in:
oleg
2024-11-12 11:33:20 +01:00
committed by GitHub
parent e875bc5592
commit 565f8cd8c7
26 changed files with 231 additions and 135 deletions

View File

@@ -1,4 +1,9 @@
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
import { PostgresChatMessageHistory } from '@langchain/community/stores/message/postgres';
import { BufferMemory, BufferWindowMemory } from 'langchain/memory';
import type { PostgresNodeCredentials } from 'n8n-nodes-base/dist/nodes/Postgres/v2/helpers/interfaces';
import { postgresConnectionTest } from 'n8n-nodes-base/dist/nodes/Postgres/v2/methods/credentialTest';
import { configurePostgres } from 'n8n-nodes-base/dist/nodes/Postgres/v2/transport';
import type {
ISupplyDataFunctions,
INodeType,
@@ -6,16 +11,17 @@ import type {
SupplyData,
} from 'n8n-workflow';
import { NodeConnectionType } from 'n8n-workflow';
import { BufferMemory, BufferWindowMemory } from 'langchain/memory';
import { PostgresChatMessageHistory } from '@langchain/community/stores/message/postgres';
import type pg from 'pg';
import { configurePostgres } from 'n8n-nodes-base/dist/nodes/Postgres/v2/transport';
import type { PostgresNodeCredentials } from 'n8n-nodes-base/dist/nodes/Postgres/v2/helpers/interfaces';
import { postgresConnectionTest } from 'n8n-nodes-base/dist/nodes/Postgres/v2/methods/credentialTest';
import { getSessionId } from '../../../utils/helpers';
import { logWrapper } from '../../../utils/logWrapper';
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
import { sessionIdOption, sessionKeyProperty, contextWindowLengthProperty } from '../descriptions';
import { getSessionId } from '../../../utils/helpers';
import {
sessionIdOption,
sessionKeyProperty,
contextWindowLengthProperty,
expressionSessionKeyProperty,
} from '../descriptions';
export class MemoryPostgresChat implements INodeType {
description: INodeTypeDescription = {
@@ -23,7 +29,7 @@ export class MemoryPostgresChat implements INodeType {
name: 'memoryPostgresChat',
icon: 'file:postgres.svg',
group: ['transform'],
version: [1, 1.1],
version: [1, 1.1, 1.2, 1.3],
description: 'Stores the chat history in Postgres table.',
defaults: {
name: 'Postgres Chat Memory',
@@ -56,6 +62,7 @@ export class MemoryPostgresChat implements INodeType {
properties: [
getConnectionHintNoticeField([NodeConnectionType.AiAgent]),
sessionIdOption,
expressionSessionKeyProperty(1.2),
sessionKeyProperty,
{
displayName: 'Table Name',