I have built a bot for facebook messenger using rasa nlu . Initially I am giving user a language select option. I want to save user preference at the first time and later , I do not want to ask user again to set their language preference , how can I do it ?
you can have a seperate slot for your language and save it in that slot. Then your further developments can be done by looking at the language slot value.
Slot is like a placeholder in rasa.
In you domain.py file, you can define the slot like this
slots:
language:
type: text
initial_value: "en"
Then you can define it as an entity in your same domain.py file like below.
entities:
- language
then you can set your slot value in your stories like below.
visitor_resp{"language":"english"}
And the your language slot value is set.
For more details please visit https://rasa.com/docs/rasa/core/slots/
Related
In a Drupal project, i have a basic weborm. As soon as the user submits one, an email is send with all the things he just wrote.
Example:
Imp_First_Name:%value[firstname]
Imp_Last_Name:%value[lastname]
Imp_City:%value[lastname]
Imp_Country:%value[country]
Imp_Email:%value[email]
Imp_Subject:%value[subject]
I have a problem on this line:
Imp_Subject:%value[subject]
Subject contains what the user have selected within a select list. My problem is when the website is set to chinese, all is written in chinese obviously but i don't want the chinese version to be sent. I need the english one.
For example :
In my webform, the user has the choice between 3 countries:
Afghanistan|阿富汗
Afrique du Sud|南非
Albanie|阿尔巴尼亚
I need the country name in latin alphabet ! How can i manage to do this?
thanks in advance for your help
It's a tricky one...
There is substitution and also two possible template layers. One comes from webform and second comes from mailsystem / mail handler module.
I'm assuming that the substitution is done before the template layer so the t() function should be applied either within a hook on that level or within the proper template file.
Debugging with XDebug would really help to solve the issue.
I am trying to enable siteEdit for the Embedded fields for the pages implemented using DD4T.
I am able to find the methods and tags which helps to enable it for normal methods and component presentation but not for Embedded Fields and at the components(directly passing the Icompoennt model) level.
I am trying to enable it for SiteEdit2012(UI)
Please help.
The same as a 'normal' field. Imagine you have an embedded field called 'address' with 2 fields: street and number. This is how you would make it !SiteEdit enabled:
//Street
#Html.SiteEditField(Model.Component, Model.Component.Fields["address"].EmbeddedValues[0]["street"])
//Number
#Html.SiteEditField(Model.Component, Model.Component.Fields["address"].EmbeddedValues[0]["number"])
I am trying to make an iPhone App in which i will make user to login into their account.
For this i want userID and Password from the user. My question is how i can make a password
field in which whatever I enter will be shown as "*".
Sounds like you are looking for "setSecureTextEntry" on a "UITextField" object.
Also known as the "secureTextEntry" property in the "UITextInputTraits" protocol.
You can call this programatically via calling ".secureTextEntry = YES" on the "UITextField" object you want to be set for passwords.
You can also set it in Interface Builder (look for "Secure" checkbox in your text field Attributes inspector). It looks like this:
And in newer version of Xcode:
Update for Xcode 12.2+
My opinion is programmatic declaration of properties are easier to toggle back and forth.
Programmatically in Swift 5:
myPasswordTextField.isSecureTextEntry = true
I don't know if I'm on the right track but I'm trying to let users of my web site create there own versions of pages on my web site.
Basically I'd like to make our documentation used as a starting point where they just add details and make a new page for themselves in the process.
I have a 'book' content type that I have changed with CCK and a 'client edits' content type that uses a nodereferencefromURL widget to link itself to the book node.
So simple version of what I'm saying is I have a link on my book pages that creates a node using client edits content type. I would like to put some fields on the client edits content type that take the values of some of the fields from the book page it is linked from.
I'm sure I'm missing something as I would have thought someone would have tried this before but I can't even find a hint on how to go about this.
All I really need is a point in the right direction if my current thinking is wrong.
Current thinking is that I use a php script to get the default value for a field on the new node add screen that drags the value for a field from the book I'm linking from.
I'm thinking this is the case because there is an option for default values for the field in cck manage fields that lets you put in a php value to return a default value for your field.
Am I on the right track or is there already a module or process that does what I'm talking about and I'm just too dumb to find it.
This sounds a little strange, are your client edits going to be a diff from the original node or just coppied data?
I would prehaps do it a more simple way, just have book nodes, and have different fields disaply depending on who edits it (enable the content_permissions module). That way you can use the node clone module to create the users copy.
You will need to make a module to contain your custom php code.
I ended up using rules to save information from the user and the cloned node into hidden fields.
One that saved the original node ID into a field when ever you create content of that type unless the url ends with Clone. This means that when you create the clone the original node ID is kept in the field.
That made it easy to use a views argument that took the node ID to make the clone appear along side the original when a user visits the original page.
The second rule trick was to compute a field that saved the "store name" from the profile of the user only when saving clone content.
This meant that there was a hidden field on the clone that stored the info so I could then use another views argument to restrict the view to only people with the same store name in their profile.
I am no good with PHP but I managed to find a snippet (can't remember where) that returns the store name of the current logged in user as the argument.
global $user;
profile_load_profile($user);
return $user->profile_store_name;
When a user login , the user will be redirect to a user profile page, which has a My account field set.
the field set has 2 fields, "Username: ", "Email address:". those 2 fields are generated by drupal.
those 2 field contained in a form which has a id ("user_profile_form") . I want to change the order of those 2 fields.
I have tried to intercept 'user_profile_form' , inside hook_form_alter.
code as follow:
$form['account']['name']['#weight'] = 1;
but that did not success, drupal did not even rendering the 'name' field, so no username: showed on browser.
What you did is absolutely correct, and probably did work. You can change the weight of the fields with the method described above.
The username field is not always rendered. The reason is that a persmission is required: change own username. If that perm is not set, you wont be allowed to alter you username and the field wont be shown.
Info on debugging.
Your info alone is not quite enough to debug. From what you describe, you are doing the right thing, but other modules could be making things a bit tricky for you. The devel module is quite good when it comes to debugging, ti defines two functions I use a lot when debugging:
dpm() pretty prints the variable to the message area using krumo.
dd() Prints / saves a variable to a log file. Useful when you can't view messages on the screen.
I would suggest that you look at the $form variable before and after you alter it.
Things that could make it go wrong:
Did you remember to pass the $form variable by reference using the & notation?
Is another module altering your form after you?
Are you checking for the correct form id, so you alter the correct form?
These are some pointers, before you bring more info, all I can do is guess to what your problem exactly can be. I did something like this a few days ago so I know what you describe shouldn't be a problem.