Commit 42b46e0
committed
fix(chatbot): closed session should not block bot re-activation
When a chatbot session exists with status='closed', the emit() method
returned early, preventing the bot from re-activating on new messages.
Root cause: the guard 'if (session.status === closed) return' was meant
to skip sessions not awaiting user input, but it also prevented new
conversations from starting after a bot flow completed.
Fix: nullify the session instead of returning, so processBot enters the
'!session' branch and creates a fresh session.
Also adds null guards:
- getConversationMessage: return empty string instead of undefined
- findBotByTrigger: handle null/undefined content gracefully1 parent cd800f2 commit 42b46e0
File tree
3 files changed
+12
-4
lines changed- src
- api/integrations/chatbot
- utils
3 files changed
+12
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
797 | 797 | | |
798 | 798 | | |
799 | 799 | | |
800 | | - | |
| 800 | + | |
801 | 801 | | |
802 | 802 | | |
803 | 803 | | |
| |||
896 | 896 | | |
897 | 897 | | |
898 | 898 | | |
899 | | - | |
| 899 | + | |
900 | 900 | | |
901 | | - | |
| 901 | + | |
902 | 902 | | |
903 | 903 | | |
904 | 904 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
19 | 27 | | |
20 | 28 | | |
21 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
0 commit comments