From 6e0908a4fa3bba684f3256e4a9da50cdabd1172b Mon Sep 17 00:00:00 2001 From: PeterZhong Date: Sat, 17 May 2025 00:04:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E5=88=B6=E9=9D=A2=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E6=B6=88=E6=81=AF=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- host/Gateway.cs | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) 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