From 81f31bbc30baab58c81edbdce17e338db1331eb2 Mon Sep 17 00:00:00 2001 From: Austin Johnson Date: Mon, 7 Jul 2025 12:55:30 -0400 Subject: [PATCH] Fix send to be correct version --- lex-web-ui/src/lib/lex/client.js | 49 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/lex-web-ui/src/lib/lex/client.js b/lex-web-ui/src/lib/lex/client.js index 4d211f30..a1e111c8 100644 --- a/lex-web-ui/src/lib/lex/client.js +++ b/lex-web-ui/src/lib/lex/client.js @@ -115,33 +115,34 @@ export default class { } async startNewSession() { - let command; - if (this.isV2Bot) { - command = new PutSessionCommandV2({ - botAliasId: this.botV2AliasId, - botId: this.botV2Id, - localeId: this.botV2LocaleId, - sessionId: this.userId, - sessionState: { + let command, res; + try { + if (this.isV2Bot) { + command = new PutSessionCommandV2({ + botAliasId: this.botV2AliasId, + botId: this.botV2Id, + localeId: this.botV2LocaleId, + sessionId: this.userId, + sessionState: { + dialogAction: { + type: 'ElicitIntent', + }, + }, + }); + const res = await this.lexRuntimeV2Client.send(command); + return res; + } else { + command = new PutSessionCommandV1({ + botAlias: this.botAlias, + botName: this.botName, + userId: this.userId, dialogAction: { type: 'ElicitIntent', }, - }, - }); - } else { - command = new PutSessionCommandV1({ - botAlias: this.botAlias, - botName: this.botName, - userId: this.userId, - dialogAction: { - type: 'ElicitIntent', - }, - }); - } - - try { - const res = await this.lexRuntimeClient.send(command); - return res; + }); + const res = await this.lexRuntimeClient.send(command); + return res; + } } catch(err) { console.log(err) }