Commit f4437a68 authored by Jochen Kressin's avatar Jochen Kressin
Browse files

testing KB bot

parent cb22b6fd
......@@ -11,7 +11,8 @@ resources:
- https://search-guard.com/generating-certificates-tls-tool/|Generating production-ready certificates with the TLS tool (blog post)
- https://search-guard.com/elasticsearch-searchguard-tls-introduction/|An introduction to TLS (blog post)
- https://search-guard.com/elasticsearch-tls-certificates/|An introduction to TLS certificates (blog post)
- https://search-guard.com/elasticsearch-tls-certificates-openssl/|Creating Search Guard TLS certificates with OpenSSL (blogpost)
- https://www.musingitoutloud.com/creating-a-ca-with-openssl/|Creating a CA with OpenSSL (blogpost)
---
<!---
Copryight 2017 floragunn GmbH
......@@ -43,5 +44,7 @@ For generating certificates you have the following options:
* Use and customize the [example PKI scripts](tls_generate_example_scripts.md) (safe for production)
* Create a CSR and send it to your existing PKI infrastructure, if any (safe for production)
* Using tools like OpenSSL and/or keytool (safe for production)
* [Creating Search Guard TLS certificates with OpenSSL](https://search-guard.com/elasticsearch-tls-certificates-openssl/) (blogpost)
* [Creating a CA with OpenSSL](https://www.musingitoutloud.com/creating-a-ca-with-openssl/) (blogpost)
If you have your own PKI infrastructure and are already familiar with TLS certificates, you can jump directly to [TLS certificates for production environments](tls_certificates_production.md).
......@@ -55,7 +55,8 @@
<!-- End of Footer Menu -->
<!-- Copyright -->
<p class="copyright helper right">
<a href="https://search-guard.com" target="_blank">© 2017-2018 floragunn GmbH - All Rights Reserved </p>
<a href="https://search-guard.com" target="_blank">© 2017-2018 floragunn GmbH - All Rights Reserved</a>
</p>
<!-- End of Copyright -->
</div>
</div>
......
......@@ -56,4 +56,6 @@
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.3.2/dist/instantsearch.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.3.2/dist/instantsearch-theme-algolia.min.css">
<link rel="stylesheet" href="css/custom.css">
</head>
\ No newline at end of file
......@@ -62,7 +62,9 @@
{% endfor %}
</ul>
</li>
<li>
<a href="#" id="chatLink" class="main-nav-level-1" style="font-weight: 500">Knowledge Bot</a>
</li>
</ul>
</nav>
<!-- End of Menu -->
......
<script src="js/modernizr.js"></script>
<script src="js/all.js"></script>
<script src="js/custom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/prism.js"></script>
<script src="js/prism_yaml.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.8.4/components/prism-bash.min.js"></script>
......
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="css/style.min.css">
<link href="css/botchat.css" rel="stylesheet" />
<link rel="stylesheet" href="css/custom.css">
<script src="https://cdn.botframework.com/botframework-webchat/master/botchat.js"></script>
</head>
<body class="">
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<!-- End of Preloader -->
<div class="page js-page ">
<div id="bot"/>
<script>
function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
var model = {
"userId": uuidv4(),
"userName": "You",
"botId": "SG_KB_WEBAPP_BOT",
"botName": "Jean-Luc, your friendly Search Guard Bot",
"secret": "IV_x90YAA-A.LeMq1sP54ZRJlSTEE4XdqndPpNa8EQLMX9FZ-mTdVXc",
};
var user = {
id: model.userId,
name: model.userName,
iconUrl: model.iconUrl
};
var botConnection = new BotChat.DirectLine({
secret: model.secret,
user: user
});
BotChat.App({
chatTitle: "Search Guard Knowledge Bot",
botConnection: botConnection,
user: user,
bot: { id: model.botId, name: model.botName },
resize: 'detect',
sendTyping: true,
showUploadButton: false,
}, document.getElementById("bot"));
</script>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Search Guard Knowledge Bot</title>
<!--
For demonstration purposes, we are using the development branch of Web Chat at "/master/webchat.js".
When you are using Web Chat for production, you should use the latest stable release at "/latest/webchat.js",
or lock down on a specific version with the following format: "/4.1.0/webchat.js".
-->
<script src="https://cdn.botframework.com/botframework-webchat/master/webchat.js"></script>
<style>
html, body { height: 100% }
body { margin: 0 }
#webchat {
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<div id="webchat" role="main"></div>
<script>
(async function () {
// In this demo, we are using Direct Line token from MockBot.
// To talk to your bot, you should use the token exchanged using your Direct Line secret.
// You should never put the Direct Line secret in the browser or client app.
// https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-direct-line-3-0-authentication
//const res = await fetch('https://webchat-mockbot.azurewebsites.net/directline/token', { method: 'POST' });
//const { token } = await res.json();
const styleOptions = {
botAvatarImage: 'https://docs.microsoft.com/en-us/azure/bot-service/v4sdk/media/logo_bot.svg?view=azure-bot-service-4.0',
botAvatarInitials: 'BF',
userAvatarImage: 'https://github.com/compulim.png?size=64',
userAvatarInitials: 'WC'
};
var dl = window.WebChat.createDirectLine({ token: "IV_x90YAA-A.LeMq1sP54ZRJlSTEE4XdqndPpNa8EQLMX9FZ-mTdVXc" });
window.WebChat.renderWebChat({
directLine: dl,
styleOptions
}, document.getElementById('webchat'));
document.querySelector('#webchat > *').focus();
var activity = {
from: {
id: "SG_KB_WEBAPP_BOT",
name: "userName",
role: "bot"
},
name: 'startConversation',
type: 'event',
value: '',
channelData: {
"personId": "SG_KB_WEBAPP_BOT",
"environment": window.location.host
}
};
dl.postActivity(activity).subscribe(function(id) {
if (console) {
console.log('"trigger requestWelcomeDialog" sent');
}
});
})().catch(err => console.error(err));
</script>
</body>
</html>
\ No newline at end of file
......@@ -9,6 +9,7 @@
<![endif]-->
<!-- End of Preloader -->
<div class="page js-page ">
{% include main_navigation.html %}
......@@ -30,17 +31,23 @@
{% include version.html %}
{{ content }}
{% include additional_resources.html %}
{% include additional_resources_search.html %}
{% include additional_resources_search.html %}
</div>
</div>
</div>
</div>
</div>
{% include footer.html %}
<div id="chatcontainer" style="height: 32px;">
<div id='chatTitleBar' style='height: 32px; width: 400px; position:fixed; cursor: pointer;'></div>
<iframe src="chatbot.html" style="width: 416px; height: 600px; border:0;"></iframe>
</div>
{% include footer.html %}
</div>
{% include scripts.html %}</body>
<script type="application/ld+json">
......@@ -103,4 +110,7 @@
]
}
</script>
</html>
\ No newline at end of file
---
title: Search Guard Chatbot
html_title: Search Guard Chatbot
slug: chatbot
layout: chatbot
description: Talk with our friendly chatbot who is more than happy to answer your questions.
---
\ No newline at end of file
This diff is collapsed.
......@@ -150,4 +150,25 @@ pre{background:#f5f2f0;}
.faq-table-of-contents-title{
margin-bottom: 5px;
}
#chatcontainer {
display: initial!important;
z-index: 2147483647;
position: fixed!important;
bottom: 5px!important;
right: 5px!important;
background-color: #fff;
border: 1px;
border-style: solid;
border-color: #ccc;
}
.wc-message-pane {
background-color: #005ba5;
}
#bot > div > div > div.wc-message-pane > div.wc-message-groups > div > div:nth-child(1) > div.wc-message.wc-message-from-me
{
background-color: #005ba5!important;
}
\ No newline at end of file
$(document).ready(function() {
// Start writing your custom functions here.
// All the necessary pluigns are already loaded.
});
\ No newline at end of file
$(document).ready(function() {
$( "#chatTitleBar" ).on( "click", function() { toggleChat() } );
$( "#chatLink" ).on( "click", function() { toggleChat() } );
});
function toggleChat() {
var height = $( "#chatcontainer" ).height();
$( "#chatcontainer" ).height(height == '600' ? '32px' : '600px');
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment