node-red-contrib-knx-ultimate 6.3.21 → 6.3.24
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 +24 -0
- package/examples/KNX AI - Telegrambot Direct Chat.json +1 -17
- package/nodes/knxUltimateAI.html +218 -23
- package/nodes/knxUltimateAI.js +930 -244
- package/nodes/locales/de/knxUltimateAI.html +28 -8
- package/nodes/locales/de/knxUltimateAI.json +24 -4
- package/nodes/locales/en/knxUltimateAI.html +28 -8
- package/nodes/locales/en/knxUltimateAI.json +24 -4
- package/nodes/locales/es/knxUltimateAI.html +28 -8
- package/nodes/locales/es/knxUltimateAI.json +24 -4
- package/nodes/locales/fr/knxUltimateAI.html +28 -8
- package/nodes/locales/fr/knxUltimateAI.json +24 -4
- package/nodes/locales/it/knxUltimateAI.html +28 -8
- package/nodes/locales/it/knxUltimateAI.json +24 -4
- package/nodes/locales/zh-CN/knxUltimateAI.html +28 -8
- package/nodes/locales/zh-CN/knxUltimateAI.json +24 -4
- package/nodes/plugins/knxUltimateAI-vue/assets/app.css +1 -1
- package/nodes/plugins/knxUltimateAI-vue/assets/app.js +4 -4
- package/nodes/utils/knxAiChatContext.js +181 -84
- package/nodes/utils/knxAiEventHistory.js +275 -0
- package/package.json +1 -1
- package/resources/KNXAIChatAdapterMappings.js +14 -12
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
id: 'windkh-telegrambot',
|
|
5
5
|
title: 'windkh/node-red-contrib-telegrambot',
|
|
6
6
|
inputCode: `// Receiver/Event -> KNX AI
|
|
7
|
-
// Supports "telegram receiver"
|
|
8
|
-
//
|
|
7
|
+
// Supports normal "telegram receiver" messages, including the one-time
|
|
8
|
+
// reply-keyboard confirmation buttons, plus legacy callback_query events.
|
|
9
9
|
const telegram = msg.payload;
|
|
10
10
|
if (!telegram || typeof telegram !== 'object') return;
|
|
11
11
|
|
|
@@ -33,8 +33,9 @@ msg.topic = 'ask';
|
|
|
33
33
|
msg.prompt = content;
|
|
34
34
|
return msg;`,
|
|
35
35
|
outputCode: `// KNX AI chat output -> Telegram sender
|
|
36
|
-
// Converts the text reply and, when required, adds
|
|
37
|
-
//
|
|
36
|
+
// Converts the text reply and, when required, adds a one-time reply keyboard.
|
|
37
|
+
// A button click returns through the normal Telegram receiver, so no separate
|
|
38
|
+
// callback event node is required.
|
|
38
39
|
const source = msg.inputMessage && typeof msg.inputMessage === 'object'
|
|
39
40
|
? msg.inputMessage
|
|
40
41
|
: inputMessage;
|
|
@@ -78,16 +79,17 @@ const confirmation = msg.knxAi && msg.knxAi.confirmationRequest;
|
|
|
78
79
|
if (confirmation && confirmation.required === true && Array.isArray(confirmation.actions)) {
|
|
79
80
|
telegramPayload.options = {
|
|
80
81
|
reply_markup: JSON.stringify({
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
};
|
|
87
|
-
})
|
|
88
|
-
]
|
|
82
|
+
keyboard: [confirmation.actions.map(function (action) {
|
|
83
|
+
return { text: action.label };
|
|
84
|
+
})],
|
|
85
|
+
resize_keyboard: true,
|
|
86
|
+
one_time_keyboard: true
|
|
89
87
|
})
|
|
90
88
|
};
|
|
89
|
+
} else if (msg.knxAi && (/^knx_confirmation_/.test(String(msg.knxAi.type || '')) || /^knx_routine_/.test(String(msg.knxAi.type || '')))) {
|
|
90
|
+
telegramPayload.options = {
|
|
91
|
+
reply_markup: JSON.stringify({ remove_keyboard: true })
|
|
92
|
+
};
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
msg.payload = telegramPayload;
|