From 8dfbdb02b6e35d7b59dd18392bf713eae487bef0 Mon Sep 17 00:00:00 2001
From: jackfiled 
Date: Mon, 16 Oct 2023 00:10:46 +0800
Subject: [PATCH] =?UTF-8?q?add:=20=E8=AF=AD=E6=B3=95=E7=BC=96=E8=BE=91?=
 =?UTF-8?q?=E5=99=A8=E7=95=8C=E9=9D=A2=20=E8=AF=AD=E6=B3=95=E7=83=AD?=
 =?UTF-8?q?=E9=87=8D=E8=BD=BD=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 Frontend/Pages/Editor.razor                   | 78 ++++++++++++++++++-
 Frontend/Pages/Editor.razor.css               | 12 ++-
 Frontend/Pages/Index.razor                    | 17 ----
 Frontend/Shared/MainLayout.razor              |  8 +-
 Frontend/wwwroot/css/site.css                 |  3 +-
 Katheryne/ServiceCollectionExtensions.cs      |  2 +-
 .../Services/KatheryneChatRobotFactory.cs     |  3 +
 7 files changed, 100 insertions(+), 23 deletions(-)
diff --git a/Frontend/Pages/Editor.razor b/Frontend/Pages/Editor.razor
index 18d233f..9e2862a 100644
--- a/Frontend/Pages/Editor.razor
+++ b/Frontend/Pages/Editor.razor
@@ -1,19 +1,93 @@
 @page "/editor"
+@using Katheryne.Services
+@using Katheryne.Exceptions
+@inject NavigationManager Navigation
+@inject KatheryneChatRobotFactory RobotFactory
 
 
     
         
-            
+            
+                
+                    
+                        
+                    
+
+                    
+                        
+                    
+                
+            
+            
+            
+
+            
         
                 
-                
+
                 
                     
                         a.k.a 凯瑟琳
                     
                 
+
+                
+                    
+                
             
         
 
diff --git a/Frontend/wwwroot/css/site.css b/Frontend/wwwroot/css/site.css
index 53dbdcb..95ba2b0 100644
--- a/Frontend/wwwroot/css/site.css
+++ b/Frontend/wwwroot/css/site.css
@@ -32,5 +32,6 @@ body {
 }
 
 .monaco-editor-container {
-    min-height: 100%;
+    min-height: 80%;
+    margin: 5px;
 }
diff --git a/Katheryne/ServiceCollectionExtensions.cs b/Katheryne/ServiceCollectionExtensions.cs
index d97bbe8..e4bbd1c 100644
--- a/Katheryne/ServiceCollectionExtensions.cs
+++ b/Katheryne/ServiceCollectionExtensions.cs
@@ -9,6 +9,6 @@ public static class ServiceCollectionExtensions
     {
         collection.AddSingleton();
         collection.AddSingleton();
-        collection.AddScoped();
+        collection.AddSingleton();
     }
 }
\ No newline at end of file
diff --git a/Katheryne/Services/KatheryneChatRobotFactory.cs b/Katheryne/Services/KatheryneChatRobotFactory.cs
index dcfedd3..2d31c87 100644
--- a/Katheryne/Services/KatheryneChatRobotFactory.cs
+++ b/Katheryne/Services/KatheryneChatRobotFactory.cs
@@ -14,6 +14,8 @@ public class KatheryneChatRobotFactory
 
     private Grammar? _grammar;
 
+    public string GrammarText { get; private set; } = string.Empty;
+
     public KatheryneChatRobotFactory(YamlDeserializerFactory deserializerFactory,
         ILogger factoryLogger,
         ILogger robotLogger,
@@ -28,6 +30,7 @@ public class KatheryneChatRobotFactory
     public void SetGrammar(string grammarText)
     {
         _factoryLogger.LogInformation("Receive new grammar: {}.", grammarText);
+        GrammarText = grammarText;
         IDeserializer deserializer = _deserializerFactory.GetDeserializer();
 
         LexicalModel model = deserializer.Deserialize(grammarText);