Dialogflow message with audio input (chat bot Dialogflow cx) - dialogflow-cx

I have created an agent by DialogFlow Cx and I need do a web demo. I'm trying create this page using Dialog Flow message:
<DOCKTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title> PocJbsEngineering </title>
<script src="https://www.gstatic.com/dialogflow-console/fast/messenger-cx/bootstrap.js?v=1"></script>
<df-messenger df-cx="true" location="us-east1" chat-title="JBS" agent-id="bfb3f030-9d41-4160-b13c-90de6f3b8c1d"
language-code="pt-br" request.inputAudio = "audio"></df-messenger>
</head>
<body>
</body>
</html>
but, the chat message doesnt have the voice input:
chat
How can I put a voice input on Dialogflow message? some suggestion to do this agent Dialogflow Cx with audio input?

unfortunately as you pointed out the embedded version doesn't have audio as an input.
If you want to use the embedded chat then you'd need to record your voice and convert it to text using speech to text.
If you wanted to create your own UI then you should use Dialogflow CX v1beta2 and the type InputAudioConfig. You'd record your voice and use the InputAudioConfig to pass into the detect intent call. Similar to the link below just with Dialogflow CX instead of ES
https://cloud.google.com/dialogflow/es/docs/how/detect-intent-audio

Related

Why does Chrome send ajax late for a simple page?

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script>
const jsonPromise = fetch("https://www.google.com");
jsonPromise.then(() => alert("done"));
</script>
</head>
<body>
</body>
</html>
This is my HTML. The graph shows the HTML download finished early but the ajax is sent at 181ms.
I believe Chrome doesn't need 180ms to parse the simple HTML. What is it doing in the interim? Can Chrome send the request as soon as possible?
In my real application, I request JSON from my server. The JSON is the critical data for rendering the page, otherwise the page is blank. That's why I want the browser to send the request as early as possible.
The same happens for Firefox
I got it. I have too many extensions. Once I disable all extensions, the ajax is sent at 8ms.

In custom adaptor, where is the file's title property I have to set?

I'm making custom file adaptor using adaptor library.
In my adaptor getDocContent(), I retrieve file from URL, and set the content to the Response's OutputStream like sharepoint connector do.
So, I thought "Where is the file's title property I have to set? This is just a content."
As I was thinking, the file does not hit by it's title on the GSA search API. Also by File Extension Filter.
When developing a connector for Google Search Appliance using the Adaptor Framework, you have a few options on how to display metadata. You can send metadata via HTTP headers, but this lacks somehow. For example, when your metadata is too long, it will get truncated (because of it's size).
Since some time we use Handlebars for templating in GSA connectors. You pass your retrieved object to Handlebars, after which you can compose an HTML document such as following:
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="{{object.description}}"/>
<meta name="filetype" content="{{object.filetype}}"/>
<title>{{object.title}}</title>
</head>
<body>
<h1>{{object.title}}</title>
<p>{{object.description}}</p>
<p>{{object.someMoreContent}}</p>
</body>
</html>
So when you getDocContent method is invoked (usually, when GSA crawls you connector), it will crawl the page you design with HTML and HandleBars. Very straightforward and easy to maintain!

Don't prompt a user to install an app when trying to load a custom URL scheme

I have a page where I want to redirect users to the Instagram app when it's installed. That part works well, but when the user doesn't have the app installed it prompts them to go to the app store and download the app, which is not what I want.
I'm seeing this behavior on OS X in Safari, and the HTML involved is ({username} would be populated by my application based on the user submitting the form):
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0; url=instagram://user?username={username}">
</head>
<body>
<div>
Taking you to Instagram...
</div>
<script src="https://code.jquery.com/jquery-1.11.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
setTimeout(function() {
window.location = "https://instagram.com/{username}";
}, 200);
});
</script>
</body>
</html>
EDIT
Specifically, what's happening is the line <meta http-equiv="refresh" content="0; url=instagram://user?username={username}"> is showing the following dialog:
I'd like for that dialog not to display and let the "window.location =" in the take over and redirect the user to Instagram within the browser.
My question is how can I modify the "instagram://" redirect to not ask users to install the Instagram app on their machine?
There is no (official) way to detect in the browser if an app (like Instagram) is installed and thus you cannot use a custom url scheme without offering an alternative. You should let the choice to the end-user and prompt to open the website (https scheme) or the app (Instagram scheme).
The user will know if the app is installed.
If you know already that the user has the Instagram app installed, you can look at the browser agent to see if you are on an iOS device.

add text only version to an email template

We use mandrill to send emails and we have many templates defined to send emails. Below is one such template
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css">
----- some styling information ----
</style>
</head>
<body>
------ Other html content ------
</body>
</html>
As you can see there is no mention of text only version of this email template. To improve the chances of this email not going to spam i also want to add text only version of it as well. I got to know about "multipurpose internet mail extensions" but i still do not understand how i can make my email to have a text only version too.
I will be really grateful for any kind of help on this.
Strongly suggest using a templating service on top of Mandrill, such as apostle or sendwithus.
Makes it way easier to manage and edit html+text templates, and I believe both support your use case.
You didn't indicate anything about your environment, where you're storing the templates, or whether you're using Mandrill's SMTP integration or API. Those things can make a difference in how/where you store the text versions of your templates.
If you're generating the full SMTP message in some fashion in your system, then you'd need to create a multi-part/alternative MIME document to store the text version. Or use a library or templating engine that can generate this for you in accordance with the relevant specifications.
If you're storing them in your system, and using the Mandrill API, then you'd want to store a separate text version to pass in the text parameter.
For Mandrill templates, there's an explicit text version that can be provided and saved.
Alternately, Mandrill has an option to auto-convert your HTML to text. It can be configured in your Sending Defaults, or on a per-message basis through the API or with SMTP headers.

Generate JavaScript using the Grape API?

I am using the Grape framework to retrieve data, which is working great. I would also like to retrieve a JavaScript file using the API. For example:
<!DOCTYPE html>
<html>
<head>
<script defer src="http://someapi.com/dni_js/dni.js" > </script>
</head>
<body>
</body>
</html>
http://someapi.com/dni_js/dni.js is calling the API.
What would be the best way to accomplish this?
You should implement support for JSONP in your API.
https://github.com/intridea/grape#jsonp

Resources