Skip to content

Commit

Permalink
added generic response for conversation starter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Amruth-Vamshi committed Sep 14, 2023
1 parent 187d1f1 commit cdec917
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/common/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"message.invalid_question":"Sorry, for such query, I am still working. You may try some other query (queries). I hope shortly I would be able to address all your concerns. ",
"label.popUpTitle.short": "Enter your Aadhaar Number / Registration Number / Mobile Number",
"label.popUpTitle2.short": "Enter your last 4 digits of Aadhaar",
"label.popUpTitle3.short": "Enter your One Time Password."
"label.popUpTitle3.short": "Enter your One Time Password.",
"message.convoStarter":"Dear Beneficiary, Please ask question related to your PM Kisan account."
}
4 changes: 3 additions & 1 deletion src/xstate/prompt/prompt.gaurds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const promptGuards = {

ifOTPHasBeenVerified: (context,_) => context.isOTPVerified,

ifInvalidClassifier: (_,event) => event.data == "invalid"
ifInvalidClassifier: (_,event) => event.data == "invalid",

ifConvoStarterOrEnder: (_,event) => event.data == "convo_starter" || event.data == "convo_ender"

}
10 changes: 10 additions & 0 deletions src/xstate/prompt/prompt.machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,16 @@ export const botFlowMachine3:any =
invoke: {
src: "questionClassifier",
onDone: [
{
cond: "ifConvoStarterOrEnder",
target: "getUserQuestion",
actions: [
assign({
response: () => engMessage["message.convoStarter"],
type:"pause"
})
]
},
{
cond: "ifInvalidClassifier",
target: "getUserQuestion",
Expand Down
4 changes: 2 additions & 2 deletions src/xstate/prompt/prompt.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export class PromptServices {
if (response == "LABEL_2") return "invalid"
if (response == "LABEL_1") return "payment"
if (response == "LABEL_0") return "payment"
if (response == "LABEL_3") return "invalid"
if (response == "LABEL_4") return "invalid"
if (response == "LABEL_3") return "convo_starter"
if (response == "LABEL_4") return "convo_ender"
return response;
} catch (error){
return Promise.reject(error)
Expand Down

0 comments on commit cdec917

Please sign in to comment.