@tiledesk/tiledesk-tybot-connector 2.0.29 → 2.0.30
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/ExtApi.js +0 -3
- package/engine/TiledeskChatbotConst.js +8 -1
- package/index.js +0 -9
- package/logs/app1.log +42823 -0
- package/logs/app2.log +13816 -0
- package/package.json +1 -1
- package/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +13 -2
- package/tiledeskChatbotPlugs/directives/DirAiCondition.js +535 -0
- package/tiledeskChatbotPlugs/directives/DirAiPrompt.js +44 -1
- package/tiledeskChatbotPlugs/directives/DirAskGPTV2.js +4 -1
- package/tiledeskChatbotPlugs/directives/Directives.js +1 -0
- package/utils/TiledeskChatbotUtil.js +35 -0
|
@@ -844,6 +844,25 @@ class TiledeskChatbotUtil {
|
|
|
844
844
|
await chatbot.addParameter(TiledeskChatbotConst.REQ_DEPARTMENT_NAME_KEY, message.attributes.departmentName);
|
|
845
845
|
}
|
|
846
846
|
|
|
847
|
+
if (message.attributes) {
|
|
848
|
+
const attrFields = [
|
|
849
|
+
{ key: TiledeskChatbotConst.REQ_EMAIL_SUBJECT, attr: "email_subject" },
|
|
850
|
+
{ key: TiledeskChatbotConst.REQ_EMAIL_TO, attr: "email_toEmail" },
|
|
851
|
+
{ key: TiledeskChatbotConst.REQ_EMAIL_FROM, attr: "email_fromEmail" },
|
|
852
|
+
{ key: TiledeskChatbotConst.REQ_EMAIL_MESSAGE_ID, attr: "email_messageId" },
|
|
853
|
+
{ key: TiledeskChatbotConst.REQ_EMAIL_REPLY_TO, attr: "email_replyTo" },
|
|
854
|
+
{ key: TiledeskChatbotConst.REQ_EMAIL_EML, attr: "email_eml" },
|
|
855
|
+
{ key: TiledeskChatbotConst.REQ_EMAIL_ATTACHMENTS_LINK, attr: "link" },
|
|
856
|
+
{ key: TiledeskChatbotConst.REQ_EMAIL_ATTACHMENTS_FILES, attr: "attachments" },
|
|
857
|
+
// aggiungi qui altri campi se necessario
|
|
858
|
+
];
|
|
859
|
+
for (const field of attrFields) {
|
|
860
|
+
if (message.attributes[field.attr] !== undefined && message.attributes[field.attr] !== null) {
|
|
861
|
+
await chatbot.addParameter(field.key, message.attributes[field.attr]);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
847
866
|
if (message && message.request && message.request.attributes && message.request.attributes.payload) {
|
|
848
867
|
if (!message.attributes) {
|
|
849
868
|
message.attributes = {}
|
|
@@ -1006,6 +1025,20 @@ class TiledeskChatbotUtil {
|
|
|
1006
1025
|
return userParams;
|
|
1007
1026
|
}
|
|
1008
1027
|
|
|
1028
|
+
static AiConditionPromptBuilder(prompt_header, intents, instructions) {
|
|
1029
|
+
let conditions = "";
|
|
1030
|
+
intents.forEach( function(intent) {
|
|
1031
|
+
conditions += `- label: ${intent.label} When: ${intent.prompt}\n`
|
|
1032
|
+
});
|
|
1033
|
+
|
|
1034
|
+
instructions = instructions;
|
|
1035
|
+
let raw_condition_prompt = `${prompt_header}
|
|
1036
|
+
|
|
1037
|
+
${conditions}
|
|
1038
|
+
${instructions}`
|
|
1039
|
+
return raw_condition_prompt;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1009
1042
|
/**
|
|
1010
1043
|
* A stub to get the request parameters, hosted by tilebot on:
|
|
1011
1044
|
* /${TILEBOT_ROUTE}/ext/parameters/requests/${requestId}?all
|
|
@@ -1074,6 +1107,8 @@ class TiledeskChatbotUtil {
|
|
|
1074
1107
|
}
|
|
1075
1108
|
});
|
|
1076
1109
|
}
|
|
1110
|
+
|
|
1111
|
+
|
|
1077
1112
|
|
|
1078
1113
|
|
|
1079
1114
|
}
|