API for Speech to Text conversion
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2024 03:29 PM
Hi All,
We want to convert speech to text and use the data to create knowledge articles. Are there any API's we can utilize for this process? Is there any Azure API?
Thanks!
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Pramod,
You can create an OnLoad client script on table kb_knowledge using below script which would create a button next to the OOB fields mentioned at bottom, you can amend the code as per your requirements...
function addVoiceButton(fieldName) {
var field = g_form.getControl(fieldName);
if (!field) return;
// Prevent adding multiple buttons
if (field.nextSibling && field.nextSibling.classList && field.nextSibling.classList.contains('voice-record-btn')) {
return;
}
var recordBtn = document.createElement('button');
recordBtn.type = 'button';
recordBtn.innerHTML = '🎙️';
recordBtn.title = 'Voice to Text';
recordBtn.className = 'voice-record-btn';
recordBtn.style.marginLeft = '10px';
recordBtn.style.fontSize = '1.6rem';
recordBtn.style.cursor = 'pointer';
recordBtn.onclick = function() {
if (!('webkitSpeechRecognition' in window)) {
alert('Speech recognition not supported in this browser.');
return;
}
var recognition = new webkitSpeechRecognition();
recognition.continuous = false;
recognition.interimResults = false;
recognition.lang = 'en-US';
recognition.onresult = function(event) {
if (event.results.length > 0) {
var transcript = event.results[0][0].transcript;
// Insert transcript at cursor position
var start = field.selectionStart;
var end = field.selectionEnd;
var value = field.value;
field.value = value.substring(0, start) + transcript + value.substring(end);
g_form.setValue(fieldName, field.value);
field.selectionStart = field.selectionEnd = start + transcript.length;
field.focus();
}
};
recognition.onerror = function(event) {
alert('Speech recognition error: ' + event.error);
};
recognition.start();
};
field.insertAdjacentElement('afterend', recordBtn);
}
function onLoad() {
addVoiceButton('description');
addVoiceButton('short_description');
}
onLoad();
Mark this as helpful.
Thanks
Siddarth
