Reputation: 1599
For example if you have IntentA and you add 2 followup intents: IntentB, IntentC, it works ok it should add a context because it doesn't have an output context yet. But here is the problem. Sometimes if you add another one, for example a FallbackIntent, it just adds another context (SOMETIMES) and if you delete it in both(IntentA and FallbackIntent), so they both have the same context, meaning they should still be connected, and the hiearchy shouldn't change,but it still does. It still works perfectly, but still this is a wierd behavior. Any ideas why this happens and how to fix it?
Intent A
Intent B
Fallback
Upvotes: 3
Views: 1418
Reputation: 31
@sid8491 - this is absolutely ingenious :) Thanks for that! Works like a charm and I can confirm that this is just a visual representation. No need to worry about changing your code.
Just a small addition: When you already have follow-up intents, they already carry
"id": "70a48f63-662b-48d4-9a78-dd0af3e0db87",
"parentId": "5a1b5861-fadc-480e-b03b-11bc034df8b9",
"rootParentId": "6c9cb1d6-3efb-4bac-b768-ae3265faa7b6",
Make sure to adjust rootParentId
to the aforementioned id
of the root-intent, leave parentId intact and you're all set. Didn't try with a follow-up/follow-up/follow-up etc. structure but I'd say it will follow the same pattern somehow.
Upvotes: 0
Reputation: 6800
The best way to resolve this issue and organize the structure of your dialogflow agent is to upload the intents using create_intent()
function of dialogflow api.
You can give the root intent as parent_followup_intent_name
, and all the intents having this root intent will fall under same intent. Note that you will need to give root intent ID not the name.
You can read more about create_intent api using python sdk.
intents_client = dialogflow.IntentsClient()
intent = dialogflow.types.Intent(
display_name=display_name,
training_phrases=training_phrases_parts,
messages=response,
input_context_names=input_contexts,
output_contexts = output_context_list,
parent_followup_intent_name=root_intent,
)
intents_client.create_intent(parent, intent)
EDIT:
As requested, here's 2nd and easier way of doing this without any prograpping knowledge.
how to solve
intent Once exported, unzip the files and go to intents folder. Your files will look something like below screenshot
how to solve.json
file and copy the id of this intenthow to solve
intent (note we have to open the files which do not have
_usersays_en
as they only contain user utterances how to solve
intent as parentId
in these json
files like below screenshot (in this case intent id of how to solve
intent was b2131b0e-f86d-429d-957c-65c070ddd5df
)Hope it helps.
Upvotes: 6