Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
62 lines
1.7 KiB
TypeScript
62 lines
1.7 KiB
TypeScript
import type { INodeProperties } from 'n8n-workflow';
|
|
|
|
export const sessionIdOption: INodeProperties = {
|
|
displayName: 'Session ID',
|
|
name: 'sessionIdType',
|
|
type: 'options',
|
|
options: [
|
|
{
|
|
name: 'Connected Chat Trigger Node',
|
|
value: 'fromInput',
|
|
description:
|
|
"Looks for an input field called 'sessionId' that is coming from a directly connected Chat Trigger",
|
|
},
|
|
{
|
|
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased
|
|
name: 'Define below',
|
|
value: 'customKey',
|
|
description: 'Use an expression to reference data in previous nodes or enter static text',
|
|
},
|
|
],
|
|
default: 'fromInput',
|
|
builderHint: {
|
|
message:
|
|
"Use 'Connected Chat Trigger Node' (fromInput) if there is a Chat Trigger node earlier in the workflow. Otherwise use 'Define below' (customKey).",
|
|
},
|
|
};
|
|
|
|
export const expressionSessionKeyProperty = (fromVersion: number): INodeProperties => ({
|
|
displayName: 'Session Key From Previous Node',
|
|
name: 'sessionKey',
|
|
type: 'string',
|
|
default: '={{ $json.sessionId }}',
|
|
disabledOptions: { show: { sessionIdType: ['fromInput'] } },
|
|
displayOptions: {
|
|
show: {
|
|
sessionIdType: ['fromInput'],
|
|
'@version': [{ _cnd: { gte: fromVersion } }],
|
|
},
|
|
},
|
|
});
|
|
|
|
export const sessionKeyProperty: INodeProperties = {
|
|
displayName: 'Key',
|
|
name: 'sessionKey',
|
|
type: 'string',
|
|
default: '',
|
|
description: 'The key to use to store session ID in the memory',
|
|
displayOptions: {
|
|
show: {
|
|
sessionIdType: ['customKey'],
|
|
},
|
|
},
|
|
};
|
|
|
|
export const contextWindowLengthProperty: INodeProperties = {
|
|
displayName: 'Context Window Length',
|
|
name: 'contextWindowLength',
|
|
type: 'number',
|
|
default: 5,
|
|
hint: 'How many past interactions the model receives as context',
|
|
};
|