|
#pragma checksum "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\Pages\Home.razor" "{8829d00f-11b8-4213-878b-770e8597ac16}" "612dc83519f23e075ec81cd280582f4f7030b6998418a1a31608c090a69ba318"
// <auto-generated/>
#pragma warning disable 1591
namespace AzureAIFoundryEndToEnd.WebStory.Components.Pages
{
#line default
using global::System;
using global::System.Collections.Generic;
using global::System.Linq;
using global::System.Threading.Tasks;
using global::Microsoft.AspNetCore.Components;
#nullable restore
#line (1,2)-(1,23) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\_Imports.razor"
using System.Net.Http
#nullable disable
;
#nullable restore
#line (2,2)-(2,28) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\_Imports.razor"
using System.Net.Http.Json
#nullable disable
;
#nullable restore
#line (3,2)-(3,45) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\_Imports.razor"
using Microsoft.AspNetCore.Components.Forms
#nullable disable
;
#nullable restore
#line (4,2)-(4,47) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\_Imports.razor"
using Microsoft.AspNetCore.Components.Routing
#nullable disable
;
#nullable restore
#line (5,2)-(5,43) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\_Imports.razor"
using Microsoft.AspNetCore.Components.Web
#nullable disable
;
#nullable restore
#line (6,2)-(6,61) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\_Imports.razor"
using static Microsoft.AspNetCore.Components.Web.RenderMode
#nullable disable
;
#nullable restore
#line (7,2)-(7,58) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\_Imports.razor"
using Microsoft.AspNetCore.Components.Web.Virtualization
#nullable disable
;
#nullable restore
#line (8,2)-(8,27) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\_Imports.razor"
using Microsoft.JSInterop
#nullable disable
;
#nullable restore
#line (9,2)-(9,39) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\_Imports.razor"
using AzureAIFoundryEndToEnd.WebStory
#nullable disable
;
#nullable restore
#line (10,2)-(10,50) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\_Imports.razor"
using AzureAIFoundryEndToEnd.WebStory.Components
#nullable disable
;
#nullable restore
#line (2,2)-(2,31) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\Pages\Home.razor"
using Microsoft.Extensions.AI
#nullable disable
;
#line default
#line hidden
[global::Microsoft.AspNetCore.Components.RouteAttribute(
// language=Route,Component
#nullable restore
#line (1,7)-(1,10) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\Pages\Home.razor"
"/"
#line default
#line hidden
#nullable disable
)]
#nullable restore
public partial class Home : global::Microsoft.AspNetCore.Components.ComponentBase
#nullable disable
{
#pragma warning disable 1998
protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
__builder.OpenElement(0, "div");
__builder.AddAttribute(1, "class", "storybox");
__builder.AddAttribute(2, "style", "margin: 25%");
#nullable restore
#line (7,1)-(7,5) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\Pages\Home.razor"
#line default
#line hidden
#nullable disable
#nullable restore
#line (7,6)-(9,1) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\Pages\Home.razor"
foreach (var message in chatMessages.Where(m => m.Role == ChatRole.Assistant))
{
#line default
#line hidden
#nullable disable
__builder.OpenElement(3, "p");
__builder.AddAttribute(4, "style", "font-size: 3em;");
#nullable restore
#line (9,37)-(9,49) 24 "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\Pages\Home.razor"
__builder.AddContent(5, message.Text
#line default
#line hidden
#nullable disable
);
__builder.CloseElement();
#nullable restore
#line (10,1)-(11,1) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\Pages\Home.razor"
}
#line default
#line hidden
#nullable disable
__builder.OpenElement(6, "button");
__builder.AddAttribute(7, "onclick", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create<global::Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this,
#nullable restore
#line (12,23)-(12,44) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\Pages\Home.razor"
GenerateNextParagraph
#line default
#line hidden
#nullable disable
));
__builder.AddAttribute(8, "autofocus");
__builder.AddContent(9, "Generate");
__builder.CloseElement();
__builder.CloseElement();
}
#pragma warning restore 1998
#nullable restore
#line (15,8)-(41,1) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\Pages\Home.razor"
private List<ChatMessage> chatMessages = new List<ChatMessage>
{
new(ChatRole.System, "Pick a random topic and write a sentence of a fictional story about it.")
};
private async Task GenerateNextParagraph()
{
chatMessages.Add(new ChatMessage(ChatRole.User, "Write the next sentence in the story."));
var response = await chatClient.GetResponseAsync(chatMessages);
var content = response.Text;
// Remove the text between <think> and </think> tags, if present
if (content.Contains("<think>") && content.Contains("</think>"))
{
content = content[..content.IndexOf("<think>")] + content[(content.IndexOf("</think>") + "</think>".Length)..].Trim();
}
chatMessages.AddMessages(new ChatResponse(new ChatMessage(ChatRole.Assistant, content)));
}
protected override async Task OnInitializedAsync()
{
await GenerateNextParagraph();
}
#line default
#line hidden
#nullable disable
[global::Microsoft.AspNetCore.Components.InjectAttribute] private
#nullable restore
#line (4,9)-(4,22) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\Pages\Home.razor"
ILogger<Home>
#line default
#line hidden
#nullable disable
#nullable restore
#line (4,23)-(4,29) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\Pages\Home.razor"
logger
#line default
#line hidden
#nullable disable
{ get; set; }
= default!;
[global::Microsoft.AspNetCore.Components.InjectAttribute] private
#nullable restore
#line (3,9)-(3,20) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\Pages\Home.razor"
IChatClient
#line default
#line hidden
#nullable disable
#nullable restore
#line (3,21)-(3,31) "D:\a\_work\1\s\playground\AzureAIFoundryEndToEnd\AzureAIFoundryEndToEnd.WebStory\Components\Pages\Home.razor"
chatClient
#line default
#line hidden
#nullable disable
{ get; set; }
= default!;
}
}
#pragma warning restore 1591
|