node-red-contrib-knx-ultimate 6.3.25 → 6.3.26

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.
@@ -0,0 +1,475 @@
1
+ const path = require('path')
2
+
3
+ const KNX_AI_TELEGRAM_VOICE_MAX_BYTES = 20 * 1024 * 1024
4
+ const KNX_AI_TELEGRAM_VOICE_MAX_DURATION_SECONDS = 5 * 60
5
+ const KNX_AI_VOICE_API_TIMEOUT_MS = 120000
6
+ const KNX_AI_VOICE_TRANSCRIPTION_MODEL = 'gpt-4o-mini-transcribe'
7
+ const KNX_AI_VOICE_SPEECH_MODEL = 'gpt-4o-mini-tts'
8
+ const KNX_AI_VOICE_SPEECH_VOICE = 'alloy'
9
+ const KNX_AI_VOICE_SPEECH_MAX_CHARS = 4096
10
+ const KNX_AI_VOICE_DEFAULT_BASE_URL = 'https://api.openai.com/v1'
11
+
12
+ const normalizeKnxAiLlmProvider = (value) => {
13
+ const normalized = String(value || '').trim().toLowerCase().replace(/[ -]+/g, '_')
14
+ if (!normalized || normalized === 'openai' || normalized === 'openai_compatible') return 'openai_compat'
15
+ return normalized
16
+ }
17
+
18
+ const isKnxAiOpenAiCompatibleChatProvider = (value) => {
19
+ const provider = normalizeKnxAiLlmProvider(value)
20
+ return provider === 'openai_compat'
21
+ }
22
+
23
+ const resolveKnxAiVoiceServiceConfig = ({
24
+ chatProvider,
25
+ chatBaseUrl,
26
+ chatApiKey
27
+ } = {}) => {
28
+ const provider = normalizeKnxAiLlmProvider(chatProvider)
29
+ const chatCompatible = isKnxAiOpenAiCompatibleChatProvider(provider)
30
+
31
+ return {
32
+ apiKey: chatCompatible ? String(chatApiKey || '').trim() : '',
33
+ baseUrl: chatCompatible ? (String(chatBaseUrl || '').trim() || KNX_AI_VOICE_DEFAULT_BASE_URL) : '',
34
+ chatCompatible,
35
+ chatProvider: provider,
36
+ source: chatCompatible ? 'chat' : 'unconfigured',
37
+ speechModel: KNX_AI_VOICE_SPEECH_MODEL,
38
+ speechVoice: KNX_AI_VOICE_SPEECH_VOICE,
39
+ transcriptionModel: KNX_AI_VOICE_TRANSCRIPTION_MODEL
40
+ }
41
+ }
42
+
43
+ const isOfficialOpenAiVoiceUrl = (value) => {
44
+ try {
45
+ const parsed = new URL(String(value || '').trim())
46
+ const hostname = parsed.hostname.toLowerCase()
47
+ return parsed.protocol === 'https:' && (hostname === 'api.openai.com' || hostname.endsWith('.api.openai.com'))
48
+ } catch (error) {
49
+ return false
50
+ }
51
+ }
52
+
53
+ const normalizeVoiceMediaType = (value) => {
54
+ const normalized = String(value || '').split(';')[0].trim().toLowerCase()
55
+ return normalized.startsWith('audio/') ? normalized : 'audio/ogg'
56
+ }
57
+
58
+ const extensionForVoiceMediaType = (mediaType) => {
59
+ const normalized = normalizeVoiceMediaType(mediaType)
60
+ if (normalized === 'audio/mpeg' || normalized === 'audio/mp3') return '.mp3'
61
+ if (normalized === 'audio/mp4' || normalized === 'audio/m4a' || normalized === 'audio/x-m4a') return '.m4a'
62
+ if (normalized === 'audio/wav' || normalized === 'audio/x-wav') return '.wav'
63
+ if (normalized === 'audio/webm') return '.webm'
64
+ return '.ogg'
65
+ }
66
+
67
+ const sanitizeVoiceFilename = ({ filename, mediaType, fallback = 'telegram-voice' } = {}) => {
68
+ const source = path.basename(String(filename || '').trim()).replace(/[^a-zA-Z0-9._-]/g, '-')
69
+ if (source) return source.slice(0, 240)
70
+ return `${fallback}${extensionForVoiceMediaType(mediaType)}`
71
+ }
72
+
73
+ const getAiVoiceDisclosure = (language) => {
74
+ const normalized = String(language || '').trim().toLowerCase().split(/[-_]/)[0]
75
+ const labels = {
76
+ de: 'KI-generierte Stimme',
77
+ en: 'AI-generated voice',
78
+ es: 'Voz generada por IA',
79
+ fr: 'Voix générée par l’IA',
80
+ it: 'Voce generata dall’IA',
81
+ zh: 'AI 生成的语音'
82
+ }
83
+ return labels[normalized] || labels.en
84
+ }
85
+
86
+ const deriveOpenAiCompatibleAudioUrl = (baseUrl, resource = 'transcriptions') => {
87
+ const resourceName = String(resource || '').trim().toLowerCase()
88
+ if (resourceName !== 'transcriptions' && resourceName !== 'speech') {
89
+ throw new Error(`Unsupported OpenAI audio resource '${resourceName}'`)
90
+ }
91
+ let parsed
92
+ try {
93
+ parsed = new URL(String(baseUrl || 'https://api.openai.com/v1/chat/completions').trim())
94
+ } catch (error) {
95
+ throw new Error('Invalid OpenAI-compatible base URL for voice processing')
96
+ }
97
+ if (parsed.username || parsed.password) throw new Error('OpenAI-compatible voice URL must not contain credentials')
98
+ const pathname = parsed.pathname.replace(/\/+$/, '') || '/v1'
99
+ const terminalPaths = ['/chat/completions', '/completions', '/responses']
100
+ const terminal = terminalPaths.find(item => pathname.endsWith(item))
101
+ let apiRoot = terminal ? pathname.slice(0, -terminal.length) : pathname
102
+ if (!terminal && !/\/v1$/i.test(apiRoot)) {
103
+ const versionIndex = apiRoot.toLowerCase().lastIndexOf('/v1/')
104
+ if (versionIndex >= 0) apiRoot = apiRoot.slice(0, versionIndex + 3)
105
+ }
106
+ parsed.pathname = `${apiRoot.replace(/\/+$/, '')}/audio/${resourceName}`
107
+ parsed.hash = ''
108
+ return parsed.toString()
109
+ }
110
+
111
+ const findTelegramVoiceMetadata = (message) => {
112
+ const source = message && typeof message === 'object' ? message : {}
113
+ const original = source.originalMessage && typeof source.originalMessage === 'object'
114
+ ? source.originalMessage
115
+ : {}
116
+ if (original.voice && typeof original.voice === 'object') return original.voice
117
+ if (original.message && original.message.voice && typeof original.message.voice === 'object') return original.message.voice
118
+ return {}
119
+ }
120
+
121
+ const resolveTelegramVoiceAllowedOrigin = (message) => {
122
+ const details = message && message.telegramBot && typeof message.telegramBot === 'object'
123
+ ? message.telegramBot
124
+ : {}
125
+ const candidate = String(details.baseApiUrl || details.baseapiurl || details.baseApiURL || '').trim()
126
+ if (!candidate) return 'https://api.telegram.org'
127
+ try { return new URL(candidate).origin } catch (error) { return 'https://api.telegram.org' }
128
+ }
129
+
130
+ const applyKnxAiTelegramVoiceInputPresetFallback = ({ preset, message } = {}) => {
131
+ if (String(preset || '') !== 'windkh-telegrambot' || !message || typeof message !== 'object') return null
132
+ const telegram = message.payload && typeof message.payload === 'object' ? message.payload : null
133
+ if (!telegram || telegram.type !== 'voice') return null
134
+ const chatId = telegram.chatId
135
+ if (chatId === undefined || chatId === null || chatId === '') return null
136
+ const original = message.originalMessage && typeof message.originalMessage === 'object'
137
+ ? message.originalMessage
138
+ : {}
139
+ const voice = findTelegramVoiceMetadata(message)
140
+ const mediaType = normalizeVoiceMediaType(voice.mime_type || telegram.contentType || telegram.mimeType)
141
+ const fileId = String(telegram.content || voice.file_id || '').trim()
142
+ const weblink = String(telegram.weblink || message.weblink || '').trim()
143
+ if (!fileId && !weblink) return null
144
+
145
+ message.sessionId = String(chatId)
146
+ message.language = (original.from && original.from.language_code) ||
147
+ (original.message && original.message.from && original.message.from.language_code) ||
148
+ message.language ||
149
+ ''
150
+ message.topic = 'ask'
151
+ delete message.prompt
152
+ message.knxAi = Object.assign({}, message.knxAi, {
153
+ sessionId: String(chatId),
154
+ voiceInput: {
155
+ source: 'telegram',
156
+ originalType: 'voice',
157
+ fileId,
158
+ weblink,
159
+ allowedOrigin: resolveTelegramVoiceAllowedOrigin(message),
160
+ mediaType,
161
+ filename: sanitizeVoiceFilename({ filename: telegram.filename || voice.file_name, mediaType }),
162
+ durationSeconds: Math.max(0, Number(voice.duration || telegram.duration) || 0),
163
+ fileSize: Math.max(0, Number(voice.file_size || telegram.fileSize) || 0)
164
+ }
165
+ })
166
+ return message
167
+ }
168
+
169
+ const isKnxAiTelegramVoiceInput = (message) => {
170
+ const voiceInput = message && message.knxAi && message.knxAi.voiceInput
171
+ return !!(voiceInput && voiceInput.source === 'telegram' && voiceInput.originalType === 'voice')
172
+ }
173
+
174
+ const redactKnxAiTelegramVoiceLocations = (message) => {
175
+ if (!message || typeof message !== 'object') return message
176
+ if (message.payload && typeof message.payload === 'object') {
177
+ message.payload = Object.assign({}, message.payload)
178
+ delete message.payload.weblink
179
+ delete message.payload.path
180
+ }
181
+ delete message.weblink
182
+ delete message.path
183
+ if (message.knxAi && message.knxAi.voiceInput && typeof message.knxAi.voiceInput === 'object') {
184
+ const voiceInput = Object.assign({}, message.knxAi.voiceInput)
185
+ delete voiceInput.weblink
186
+ delete voiceInput.path
187
+ message.knxAi = Object.assign({}, message.knxAi, { voiceInput })
188
+ }
189
+ return message
190
+ }
191
+
192
+ const responseHeader = (response, name) => {
193
+ if (!response || !response.headers) return ''
194
+ if (typeof response.headers.get === 'function') return String(response.headers.get(name) || '')
195
+ const normalizedName = String(name || '').toLowerCase()
196
+ const entry = Object.entries(response.headers).find(([key]) => String(key).toLowerCase() === normalizedName)
197
+ return entry ? String(entry[1] || '') : ''
198
+ }
199
+
200
+ const readBoundedResponseBuffer = async (response, maxBytes) => {
201
+ const limit = Math.max(1, Number(maxBytes) || KNX_AI_TELEGRAM_VOICE_MAX_BYTES)
202
+ const declaredLength = Number(responseHeader(response, 'content-length'))
203
+ if (Number.isFinite(declaredLength) && declaredLength > limit) {
204
+ throw new Error(`Voice audio exceeds the ${Math.round(limit / (1024 * 1024))} MB limit`)
205
+ }
206
+ if (response && response.body && typeof response.body.getReader === 'function') {
207
+ const reader = response.body.getReader()
208
+ const chunks = []
209
+ let total = 0
210
+ try {
211
+ while (true) {
212
+ const part = await reader.read()
213
+ if (part.done) break
214
+ const chunk = Buffer.from(part.value)
215
+ total += chunk.length
216
+ if (total > limit) {
217
+ try { await reader.cancel() } catch (error) { /* ignore */ }
218
+ throw new Error(`Voice audio exceeds the ${Math.round(limit / (1024 * 1024))} MB limit`)
219
+ }
220
+ chunks.push(chunk)
221
+ }
222
+ } finally {
223
+ try { reader.releaseLock() } catch (error) { /* ignore */ }
224
+ }
225
+ return Buffer.concat(chunks, total)
226
+ }
227
+ if (!response || typeof response.arrayBuffer !== 'function') throw new Error('Voice download returned no audio data')
228
+ const data = Buffer.from(await response.arrayBuffer())
229
+ if (data.length > limit) throw new Error(`Voice audio exceeds the ${Math.round(limit / (1024 * 1024))} MB limit`)
230
+ return data
231
+ }
232
+
233
+ const extractAudioApiError = (text) => {
234
+ const raw = String(text || '').trim()
235
+ if (!raw) return ''
236
+ try {
237
+ const json = JSON.parse(raw)
238
+ const candidate = json && json.error && json.error.message
239
+ ? json.error.message
240
+ : json && (json.message || json.detail || json.error)
241
+ if (candidate) return String(candidate).replace(/\s+/g, ' ').trim().slice(0, 1200)
242
+ } catch (error) { /* use response text */ }
243
+ return raw.replace(/\s+/g, ' ').slice(0, 1200)
244
+ }
245
+
246
+ const fetchKnxAiTelegramVoice = async ({
247
+ voiceInput,
248
+ fetchImpl = globalThis.fetch,
249
+ timeoutMs = KNX_AI_VOICE_API_TIMEOUT_MS,
250
+ maxBytes = KNX_AI_TELEGRAM_VOICE_MAX_BYTES
251
+ } = {}) => {
252
+ const source = voiceInput && typeof voiceInput === 'object' ? voiceInput : {}
253
+ const declaredSize = Math.max(0, Number(source.fileSize) || 0)
254
+ if (declaredSize > maxBytes) throw new Error(`Voice audio exceeds the ${Math.round(maxBytes / (1024 * 1024))} MB limit`)
255
+ const declaredDuration = Math.max(0, Number(source.durationSeconds) || 0)
256
+ if (declaredDuration > KNX_AI_TELEGRAM_VOICE_MAX_DURATION_SECONDS) {
257
+ throw new Error(`Voice message exceeds the ${Math.round(KNX_AI_TELEGRAM_VOICE_MAX_DURATION_SECONDS / 60)}-minute limit`)
258
+ }
259
+ const mediaType = normalizeVoiceMediaType(source.mediaType)
260
+ const filename = sanitizeVoiceFilename({ filename: source.filename, mediaType })
261
+ const weblink = String(source.weblink || '').trim()
262
+ if (weblink) {
263
+ let parsed
264
+ try {
265
+ parsed = new URL(weblink)
266
+ } catch (error) {
267
+ throw new Error('Telegram returned an invalid voice download link')
268
+ }
269
+ if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {
270
+ throw new Error('Telegram voice download link must use HTTP or HTTPS')
271
+ }
272
+ if (parsed.username || parsed.password) throw new Error('Telegram voice download link must not contain credentials')
273
+ const allowedOrigin = String(source.allowedOrigin || 'https://api.telegram.org').trim()
274
+ if (parsed.origin !== allowedOrigin) throw new Error('Telegram voice download link has an unexpected origin')
275
+ if (typeof fetchImpl !== 'function') throw new Error('Voice download is unavailable in this Node.js runtime')
276
+ const controller = new AbortController()
277
+ const timer = setTimeout(() => controller.abort(), Math.max(1000, Number(timeoutMs) || KNX_AI_VOICE_API_TIMEOUT_MS))
278
+ try {
279
+ let response
280
+ try {
281
+ response = await fetchImpl(parsed.toString(), { signal: controller.signal, redirect: 'manual' })
282
+ } catch (error) {
283
+ if (error && error.name === 'AbortError') throw new Error('Telegram voice download timed out')
284
+ throw new Error('Telegram voice download failed (network error)')
285
+ }
286
+ if (!response || !response.ok) {
287
+ const status = response && response.status ? `HTTP ${response.status}` : 'network error'
288
+ throw new Error(`Telegram voice download failed (${status})`)
289
+ }
290
+ const data = await readBoundedResponseBuffer(response, maxBytes)
291
+ if (!data.length) throw new Error('Telegram returned an empty voice message')
292
+ return {
293
+ data,
294
+ mediaType: normalizeVoiceMediaType(responseHeader(response, 'content-type') || mediaType),
295
+ filename,
296
+ source: 'telegram-weblink'
297
+ }
298
+ } finally {
299
+ clearTimeout(timer)
300
+ }
301
+ }
302
+
303
+ throw new Error('Telegram did not provide a downloadable voice link')
304
+ }
305
+
306
+ const postKnxAiVoiceTranscription = async ({
307
+ url,
308
+ apiKey,
309
+ audio,
310
+ model = KNX_AI_VOICE_TRANSCRIPTION_MODEL,
311
+ language = '',
312
+ fetchImpl = globalThis.fetch,
313
+ timeoutMs = KNX_AI_VOICE_API_TIMEOUT_MS
314
+ } = {}) => {
315
+ if (!audio || !Buffer.isBuffer(audio.data) || !audio.data.length) throw new Error('Missing voice audio to transcribe')
316
+ if (typeof fetchImpl !== 'function' || typeof globalThis.FormData !== 'function' || typeof globalThis.Blob !== 'function') {
317
+ throw new Error('Voice transcription requires Node.js FormData support')
318
+ }
319
+ const form = new globalThis.FormData()
320
+ form.append('file', new globalThis.Blob([audio.data], { type: normalizeVoiceMediaType(audio.mediaType) }), sanitizeVoiceFilename(audio))
321
+ form.append('model', String(model || KNX_AI_VOICE_TRANSCRIPTION_MODEL))
322
+ const normalizedLanguage = String(language || '').trim().toLowerCase().split(/[-_]/)[0]
323
+ if (/^[a-z]{2,3}$/.test(normalizedLanguage)) form.append('language', normalizedLanguage)
324
+ const controller = new AbortController()
325
+ const timer = setTimeout(() => controller.abort(), Math.max(1000, Number(timeoutMs) || KNX_AI_VOICE_API_TIMEOUT_MS))
326
+ try {
327
+ let response
328
+ try {
329
+ response = await fetchImpl(url, {
330
+ method: 'POST',
331
+ headers: apiKey ? { authorization: `Bearer ${apiKey}` } : {},
332
+ body: form,
333
+ signal: controller.signal
334
+ })
335
+ } catch (error) {
336
+ if (error && error.name === 'AbortError') throw new Error('Voice transcription timed out')
337
+ throw new Error('Voice transcription failed (network error)')
338
+ }
339
+ const text = await response.text()
340
+ if (!response.ok) {
341
+ const detail = extractAudioApiError(text)
342
+ throw new Error(detail ? `Voice transcription failed (HTTP ${response.status}: ${detail})` : `Voice transcription failed (HTTP ${response.status})`)
343
+ }
344
+ let json
345
+ try { json = JSON.parse(text) } catch (error) { json = null }
346
+ const transcript = String(json && json.text !== undefined ? json.text : text).trim()
347
+ if (!transcript) throw new Error('Voice transcription returned no text')
348
+ return { text: transcript, model: String(model || KNX_AI_VOICE_TRANSCRIPTION_MODEL) }
349
+ } finally {
350
+ clearTimeout(timer)
351
+ }
352
+ }
353
+
354
+ const postKnxAiVoiceSpeech = async ({
355
+ url,
356
+ apiKey,
357
+ text,
358
+ model = KNX_AI_VOICE_SPEECH_MODEL,
359
+ voice = KNX_AI_VOICE_SPEECH_VOICE,
360
+ fetchImpl = globalThis.fetch,
361
+ timeoutMs = KNX_AI_VOICE_API_TIMEOUT_MS,
362
+ maxBytes = KNX_AI_TELEGRAM_VOICE_MAX_BYTES
363
+ } = {}) => {
364
+ const input = String(text === undefined || text === null ? '' : text).trim()
365
+ if (!input) throw new Error('Missing text for voice reply')
366
+ if (input.length > KNX_AI_VOICE_SPEECH_MAX_CHARS) {
367
+ throw new Error(`Voice reply exceeds the ${KNX_AI_VOICE_SPEECH_MAX_CHARS}-character speech limit`)
368
+ }
369
+ if (typeof fetchImpl !== 'function') throw new Error('Voice synthesis is unavailable in this Node.js runtime')
370
+ const controller = new AbortController()
371
+ const timer = setTimeout(() => controller.abort(), Math.max(1000, Number(timeoutMs) || KNX_AI_VOICE_API_TIMEOUT_MS))
372
+ try {
373
+ let response
374
+ try {
375
+ response = await fetchImpl(url, {
376
+ method: 'POST',
377
+ headers: Object.assign(
378
+ { 'content-type': 'application/json' },
379
+ apiKey ? { authorization: `Bearer ${apiKey}` } : {}
380
+ ),
381
+ body: JSON.stringify({
382
+ model: String(model || KNX_AI_VOICE_SPEECH_MODEL),
383
+ voice: String(voice || KNX_AI_VOICE_SPEECH_VOICE),
384
+ input,
385
+ response_format: 'opus'
386
+ }),
387
+ signal: controller.signal
388
+ })
389
+ } catch (error) {
390
+ if (error && error.name === 'AbortError') throw new Error('Voice synthesis timed out')
391
+ throw new Error('Voice synthesis failed (network error)')
392
+ }
393
+ if (!response.ok) {
394
+ const detail = extractAudioApiError(await response.text())
395
+ throw new Error(detail ? `Voice synthesis failed (HTTP ${response.status}: ${detail})` : `Voice synthesis failed (HTTP ${response.status})`)
396
+ }
397
+ const data = await readBoundedResponseBuffer(response, maxBytes)
398
+ if (!data.length) throw new Error('Voice synthesis returned no audio')
399
+ return {
400
+ data,
401
+ mediaType: 'audio/ogg',
402
+ filename: 'knx-ai-reply.ogg',
403
+ model: String(model || KNX_AI_VOICE_SPEECH_MODEL),
404
+ voice: String(voice || KNX_AI_VOICE_SPEECH_VOICE)
405
+ }
406
+ } finally {
407
+ clearTimeout(timer)
408
+ }
409
+ }
410
+
411
+ const applyKnxAiTelegramVoiceOutputPresetFallback = ({ preset, message, inputMessage } = {}) => {
412
+ if (String(preset || '') !== 'windkh-telegrambot' || !message || typeof message !== 'object') return message
413
+ const audio = message.knxAi && message.knxAi.audio
414
+ if (!audio || !Buffer.isBuffer(audio.data) || !audio.data.length) return message
415
+ const currentPayload = message.payload && typeof message.payload === 'object' ? message.payload : null
416
+ if (currentPayload && (currentPayload.type === 'voice' || currentPayload.type === 'photo')) return message
417
+ const source = inputMessage && typeof inputMessage === 'object'
418
+ ? inputMessage
419
+ : message.inputMessage && typeof message.inputMessage === 'object'
420
+ ? message.inputMessage
421
+ : message
422
+ const sourcePayload = source.payload && typeof source.payload === 'object' ? source.payload : {}
423
+ const chatId = currentPayload && currentPayload.chatId !== undefined
424
+ ? currentPayload.chatId
425
+ : sourcePayload.chatId !== undefined
426
+ ? sourcePayload.chatId
427
+ : source.chatId
428
+ if (chatId === undefined || chatId === null || chatId === '') return message
429
+ let caption = currentPayload ? currentPayload.content : message.payload
430
+ if (caption && typeof caption === 'object') caption = caption.error || caption.message || ''
431
+ const language = message.knxAi && message.knxAi.language
432
+ ? message.knxAi.language
433
+ : source.language
434
+ caption = [getAiVoiceDisclosure(language), String(caption === undefined || caption === null ? '' : caption)]
435
+ .filter(Boolean)
436
+ .join('\n')
437
+ .slice(0, 1024)
438
+ const options = Object.assign({}, currentPayload && currentPayload.options ? currentPayload.options : {})
439
+ if (caption) options.caption = caption
440
+ message.payload = {
441
+ chatId,
442
+ type: 'voice',
443
+ content: audio.data,
444
+ options,
445
+ fileOptions: {
446
+ filename: sanitizeVoiceFilename({ filename: audio.filename, mediaType: audio.mediaType, fallback: 'knx-ai-reply' }),
447
+ contentType: normalizeVoiceMediaType(audio.mediaType)
448
+ }
449
+ }
450
+ return message
451
+ }
452
+
453
+ module.exports = {
454
+ KNX_AI_TELEGRAM_VOICE_MAX_BYTES,
455
+ KNX_AI_TELEGRAM_VOICE_MAX_DURATION_SECONDS,
456
+ KNX_AI_VOICE_API_TIMEOUT_MS,
457
+ KNX_AI_VOICE_DEFAULT_BASE_URL,
458
+ KNX_AI_VOICE_SPEECH_MAX_CHARS,
459
+ KNX_AI_VOICE_SPEECH_MODEL,
460
+ KNX_AI_VOICE_SPEECH_VOICE,
461
+ KNX_AI_VOICE_TRANSCRIPTION_MODEL,
462
+ applyKnxAiTelegramVoiceInputPresetFallback,
463
+ applyKnxAiTelegramVoiceOutputPresetFallback,
464
+ deriveOpenAiCompatibleAudioUrl,
465
+ fetchKnxAiTelegramVoice,
466
+ isKnxAiOpenAiCompatibleChatProvider,
467
+ isKnxAiTelegramVoiceInput,
468
+ isOfficialOpenAiVoiceUrl,
469
+ normalizeKnxAiLlmProvider,
470
+ postKnxAiVoiceSpeech,
471
+ postKnxAiVoiceTranscription,
472
+ readBoundedResponseBuffer,
473
+ redactKnxAiTelegramVoiceLocations,
474
+ resolveKnxAiVoiceServiceConfig
475
+ }