diff --git a/Frontend/Pages/Editor.razor b/Frontend/Pages/Editor.razor
index 9e2862a..dc0bec8 100644
--- a/Frontend/Pages/Editor.razor
+++ b/Frontend/Pages/Editor.razor
@@ -10,7 +10,7 @@
-
@@ -28,7 +28,9 @@
- @context
+
+ @context
+
@@ -60,7 +62,7 @@
Log("未设置文法");
grammarText = string.Empty;
}
-
+
return new StandaloneEditorConstructionOptions
{
Language = "yaml",
@@ -84,10 +86,14 @@
}
}
+ private void QuitButtontClicked()
+ {
+ Navigation.NavigateTo("/", replace: true);
+ }
+
private void Log(string message)
{
_logs.Add($"{DateTime.Now:HH:mm:ss} {message}");
StateHasChanged();
- }
-
+ }
}
\ No newline at end of file
diff --git a/Frontend/Pages/Editor.razor.css b/Frontend/Pages/Editor.razor.css
index d357ec7..d7dd876 100644
--- a/Frontend/Pages/Editor.razor.css
+++ b/Frontend/Pages/Editor.razor.css
@@ -10,4 +10,9 @@
.logging-zone {
height: 15%;
overflow-y: auto;
+ margin-bottom: 5px;
+}
+
+.logging-item {
+ padding: 0 0 0;
}
\ No newline at end of file
diff --git a/Frontend/Properties/launchSettings.json b/Frontend/Properties/launchSettings.json
index bc94732..dd9e2bc 100644
--- a/Frontend/Properties/launchSettings.json
+++ b/Frontend/Properties/launchSettings.json
@@ -11,6 +11,7 @@
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "http://localhost:5163",
+ "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
diff --git a/Katheryne/Services/KatheryneChatRobotFactory.cs b/Katheryne/Services/KatheryneChatRobotFactory.cs
index 2d31c87..157227d 100644
--- a/Katheryne/Services/KatheryneChatRobotFactory.cs
+++ b/Katheryne/Services/KatheryneChatRobotFactory.cs
@@ -1,4 +1,5 @@
using Katheryne.Abstractions;
+using Katheryne.Exceptions;
using Katheryne.Models;
using Microsoft.Extensions.Logging;
using YamlDotNet.Serialization;
@@ -27,13 +28,26 @@ public class KatheryneChatRobotFactory
_defaultChatRobot = defaultChatRobot;
}
+ ///
+ /// ÉèÖõ±Ç°»úÆ÷ÈËʹÓõÄÎÄ·¨
+ ///
+ /// ÎÄ·¨×Ö·û´®
+ /// ±àÒëÎÄ·¨Ê§°ÜÅ׳öµÄÒì³£
public void SetGrammar(string grammarText)
{
_factoryLogger.LogInformation("Receive new grammar: {}.", grammarText);
GrammarText = grammarText;
IDeserializer deserializer = _deserializerFactory.GetDeserializer();
- LexicalModel model = deserializer.Deserialize(grammarText);
+ LexicalModel model;
+ try
+ {
+ model = deserializer.Deserialize(grammarText);
+ }
+ catch (Exception ex)
+ {
+ throw new GrammarException("Failed to parse lexical model.", ex);
+ }
_grammar = new Grammar(new GrammarTree(model), model.RobotName, model.BeginStageName);
}