From bb6ed6acfcb09240bca47daa6a0dcaef3fc2c53c Mon Sep 17 00:00:00 2001 From: jackfiled Date: Tue, 17 Oct 2023 20:10:28 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E8=BF=81=E7=A7=BB=E5=88=B0WASM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/Frontend.csproj | 4 +- Frontend/Pages/_Host.cshtml | 37 ------------------- Frontend/Program.cs | 20 ++++------ Frontend/_Imports.razor | 5 ++- Frontend/wwwroot/index.html | 29 +++++++++++++++ .../Services/KatheryneChatRobotFactory.cs | 6 +-- 6 files changed, 47 insertions(+), 54 deletions(-) delete mode 100644 Frontend/Pages/_Host.cshtml create mode 100644 Frontend/wwwroot/index.html diff --git a/Frontend/Frontend.csproj b/Frontend/Frontend.csproj index f42ff40..04570d5 100644 --- a/Frontend/Frontend.csproj +++ b/Frontend/Frontend.csproj @@ -1,4 +1,4 @@ - + net7.0 @@ -9,6 +9,8 @@ + + diff --git a/Frontend/Pages/_Host.cshtml b/Frontend/Pages/_Host.cshtml deleted file mode 100644 index afb25f3..0000000 --- a/Frontend/Pages/_Host.cshtml +++ /dev/null @@ -1,37 +0,0 @@ -锘緻page "/" -@using Microsoft.AspNetCore.Components.Web -@namespace Frontend.Pages -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers - - - - - - - - - - - - - - -
- - An error has occurred. This application may no longer respond until reloaded. - - - An unhandled exception has occurred. See browser dev tools for details. - - Reload - 馃棛 -
- - - - - - - - - \ No newline at end of file diff --git a/Frontend/Program.cs b/Frontend/Program.cs index be620f2..62ff349 100644 --- a/Frontend/Program.cs +++ b/Frontend/Program.cs @@ -1,19 +1,15 @@ +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using Katheryne; +using Frontend; -WebApplicationBuilder builder = WebApplication.CreateBuilder(args); -builder.Services.AddRazorPages(); -builder.Services.AddServerSideBlazor(); +var builder = WebAssemblyHostBuilder.CreateDefault(args); +builder.RootComponents.Add("#app"); +builder.RootComponents.Add("head::after"); builder.Services.AddAntDesign(); builder.Services.AddKatheryne(); -WebApplication app = builder.Build(); +WebAssemblyHost app = builder.Build(); -app.UseStaticFiles(); - -app.UseRouting(); - -app.MapBlazorHub(); -app.MapFallbackToPage("/_Host"); - -app.Run(); \ No newline at end of file +await app.RunAsync(); \ No newline at end of file diff --git a/Frontend/_Imports.razor b/Frontend/_Imports.razor index 628d9c2..1b80408 100644 --- a/Frontend/_Imports.razor +++ b/Frontend/_Imports.razor @@ -1,5 +1,8 @@ -锘緻using Microsoft.AspNetCore.Components.Routing +锘緻using System.Net.Http +@using System.Net.Http.Json +@using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Web +@using Microsoft.AspNetCore.Components.WebAssembly.Http @using Microsoft.JSInterop @using AntDesign @using BlazorMonaco diff --git a/Frontend/wwwroot/index.html b/Frontend/wwwroot/index.html new file mode 100644 index 0000000..19a00a5 --- /dev/null +++ b/Frontend/wwwroot/index.html @@ -0,0 +1,29 @@ + + + + + + BlazorWasmSample + + + + + + + +
Loading...
+ +
+ An unhandled error has occurred. + Reload + 馃棛 +
+ + + + + + + + + \ No newline at end of file diff --git a/Katheryne/Services/KatheryneChatRobotFactory.cs b/Katheryne/Services/KatheryneChatRobotFactory.cs index 157227d..2206bbb 100644 --- a/Katheryne/Services/KatheryneChatRobotFactory.cs +++ b/Katheryne/Services/KatheryneChatRobotFactory.cs @@ -29,10 +29,10 @@ public class KatheryneChatRobotFactory } /// - /// 设置当前机器人使用的文法 + /// 璁剧疆褰撳墠鏈哄櫒浜轰娇鐢ㄧ殑鏂囨硶 /// - /// 文法字符串 - /// 编译文法失败抛出的异常 + /// 鏂囨硶瀛楃涓 + /// 缂栬瘧鏂囨硶澶辫触鎶涘嚭鐨勫紓甯 public void SetGrammar(string grammarText) { _factoryLogger.LogInformation("Receive new grammar: {}.", grammarText);