Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ documentation: ug

# Speech-to-Text in ASP.NET MVC AI AssistView

The Syncfusion ASP.NET MVC AI AssistView control supports `Speech-to-Text` functionality through the browser's [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API), enabling conversion of spoken words into text using the device's microphone.
The Syncfusion ASP.NET MVC AI AssistView control integrates `Speech-to-Text` functionality through the browser's [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API). This enables the conversion of spoken words into text using the device's microphone, allowing users to interact with the AI AssistView through voice input.

## Prerequisites

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ documentation: ug

# Text-to-Speech in ASP.NET MVC AI AssistView

The Syncfusion TypeScript AI AssistView component supports `Text-to-Speech` (TTS) functionality using the browser's Web Speech API specifically using the [SpeechSynthesisUtterance](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance) interface to convert AI-generated response into spoken audio.
The Syncfusion TypeScript AI AssistView control integrates `Text-to-Speech` (TTS) functionality using the browser's Web Speech API, specifically the [SpeechSynthesisUtterance](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance) interface. This allows AI-generated responses to be converted into spoken audio, enhancing accessibility and user interaction.

## Prerequisites

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ documentation: ug

# Speech-to-Text in ASP.NET Core AI AssistView

The Syncfusion ASP.NET Core AI AssistView control supports `Speech-to-Text` functionality through the browser's [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API), enabling conversion of spoken words into text using the device's microphone.
The Syncfusion ASP.NET Core AI AssistView control integrates `Speech-to-Text` functionality through the browser's [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API). This enables the conversion of spoken words into text using the device's microphone, allowing users to interact with the AI AssistView through voice input.

## Prerequisites

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ documentation: ug

# Text-to-Speech in ASP.NET Core AI AssistView

The Syncfusion TypeScript AI AssistView component supports `Text-to-Speech` (TTS) functionality using the browser's Web Speech API specifically using the [SpeechSynthesisUtterance](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance) interface to convert AI-generated response into spoken audio.
The Syncfusion TypeScript AI AssistView control integrates `Text-to-Speech` (TTS) functionality using the browser's Web Speech API, specifically the [SpeechSynthesisUtterance](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance) interface. This allows AI-generated responses to be converted into spoken audio, enhancing accessibility and user interaction.

## Prerequisites

Expand Down
6 changes: 6 additions & 0 deletions ej2-asp-core-mvc/code-snippet/ai-assistview/speech/tts/razor
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,20 @@
var stopStreaming = false;
var currentUtterance;

// Initializes the AIAssistView component reference when created
function onCreated() {
assistObj = ej.base.getComponent(document.getElementById("aiAssistView"), "aiassistview");
}

// Handles toolbar item clicks, such as clearing the conversation on refresh
function toolbarItemClicked(args) {
if (args.item.iconCss === 'e-icons e-refresh') {
assistObj.prompts = [];
stopStreaming = true;
}
}

// Handles clicks on response toolbar items, such as copying, reading aloud, liking, or disliking the response
function onResponseToolbarItemClicked(args) {
const responseHtml = assistObj.prompts[args.dataIndex].response;
if (responseHtml) {
Expand Down Expand Up @@ -68,6 +71,7 @@
}
}

// Streams the AI response character by character to create a typing effect
async function streamResponse(response) {
let lastResponse = '';
const responseUpdateRate = 10;
Expand All @@ -85,6 +89,7 @@
}
}

// Handles prompt requests by sending them to the server API endpoint and streaming the response
function onPromptRequest(args) {
// Get antiforgery token
var tokenElement = document.querySelector('input[name="__RequestVerificationToken"]');
Expand Down Expand Up @@ -121,6 +126,7 @@
});
}

// Stops the ongoing streaming response
function stopRespondingClick() {
stopStreaming = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,20 @@
var stopStreaming = false;
var currentUtterance;

// Initializes the AIAssistView component reference when created
function onCreated() {
assistObj = ej.base.getComponent(document.getElementById("aiAssistView"), "aiassistview");
}

// Handles toolbar item clicks, such as clearing the conversation on refresh
function toolbarItemClicked(args) {
if (args.item.iconCss === 'e-icons e-refresh') {
assistObj.prompts = [];
stopStreaming = true;
}
}

// Handles clicks on response toolbar items, such as copying, reading aloud, liking, or disliking the response
function onResponseToolbarItemClicked(args) {
const responseHtml = assistObj.prompts[args.dataIndex].response;
if (responseHtml) {
Expand Down Expand Up @@ -63,7 +66,7 @@
}
}


// Streams the AI response character by character to create a typing effect
async function streamResponse(response) {
let lastResponse = '';
const responseUpdateRate = 10;
Expand All @@ -81,6 +84,7 @@
}
}

// Handles prompt requests by sending them to the server API endpoint and streaming the response
function onPromptRequest(args) {
// Get antiforgery token
var tokenElement = document.querySelector('input[name="__RequestVerificationToken"]');
Expand Down Expand Up @@ -117,6 +121,7 @@
});
}

// Stops the ongoing streaming response
function stopRespondingClick() {
stopStreaming = true;
}
Expand Down