From 92030729a106b1e3529ca816e605338aea5cd747 Mon Sep 17 00:00:00 2001 From: Swathi S <105411200+s-swathib@users.noreply.github.com> Date: Wed, 29 Nov 2023 13:38:59 +0000 Subject: [PATCH] Update main.js --- src/js/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/main.js b/src/js/main.js index ef675e8..3465723 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -270,8 +270,8 @@ async function greeting() { window.speak = (text) => { async function speak(text) { addToConversationHistory(text, 'dark') - const language = await getLanguageCode(text) - .then(language => language.text()) + const response = await getLanguageCode(text) + .then(response => response.text()) .then(async language => { console.log(`Detected language: ${language}`); @@ -433,7 +433,7 @@ function makeBackgroundTransparent(timestamp) { async function getLanguageCode(text) { const endpoint = "https://languagedep.cognitiveservices.azure.com/"; const subscription_key = "9be55ef15c3d401e8a2efa6140bde1e0"; - const apiUrl = '${endpoint}/text/analytics/v3.2-preview.1/languages'; + const apiUrl = 'https://languagedep.cognitiveservices.azure.com/text/analytics/v3.2-preview.1/languages'; const requestBody = {'documents': [{'id': '1','text': text}]}; fetch(apiUrl,requestBody, { method : 'POST',