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
@@ -1,7 +1,7 @@
---
layout: post
title: Google Dialogflow with Blazor Chat UI Component | Syncfusion
description: Checkout and learn here all about Integrate Microsoft Bot Framework with Syncfusion Blazor Chat UI component in Blazor Server App and Blazor WebAssembly App.
description: Checkout and learn here all about Integrate Google Dialogflow with Syncfusion Blazor Chat UI component in Blazor Server App and Blazor WebAssembly App.
platform: Blazor
control: Chat UI
documentation: ug
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Use the `MessageSend`event of the `SfChatUI` component to handle message exchang
Create or modify a Razor component (e.g., `Pages/Chat.razor`) to integrate the Syncfusion Chat UI with the Direct Line API:

{% tabs %}
{% highlight razor %}
{% highlight cshtml %}

@using Syncfusion.Blazor.InteractiveChat
@using Syncfusion.Blazor
Expand Down Expand Up @@ -172,7 +172,7 @@ Create or modify a Razor component (e.g., `Pages/Chat.razor`) to integrate the S

// Use JSInterop to initialize Direct Line (client-side for real-time updates)
var directLine = await JS.InvokeAsync<IJSObjectReference>("eval",
$"new BotFramework.DirectLine.DirectLine({{ token: '{data.token}' }})");
`new BotFramework.DirectLine.DirectLine({ token: '${data.token}' })`);

isConnected = true;

Expand All @@ -181,14 +181,14 @@ Create or modify a Razor component (e.g., `Pages/Chat.razor`) to integrate the S
}
catch (Exception ex)
{
await ChatUI.AddMessageAsync(new ChatMessage { Text = "Sorry, I couldnt connect to the bot.", Author = BotUserModel });
await ChatUI.AddMessageAsync(new ChatMessage { Text = "Sorry, I couldn't connect to the bot.", Author = BotUserModel });
Console.WriteLine($"Connection error: {ex.Message}");
return;
}
}

// Send message to bot via JSInterop
await JS.InvokeVoidAsync("sendToBot", /* directLine ref or global */, args.Message.Text, currentUserId);
await JS.InvokeVoidAsync("sendToBot", directLine, args.Message.Text, currentUserId);
args.Cancel = true; // Prevent default send
}

Expand Down