mini-chat-bot-widget 0.9.0 → 0.11.0
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/dist/chat-widget.esm.js
CHANGED
|
@@ -1272,6 +1272,9 @@ class AudioChatScreen {
|
|
|
1272
1272
|
this.isPlaying = true;
|
|
1273
1273
|
const text = this.audioQueue.shift();
|
|
1274
1274
|
try {
|
|
1275
|
+
// Use selected language for TTS (hi for Hindi, en for English, etc.)
|
|
1276
|
+
// Bhashini will fallback to English if language is not supported
|
|
1277
|
+
console.log("TTS Language:", this.selectedLanguage);
|
|
1275
1278
|
const audioContent = await this.bhashini.textToSpeech(text, this.selectedLanguage);
|
|
1276
1279
|
if (audioContent) {
|
|
1277
1280
|
const audioSrc = "data:audio/wav;base64,".concat(audioContent);
|
|
@@ -1893,7 +1896,7 @@ class ChatWidget {
|
|
|
1893
1896
|
});
|
|
1894
1897
|
}
|
|
1895
1898
|
_renderWelcomeScreen(container) {
|
|
1896
|
-
container.innerHTML = "\n <main class=\"welcome-screen\">\n <div class=\"chat-header\">\n <div class=\"chat-header-content visible\">\n <div class=\"chat-header-text\">\n <div class=\"chat-title\">".concat(this.title, "</div>\n </div>\n </div>\n <button class=\"chat-close\" id=\"text-chat-close\">\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line>\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line>\n </svg>\n </button>\n </div>\n <div >\n <div class=\"welcome-content\">\n <div class=\"gradient-sphere-welcome-screen\">\n <div class=\"sphere-highlight\">\n </div>\n </div>\n \n <div class=\"welcome-text\">\n <p class=\"greeting\">Hello!</p>\n <p class=\"intro\">\n
|
|
1899
|
+
container.innerHTML = "\n <main class=\"welcome-screen\">\n <div class=\"chat-header\">\n <div class=\"chat-header-content visible\">\n <div class=\"chat-header-text\">\n <div class=\"chat-title\">".concat(this.title, "</div>\n </div>\n </div>\n <button class=\"chat-close\" id=\"text-chat-close\">\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line>\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line>\n </svg>\n </button>\n </div>\n <div >\n <div class=\"welcome-content\">\n <div class=\"gradient-sphere-welcome-screen\">\n <div class=\"sphere-highlight\">\n </div>\n </div>\n \n <div class=\"welcome-text\">\n <p class=\"greeting\">Hello!</p>\n <p class=\"intro\">\n This is PUCAR agent how can I help you today.\n </p>\n </div>\n \n <div class=\"action-buttons\">\n <button\n class=\"primary-button !rounded-full\"\n id=\"welcome-audio-btn\"\n >\n Let's talk ​ ​ <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-mic-icon lucide-mic\"><path d=\"M12 19v3\"/><path d=\"M19 10v2a7 7 0 0 1-14 0v-2\"/><rect x=\"9\" y=\"2\" width=\"6\" height=\"13\" rx=\"3\"/></svg>\n </button>\n </div>\n \n \n\n </div>\n </div>\n </main>\n ");
|
|
1897
1900
|
|
|
1898
1901
|
// Bind welcome screen events
|
|
1899
1902
|
// const textBtn = container.querySelector("#welcome-text-btn");
|
|
@@ -1967,6 +1970,11 @@ class ChatWidget {
|
|
|
1967
1970
|
const value = e.currentTarget.dataset.value;
|
|
1968
1971
|
this.selectedLanguage = value;
|
|
1969
1972
|
|
|
1973
|
+
// Update audio chat screen language for TTS
|
|
1974
|
+
if (this.audioChatScreen) {
|
|
1975
|
+
this.audioChatScreen.selectedLanguage = value;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1970
1978
|
// Update UI
|
|
1971
1979
|
this._updateSelectedLanguageDisplay();
|
|
1972
1980
|
optionsFn.querySelectorAll(".select-option").forEach(o => o.classList.remove("selected"));
|