@tiledesk/tiledesk-tybot-connector 2.0.32 → 2.0.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "2.0.32",
3
+ "version": "2.0.33",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -252,8 +252,10 @@ class DirAiPrompt {
252
252
  error = err.response.data.detail[0]?.msg;
253
253
  } else if (err.response?.data?.detail?.answer) {
254
254
  error = err.response.data.detail.answer;
255
- } else {
255
+ } else if (err.response?.data) {
256
256
  error = JSON.stringify(err.response.data);
257
+ } else {
258
+ error = err.message || "General error executing action" // String(err);
257
259
  }
258
260
  this.logger.error("[AI Prompt] error executing action: ", error);
259
261
  if (falseIntent) {
@@ -287,10 +287,11 @@ class DirAskGPTV2 {
287
287
  }
288
288
 
289
289
  if (!action.advancedPrompt) {
290
+ const contextTemplate = contexts[model] || contexts["general"];
290
291
  if (filled_context) {
291
- json.system_context = filled_context + "\n" + contexts[model];
292
+ json.system_context = filled_context + "\n" + contextTemplate;
292
293
  } else {
293
- json.system_context = contexts[model];
294
+ json.system_context = contextTemplate;
294
295
  }
295
296
  } else {
296
297
  json.system_context = filled_context;
@@ -908,7 +908,7 @@ class TiledeskChatbotUtil {
908
908
  winston.debug("(TiledeskChatbotUtil) Adding Globals to context: ", _bot);
909
909
 
910
910
  if (_bot.attributes && _bot.attributes.globals) {
911
- winston.error("(TiledeskChatbotUtil) Got Globals: ", _bot.attributes.globals);
911
+ winston.debug("(TiledeskChatbotUtil) Got Globals: ", _bot.attributes.globals);
912
912
  _bot.attributes.globals.forEach(async (global_var) => {
913
913
  winston.error("(TiledeskChatbotUtil) Adding global: " + global_var.key + " value: " + global_var.value);
914
914
  await chatbot.addParameter(global_var.key, global_var.value);