How to enable KnowledgeBase in dialogFlow after creating it automatically - node.js

I have done below via APIs.
Creating the knowledge base
Adding a document to knowledge Base.
Problem I am facing is once job is done via APIs,
Problem 1:
Its not enabling the knowledge base, I have to goto dialogFlow dashboard and enable it manually
Problem 2:
Also I have to add response $knowledge.answer[1] manually too.
Question:
Can we do this both programatically. so that there is no need to goto dialogFlow dashboard screen and do this manually. :(
What I think above APIs are useless without these both options.
Note: I can paste the code if some one needs. Thank you in Advance

'KnowledgeBases' can only be Enable/Disable through UI, it's an one time configure. If that's not applicable, you can set the knowledge bases for each requests as in 2.
'KnowledgeBases' in 'DetectIntent' requests can be set through the knowledge_base_names[] query parameter.
Note that:
'KnowledgeBases' are just repositories of documents that you can use in 'DetectIntent', agent assist, etc. They don't have enabled/disabled state.
What's referenced to as "Enabled/Disabled" in the UI is an agent setting that means 'DetectIntent' uses the 'KnowledgeBases' by default if no knowledge bases are set in the 'DetectIntent request'.
Regarding your comment "What I think above APIs are useless without these both options." I think it's a valid feature request that I highly recommend for you to submit it through Issue Tracker.

Related

In Excel Online, OfficeJS API is not passing the host_Info_ parameter anymore to Excel Add-In

I don't know when this started happening or if things have changed but the _host_Info param is not being passed by the framework to my Excel Add-In in Excel Online.
It passes an empty "et=" parameter which is OK in this case since I'm in dev mode. The Excel desktop client is still passing it.
This is required by my add-ins to switch functionality between Excel Online and Excel for Windows.
I've checked the docs and can't find that anything has changed.
To append to Sudhi's answer: with the official API coming as per the link in Sudhi's answer, we've gone ahead and also added a "shim" for the API in the OfficeJsHelpers library.
The shim still uses the workaround code that Sudhi mentions -- window.sessionStorage['hostInfoValue'] -- but it wraps it in an API very similar to what is coming in the official Office.js. Once the official API is available, we'll switch the shim code to make use of that instead. The beauty of this approach is that if you use OfficeJsHelpers via an NPM package, all you have to do is update your package dependency, and you'll suddenly go from an unofficial and potentially-fragile workaround to an API that relies on 100% officially-exposed properties -- all without changing your own code! Likewise, if at that time you decide to switch back to using the official Office.js version, the similarity of the APIs (essentially just namespace differences) should make it trivial to switch over the implementations.
The helper APIs are OfficeHelpers.Utilities.host (which will return WORD, EXCEL, etc.) and OfficeHelpers.Utilities.platform (which will return IOS, PC, OFFICE_ONLINE, or MAC). The constants are defined in OfficeHelpers.HostType and OfficeHelpers.PlatformType.
You can find the NPM package at https://www.npmjs.com/package/#microsoft/office-js-helpers, and either install it via NPM, or use a CDN like Unpkg to quickly try it out: https://unpkg.com/#microsoft/office-js-helpers#0.4.2/dist/office.helpers.min.js
console.log(OfficeHelpers.Utilities.host);
console.log(OfficeHelpers.Utilities.platform);
if (OfficeHelpers.Utilities.platform === OfficeHelpers.PlatformType.OFFICE_ONLINE) {
console.log("Yep, I'm on the web client");
}
I hope you find the above helpful as an interim measure, and we'll be sure to update this StackOverflow thread (and the OfficeJsHelpers code) once the official API is released.
Jim and others who may be affected by this change: it is unfortunate that an unrelated change meant to improve the add-in experience caused the query string parameter in online platform to be removed. Note that URL query parameters and session storage settings are used to launch and setup the add-in environment and are not meant for developer consumption. However, we understand the importance of this to the developers as described in this thread.
Hence, we are adding formal APIs to make this information available. Please see the specs that describes upcoming APIs: https://github.com/OfficeDev/office-js-docs/tree/ContextAdditions_OpenSpec
Until the APIs become available (should be very soon), you could use the following temporary workaround. The same query host_info_ parameter value is available in the following variable: window.sessionStorage.hostInfoValue. Please note that this should be considered a temporary measure and you should switch to using the formal API as soon as they are made available. I'll update the this thread when the API is released, which should be available for all supported Office versions.
If you have any comments, please leave your comments on the specs directly in Github specification branch using the links provided.
UPDATE:
Please see my answer above, instead (https://stackoverflow.com/a/40963500/678505), as the scenario is now possible.
[Old response:]
Jim, could you describe your scenario more? Why is it that you need to distinguish between Online and Desktop?
For the disappearance of host_info_: you won't find it in the docs, because host_info_ was never in the docs. Anything not documented is an internal API, which might change as needed by the internal workings of Office.js. We take back-compat very seriously, but only for actual official documented APIs.
Without an API, there's not much you can do to tell the two apart (or rather, not without relying on other bits of internal workings which might also change over time). We've discussed this internally before, but found it surprisingly difficult to point to a particular scenario where the platform information was necessary and legitimate ("legitimate" in the sense that if you're using platform information to check whether an API is available, for example, that's precisely what we don't want you to do; we want you to use Office.context.requirements.isSetSupported instead).
If you can share your scenario details, I might be able to advise an alternate way of determining whatever you need, or have a solid scenario to bring back to the team.

Is it possible to use multiple parameters in SonarQube search API?

After some time spent scouring google and looking through the Sonar Qube API documentation, along with trying a few permutations on common patterns, I have arrived to the point where I am wondering if it is even possible to use multiple parameters when doing an issue search in SonarQube's API.
Purpose of search is to populate a team radiator with issue data from Sonarqube. This data will be combined with build data from other sources (Or else I would just link to the SonarQube display page)
current configured URL to api is:
https://sonarqubesitehere.com/api/issues/search?=projectKeys=com.projectnamehere
(This is dummy code with names changed to protect the innocent)
I would like to be able to add a second parameter to this search that allows me to receive only major (or minor) issues that belong to the specific project I specify. the search term for that search is /search?severities=MAJOR
Anyone wrangled with this particular problem?
Please check the WS API on sonarqube.com or your own instance like: https://your-sonarqube.com/web_api/api/issues/search.
Here's an example of api/issues/search with several parameters
Hummmm... Provided that you read the Web API documentation for /issues/search, and that you know how to correctly write a URL that uses parameters, then it's quite easy to find that the solution is the following:
https://<your_server>/api/issues/search?projectKeys=project1Key,project2Key&severities=MINOR,MAJOR
Live example on SonarQube.com: https://sonarqube.com/api/issues/search?projectKeys=clang,git&severities=BLOCKER

How to automatically set gmail filter via chrome extension?

I would like to implement the following use case as a Chrome extension:
user visits gmail
exension checks current email body for a keyword
if a keyword is present, a gmail filter is added and saved (adding label, archiving, the details are not important here)
The first part sounds easier: there is gmail API to work with and even a gmail.js project that should make it easier.
Adding filter seems to be much harder. There is email settings API doing precisely what I want but I am fairly sure it is usable only by business accounts (custom email domains, won't work for gmail.com). I want the solution to be more universal.
One thing I thought of was to use browser automation - upon seeing the trigger keyword, the script automatically clicks 'Add filter' link, waits for AJAX, sets filter parameters and confirms.
An example of simulated user activity is in this answer
This could happen either on gmail page behind the popup ('Please wait, adjusting filters') or in background tab to keep it from interfering with user's flow. This seems like ugly workaround for me, though.
Is there a more straightforward or simply better approach that I'm missing?
After more experimentation and reviving an older github project I found out that setting the filter for a logged in user can be achieved simply by issuing a specific POST message to gmail from the current session.
I don't fully understand the parameters used in this request (if anyone has better information, please share), but I found a sample code which was greatly helpful.
Second issue, widely discussed in gmail.js community, is that Gmail security policies will prevent you from injecting your own scripts. This is bypassed by method shown in this boilerplate project
I compiled these solutions to solve my particular use case. Here is an example project with my solution, which should work out of the box - and when in doubt, see readme.

Why my plugin is not triggered when workflow updates an entity?

I have a plugin that is triggered every time when an account entity is updated. I also have a workflow that updates the account when an opportunity is closed as won.
Plugin works well when I'm in the account form and hit the save button. Workflow works well too except that when it's updating the account my plugin is not triggered even when it should be(?).
Any ideas?
I faced a similar kind of situation as yours, where I had a depth checking enabled in the plugin code. Workflows updating the entity has a depth of 3, which will get bypassed if you have that checking of 1 inside the plugin code.
Not sure if you have a similar issue here, since you're saying it's managed code and you dont have access to it. Is it some kind of package that you bought/downloaded; or will it be possible to get your hands on the code?
You should also check if the plug-in is triggered for specific attributes. If so ensure the your wf also updates these attributes so the plug-in is triggered.
Also, the code might be targeting caller origin and denying access from async service. you need to pick under the hood to gain better insight.

Basic Groovy query regarding security / visibility

I am building a .gsp page to list the user details of an application with their specifications.
I want to let 3 roles to view it but allow only admin role to save any changes they make. For this I want the save button to be visible on screen only when the admin logs in.
I know I should be handling this in the controller, but being very new to programming I have no idea how that can be achieved?
Even if you could point me to a link that explains this it would be helpful.
I assume this is with Grails?
You really shouldnt invent your own security layer, the possibilities for getting it wrong are huge. Have a look at the spring-core-security plugin
It has detailed documentation (and for the bit in your question when you get it all set up, the documentation is here)
There are also tutorials to be found all over the web (one is here)

Resources