diff --git a/host/Gateway.cs b/host/Gateway.cs index 8237927..2b209b1 100644 --- a/host/Gateway.cs +++ b/host/Gateway.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text.RegularExpressions; +using System.Threading; using System.Xml.Linq; using LinkToolAddin.client; using LinkToolAddin.client.prompt; @@ -143,4 +144,67 @@ public class Gateway } } } + + public static async void TestChatMessage(string message, string model, string gdbPath, + Action callback) + { + MessageListItem chatListItem = new ChatMessageItem + { + content = message, + role = "assistant", + type = MessageType.CHAT_MESSAGE, + id = "testmsg12345" + }; + callback?.Invoke(chatListItem); + } + + public static async void TestToolMessage(string message, string model, string gdbPath, Action callback) + { + MessageListItem toolListItem = new ToolMessageItem + { + content = message, + type = MessageType.TOOL_MESSAGE, + toolName = "arcgis_pro.executeTool", + toolParams = new Dictionary + { + {"gp_name","analysis.Buffer"}, + {"gp_params","[\"C:\\test.gdb\\river\",\"30 Meters\"]"} + }, + id = "testtool123456", + status = "success", + role = "user", + result = "成功创建缓冲区" + }; + callback?.Invoke(toolListItem); + } + + public static async void TestWOrkflow(string message, string model, string gdbPath, Action callback) + { + Thread.Sleep(2000); + MessageListItem chatListItem = new ChatMessageItem + { + content = message, + role = "assistant", + type = MessageType.CHAT_MESSAGE, + id = "testid12345" + }; + callback?.Invoke(chatListItem); + Thread.Sleep(1500); + MessageListItem toolListItem = new ToolMessageItem + { + content = message, + type = MessageType.TOOL_MESSAGE, + toolName = "arcgis_pro.executeTool", + toolParams = new Dictionary + { + {"gp_name","analysis.Buffer"}, + {"gp_params","[\"C:\\test.gdb\\river\",\"30 Meters\"]"} + }, + id = "testtool123456", + status = "success", + role = "user", + result = "成功创建缓冲区" + }; + callback?.Invoke(toolListItem); + } } \ No newline at end of file