Merge pull request #923 from Hexastack/906-bug---incorrect-chatbot-response-sequencing
Some checks failed
Build and Push Docker API Image / build-and-push (push) Has been cancelled
Build and Push Docker Base Image / build-and-push (push) Has been cancelled
Build and Push Docker UI Image / build-and-push (push) Has been cancelled

fix(api): resolve messages order response
This commit is contained in:
Yassine 2025-04-18 10:43:41 +01:00 committed by GitHub
commit 8ced75ef53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View File

@ -88,7 +88,7 @@ export class BotService {
read: false,
delivery: false,
};
this.eventEmitter.emit('hook:chatbot:sent', sentMessage, event);
await this.eventEmitter.emitAsync('hook:chatbot:sent', sentMessage, event);
// analytics log block or local fallback
if (fallback) {
@ -425,7 +425,12 @@ export class BotService {
subscriber.id,
block.name,
);
return this.triggerBlock(event, updatedConversation, block, false);
return await this.triggerBlock(
event,
updatedConversation,
block,
false,
);
} catch (err) {
this.logger.error('Unable to store context data!', err);
this.eventEmitter.emit('hook:conversation:end', convo);

View File

@ -96,7 +96,7 @@ export class ChatService {
*
* @param sentMessage - The message that has been sent
*/
@OnEvent('hook:chatbot:sent')
@OnEvent('hook:chatbot:sent', { promisify: true })
async handleSentMessage(
sentMessage: MessageCreateDto,
_event: EventWrapper<any, any>,