mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
feat: Respond to chat and wait for response (#12546)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in> Co-authored-by: Shireen Missi <94372015+ShireenMissi@users.noreply.github.com>
This commit is contained in:
@@ -42,6 +42,7 @@ export const FORM_NODE_TYPE = 'n8n-nodes-base.form';
|
||||
export const FORM_TRIGGER_NODE_TYPE = 'n8n-nodes-base.formTrigger';
|
||||
export const CHAT_TRIGGER_NODE_TYPE = '@n8n/n8n-nodes-langchain.chatTrigger';
|
||||
export const WAIT_NODE_TYPE = 'n8n-nodes-base.wait';
|
||||
export const RESPOND_TO_WEBHOOK_NODE_TYPE = 'n8n-nodes-base.respondToWebhook';
|
||||
export const HTML_NODE_TYPE = 'n8n-nodes-base.html';
|
||||
export const MAILGUN_NODE_TYPE = 'n8n-nodes-base.mailgun';
|
||||
export const POSTGRES_NODE_TYPE = 'n8n-nodes-base.postgres';
|
||||
@@ -118,3 +119,5 @@ export const FROM_AI_AUTO_GENERATED_MARKER = '/*n8n-auto-generated-fromAI-overri
|
||||
export const PROJECT_ROOT = '0';
|
||||
|
||||
export const WAITING_FORMS_EXECUTION_STATUS = 'n8n-execution-status';
|
||||
|
||||
export const CHAT_WAIT_USER_REPLY = 'waitUserReply';
|
||||
|
||||
@@ -874,10 +874,14 @@ export interface FunctionsBase {
|
||||
nodeName: string,
|
||||
options?: { includeNodeParameters?: boolean },
|
||||
): NodeTypeAndVersion[];
|
||||
getParentNodes(nodeName: string): NodeTypeAndVersion[];
|
||||
getParentNodes(
|
||||
nodeName: string,
|
||||
options?: { includeNodeParameters?: boolean },
|
||||
): NodeTypeAndVersion[];
|
||||
getKnownNodeTypes(): IDataObject;
|
||||
getMode?: () => WorkflowExecuteMode;
|
||||
getActivationMode?: () => WorkflowActivateMode;
|
||||
getChatTrigger: () => INode | null;
|
||||
|
||||
/** @deprecated */
|
||||
prepareOutputData(outputData: INodeExecutionData[]): Promise<INodeExecutionData[][]>;
|
||||
@@ -1201,6 +1205,7 @@ export interface INodeExecutionData {
|
||||
| NodeApiError
|
||||
| NodeOperationError
|
||||
| number
|
||||
| string
|
||||
| undefined;
|
||||
json: IDataObject;
|
||||
binary?: IBinaryKeyData;
|
||||
@@ -1209,6 +1214,16 @@ export interface INodeExecutionData {
|
||||
metadata?: {
|
||||
subExecution: RelatedExecution;
|
||||
};
|
||||
/**
|
||||
* Use this key to send a message to the chat.
|
||||
*
|
||||
* - Workflow has to be started by a chat node.
|
||||
* - Put execution to wait after sending.
|
||||
*
|
||||
* See example in
|
||||
* packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/Chat.node.ts
|
||||
*/
|
||||
sendMessage?: string;
|
||||
|
||||
/**
|
||||
* @deprecated This key was added by accident and should not be used as it
|
||||
@@ -1624,6 +1639,11 @@ export interface INodeType {
|
||||
description: INodeTypeDescription;
|
||||
supplyData?(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData>;
|
||||
execute?(this: IExecuteFunctions): Promise<NodeOutput>;
|
||||
/**
|
||||
* A function called when a node receives a chat message. Allows it to react
|
||||
* to the message before it gets executed.
|
||||
*/
|
||||
onMessage?(context: IExecuteFunctions, data: INodeExecutionData): Promise<NodeOutput>;
|
||||
poll?(this: IPollFunctions): Promise<INodeExecutionData[][] | null>;
|
||||
trigger?(this: ITriggerFunctions): Promise<ITriggerResponse | undefined>;
|
||||
webhook?(this: IWebhookFunctions): Promise<IWebhookResponseData>;
|
||||
@@ -2110,11 +2130,28 @@ export interface IWebhookResponseData {
|
||||
}
|
||||
|
||||
export type WebhookResponseData = 'allEntries' | 'firstEntryJson' | 'firstEntryBinary' | 'noData';
|
||||
|
||||
/**
|
||||
* Defines how and when response should be sent:
|
||||
*
|
||||
* onReceived: Response is sent immidiatly after node done executing
|
||||
*
|
||||
* lastNode: Response is sent after the last node finishes executing
|
||||
*
|
||||
* responseNode: Response is sent from the Responde to Webhook node
|
||||
*
|
||||
* formPage: Special response with executionId sent to the form trigger node
|
||||
*
|
||||
* hostedChat: Special response with executionId sent to the hosted chat trigger node
|
||||
*
|
||||
* streaming: Response added to runData to httpResponse and streamingEnabled set to true
|
||||
*/
|
||||
export type WebhookResponseMode =
|
||||
| 'onReceived'
|
||||
| 'lastNode'
|
||||
| 'responseNode'
|
||||
| 'formPage'
|
||||
| 'hostedChat'
|
||||
| 'streaming';
|
||||
|
||||
export interface INodeTypes {
|
||||
|
||||
Reference in New Issue
Block a user