Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
s-swathib authored Nov 29, 2023
1 parent 87f324a commit 9203072
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);

Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 9203072

Please sign in to comment.