moving copilot work under common folder and adding _studio_dependencies
This commit is contained in:
57
copilot/_studio_dependencies/ProxyScript/copilot.js
Normal file
57
copilot/_studio_dependencies/ProxyScript/copilot.js
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
Proxy Script for CoPilot integration with IVAS
|
||||
*/
|
||||
console.log({ script: "copilot", body: req.body});
|
||||
|
||||
req.body.event.metadata = _.merge(req.body.event.metadata, {
|
||||
channel: copilot_settings.channel
|
||||
});
|
||||
|
||||
const messengerUrl = `${copilot_settings.nlu.apiBaseURL}ProxyScript/run/${req.params.workspaceId}/${req.params.branch}/${copilot_settings.messengerRouteName}`;
|
||||
(async () => {
|
||||
try {
|
||||
const { data: recognizedData } = await axios({
|
||||
url: messengerUrl,
|
||||
method: "post",
|
||||
data: req.body,
|
||||
// headers: {
|
||||
// Authorization: `Bearer ${copilot_settings.ops.token}`
|
||||
// }
|
||||
});
|
||||
res.send(recognizedData);
|
||||
} catch (error) {
|
||||
console.log(error.message);
|
||||
res.send({
|
||||
answers: ['Something went wrong. Please try again.'],
|
||||
outputs: {}
|
||||
});
|
||||
}
|
||||
})();/*
|
||||
Proxy Script for CoPilot integration with IVAS
|
||||
*/
|
||||
console.log({ script: "copilot", body: req.body});
|
||||
|
||||
req.body.event.metadata = _.merge(req.body.event.metadata, {
|
||||
channel: copilot_settings.channel
|
||||
});
|
||||
|
||||
const messengerUrl = `${copilot_settings.nlu.apiBaseURL}ProxyScript/run/${req.params.workspaceId}/${req.params.branch}/${copilot_settings.messengerRouteName}`;
|
||||
(async () => {
|
||||
try {
|
||||
const { data: recognizedData } = await axios({
|
||||
url: messengerUrl,
|
||||
method: "post",
|
||||
data: req.body,
|
||||
// headers: {
|
||||
// Authorization: `Bearer ${copilot_settings.ops.token}`
|
||||
// }
|
||||
});
|
||||
res.send(recognizedData);
|
||||
} catch (error) {
|
||||
console.log(error.message);
|
||||
res.send({
|
||||
answers: ['Something went wrong. Please try again.'],
|
||||
outputs: {}
|
||||
});
|
||||
}
|
||||
})();
|
||||
14
copilot/copilot-extension/README.md
Normal file
14
copilot/copilot-extension/README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Chrome Browser Extension
|
||||
|
||||
This is an example Chrome Browser Extension for adding CopilotUX as a side-panel extension.
|
||||
|
||||
## Configuration
|
||||
|
||||
1. Load the extension into Chrome. As this is in development, this extension needs to be loaded by using the 'Load unpacked' method.
|
||||
|
||||
## Known Issues / Limitations
|
||||
|
||||
1. We are using an iframe inside the extension - this should be done without using an iframe if doing for real.
|
||||
1. You need to be logged in via SSO 1st in the main browser because verint auth refuses to run in an iframe.
|
||||
1. The whole copilot resets each time you close and reopen the extension... which actually has the interesting side effect of giving us a quick way to reset the copilot between calls
|
||||
|
||||
BIN
copilot/copilot-extension/images/icon-128.png
Normal file
BIN
copilot/copilot-extension/images/icon-128.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
BIN
copilot/copilot-extension/images/icon-16.png
Normal file
BIN
copilot/copilot-extension/images/icon-16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 533 B |
BIN
copilot/copilot-extension/images/icon-32.png
Normal file
BIN
copilot/copilot-extension/images/icon-32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 961 B |
BIN
copilot/copilot-extension/images/icon-48.png
Normal file
BIN
copilot/copilot-extension/images/icon-48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
35
copilot/copilot-extension/manifest.json
Normal file
35
copilot/copilot-extension/manifest.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "Verint Copilot",
|
||||
"description": "Verint Copilot Side-panel Extension",
|
||||
"version": "1.0",
|
||||
"manifest_version": 3,
|
||||
"background": {
|
||||
"service_worker": "service-worker.js"
|
||||
},
|
||||
"side_panel": {
|
||||
"default_path": "src/pages/side-panel/index.html"
|
||||
},
|
||||
"permissions": ["sidePanel", "tabs"],
|
||||
"content_security_policy": {
|
||||
"extension_pages": "script-src 'self'; object-src 'self'"
|
||||
},
|
||||
"icons": {
|
||||
"16": "images/icon-16.png",
|
||||
"32": "images/icon-32.png",
|
||||
"48": "images/icon-48.png",
|
||||
"128": "images/icon-128.png"
|
||||
},
|
||||
"web_accessible_resources": [
|
||||
{
|
||||
"matches": ["*://*/*"],
|
||||
"resources": [
|
||||
"assets/js/*.js",
|
||||
"assets/css/*.css",
|
||||
"assets/svg/*.svg",
|
||||
"assets/png/*.png",
|
||||
"icon.svg",
|
||||
"blob/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
4
copilot/copilot-extension/service-worker.js
Normal file
4
copilot/copilot-extension/service-worker.js
Normal file
@@ -0,0 +1,4 @@
|
||||
// Allows users to open the side panel by clicking on the action toolbar icon
|
||||
chrome.sidePanel
|
||||
.setPanelBehavior({ openPanelOnActionClick: true })
|
||||
.catch((error) => console.error(error));
|
||||
6
copilot/copilot-extension/src/pages/panel/panel.css
Normal file
6
copilot/copilot-extension/src/pages/panel/panel.css
Normal file
@@ -0,0 +1,6 @@
|
||||
body, html {width: 100%; height: 100%; margin: 0; padding: 0}
|
||||
iframe{
|
||||
position:absolute;
|
||||
width:100%;
|
||||
height:100%;
|
||||
}
|
||||
17
copilot/copilot-extension/src/pages/side-panel/index.html
Normal file
17
copilot/copilot-extension/src/pages/side-panel/index.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<script src="/src/pages/panel/index.js"></script>
|
||||
<link rel="stylesheet" href="/src/pages/panel/panel.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<iframe src="https://copilot.usw2.integration.platform.verint.com/"></iframe>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user