@tiledesk/tiledesk-tybot-connector 0.2.116 → 0.2.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/index.js
CHANGED
|
@@ -591,7 +591,7 @@ router.post('/block/:project_id/:bot_id/:block_id', async (req, res) => {
|
|
|
591
591
|
}, token: ".."
|
|
592
592
|
}
|
|
593
593
|
console.log("sendMessageToBot()...");
|
|
594
|
-
sendMessageToBot(request, bot_id, async () => {
|
|
594
|
+
sendMessageToBot(process.env.TYBOT_ENDPOINT, request, bot_id, async () => {
|
|
595
595
|
console.log("Async webhook message sent:\n", request);
|
|
596
596
|
res.status(200).send({"success":true});
|
|
597
597
|
return;
|
|
@@ -722,9 +722,12 @@ async function checkRequest(request_id, id_project) {
|
|
|
722
722
|
* @param {string} botId. Tiledesk botId
|
|
723
723
|
* @param {string} token. User token
|
|
724
724
|
*/
|
|
725
|
-
function sendMessageToBot(message, botId, callback) {
|
|
725
|
+
function sendMessageToBot(TILEBOT_ENDPOINT, message, botId, callback) {
|
|
726
726
|
// const jwt_token = this.fixToken(token);
|
|
727
|
-
|
|
727
|
+
if (!TILEBOT_ENDPOINT) {
|
|
728
|
+
TILEBOT_ENDPOINT = `${APIURL}/modules/tilebot`
|
|
729
|
+
}
|
|
730
|
+
const url = `${TILEBOT_ENDPOINT}/ext/${botId}`;
|
|
728
731
|
console.log("sendMessageToBot URL", url);
|
|
729
732
|
const HTTPREQUEST = {
|
|
730
733
|
url: url,
|
package/package.json
CHANGED
|
@@ -104,8 +104,12 @@ class DirGptTask {
|
|
|
104
104
|
TiledeskChatbotConst.REQ_TRANSCRIPT_KEY);
|
|
105
105
|
if (this.log) { console.log("DirGptTask transcript string: ", transcript_string) }
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
if (transcript_string) {
|
|
108
|
+
transcript = await TiledeskChatbotUtil.transcriptJSON(transcript_string);
|
|
109
|
+
if (this.log) { console.log("DirGptTask transcript: ", transcript) }
|
|
110
|
+
} else {
|
|
111
|
+
if (this.log) { console.log("DirGptTask transcript_string is undefined. Skip JSON translation for chat history") }
|
|
112
|
+
}
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
|