refactor(utils.ts): simplify logic for getting chat input field

The logic for getting the chat input field has been simplified by removing unnecessary checks and using optional chaining. This improves readability and reduces the complexity of the code.
This commit is contained in:
anovazzi1 2023-08-16 17:52:08 -03:00
commit 57f580c93d

View file

@ -280,12 +280,13 @@ export function getChatInputField(flow: FlowType, tabsState?: TabsState) {
let chat_input_field = "text";
if (
tabsState &&
tabsState[flow.id] &&
tabsState[flow.id].formKeysData &&
tabsState[flow.id].formKeysData.input_keys
) {
chat_input_field = Object.keys(
tabsState[flow.id].formKeysData.input_keys
tabsState[flow.id].formKeysData.input_keys!
)[0];
}
return chat_input_field;