From 403c73fc83d7354afca0fb406a58288fdb50a53e Mon Sep 17 00:00:00 2001 From: "Peter.Morton" Date: Wed, 20 Aug 2025 09:30:17 -0500 Subject: [PATCH] moving copilot work under common folder and adding _studio_dependencies --- .../ProxyScript/copilot.js | 57 ++++++++++++++++++ .../copilot-extension}/README.md | 0 .../copilot-extension}/images/icon-128.png | Bin .../copilot-extension}/images/icon-16.png | Bin .../copilot-extension}/images/icon-32.png | Bin .../copilot-extension}/images/icon-48.png | Bin .../copilot-extension}/manifest.json | 0 .../copilot-extension}/service-worker.js | 0 .../src/pages/panel/panel.css | 0 .../src/pages/side-panel/index.html | 0 10 files changed, 57 insertions(+) create mode 100644 copilot/_studio_dependencies/ProxyScript/copilot.js rename {copilot-extension => copilot/copilot-extension}/README.md (100%) rename {copilot-extension => copilot/copilot-extension}/images/icon-128.png (100%) rename {copilot-extension => copilot/copilot-extension}/images/icon-16.png (100%) rename {copilot-extension => copilot/copilot-extension}/images/icon-32.png (100%) rename {copilot-extension => copilot/copilot-extension}/images/icon-48.png (100%) rename {copilot-extension => copilot/copilot-extension}/manifest.json (100%) rename {copilot-extension => copilot/copilot-extension}/service-worker.js (100%) rename {copilot-extension => copilot/copilot-extension}/src/pages/panel/panel.css (100%) rename {copilot-extension => copilot/copilot-extension}/src/pages/side-panel/index.html (100%) diff --git a/copilot/_studio_dependencies/ProxyScript/copilot.js b/copilot/_studio_dependencies/ProxyScript/copilot.js new file mode 100644 index 0000000..eb998bc --- /dev/null +++ b/copilot/_studio_dependencies/ProxyScript/copilot.js @@ -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: {} + }); + } +})(); \ No newline at end of file diff --git a/copilot-extension/README.md b/copilot/copilot-extension/README.md similarity index 100% rename from copilot-extension/README.md rename to copilot/copilot-extension/README.md diff --git a/copilot-extension/images/icon-128.png b/copilot/copilot-extension/images/icon-128.png similarity index 100% rename from copilot-extension/images/icon-128.png rename to copilot/copilot-extension/images/icon-128.png diff --git a/copilot-extension/images/icon-16.png b/copilot/copilot-extension/images/icon-16.png similarity index 100% rename from copilot-extension/images/icon-16.png rename to copilot/copilot-extension/images/icon-16.png diff --git a/copilot-extension/images/icon-32.png b/copilot/copilot-extension/images/icon-32.png similarity index 100% rename from copilot-extension/images/icon-32.png rename to copilot/copilot-extension/images/icon-32.png diff --git a/copilot-extension/images/icon-48.png b/copilot/copilot-extension/images/icon-48.png similarity index 100% rename from copilot-extension/images/icon-48.png rename to copilot/copilot-extension/images/icon-48.png diff --git a/copilot-extension/manifest.json b/copilot/copilot-extension/manifest.json similarity index 100% rename from copilot-extension/manifest.json rename to copilot/copilot-extension/manifest.json diff --git a/copilot-extension/service-worker.js b/copilot/copilot-extension/service-worker.js similarity index 100% rename from copilot-extension/service-worker.js rename to copilot/copilot-extension/service-worker.js diff --git a/copilot-extension/src/pages/panel/panel.css b/copilot/copilot-extension/src/pages/panel/panel.css similarity index 100% rename from copilot-extension/src/pages/panel/panel.css rename to copilot/copilot-extension/src/pages/panel/panel.css diff --git a/copilot-extension/src/pages/side-panel/index.html b/copilot/copilot-extension/src/pages/side-panel/index.html similarity index 100% rename from copilot-extension/src/pages/side-panel/index.html rename to copilot/copilot-extension/src/pages/side-panel/index.html