diff --git a/host/Gateway.cs b/host/Gateway.cs index 834f08c..4aca530 100644 --- a/host/Gateway.cs +++ b/host/Gateway.cs @@ -145,37 +145,37 @@ public class Gateway } } - public static async void TestChatMessage(string message, string model, string gdbPath, + public static async void TestChatMessage(string message, string model, string gdbPath,//message,qwen-max,传个空字符串,传一个方法(回调,用来调用方法)1 Action callback) { - MessageListItem chatListItem = new ChatMessageItem + MessageListItem chatListItem = new ChatMessageItem//返回的东西1 { content = message, - role = "assistant", - type = MessageType.CHAT_MESSAGE, - id = "testmsg12345" + role = "assistant",//角色,assistant是ai的回答,user用户的回答,sistant系统提示词1 + type = MessageType.CHAT_MESSAGE,//根据type判断是工具卡还是聊天卡1 + id = "testmsg12345"//琅哥虚构的,定位可以用,引用选中凭id找1 }; callback?.Invoke(chatListItem); } - public static async void TestToolMessage(string message, string model, string gdbPath, Action callback) + public static async void TestToolMessage(string message, string model, string gdbPath, Action callback)//同上1 { MessageListItem toolListItem = new ToolMessageItem { - content = message, + content = message,//大模型生成的信息,正常来说是个x啥?1 type = MessageType.TOOL_MESSAGE, - toolName = "arcgis_pro.executeTool", + toolName = "arcgis_pro.executeTool",//要调用的工具名称,大模型工具不是arcgis工具,调⽤ArcGIS Pro.GP工具调用1 toolParams = new Dictionary { - {"gp_name","analysis.Buffer"}, - {"gp_params","[\"C:\\test.gdb\\river\",\"30 Meters\"]"} + {"gp_name","analysis.Buffer"},//传参要传Arcgis的工具名 + {"gp_params","[\"C:\\test.gdb\\river\",\"30 Meters\"]"}//工具参数,数组,字符串要转成数组,前端要调用OpenTrueDialog,没听懂1 }, id = "testtool123456", - status = "success", + status = "success",//显示勾 role = "user", result = "成功创建缓冲区" }; - callback?.Invoke(toolListItem); + callback?.Invoke(toolListItem);//这些调用结果显示在前端,显示点后面的工具名称,用户点的时候展开1 } public static async void TestWorkflow(string message, string model, string gdbPath, Action callback) diff --git a/ui/dockpane/TestDockpane.xaml.cs b/ui/dockpane/TestDockpane.xaml.cs index 6f33bb6..8eeab55 100644 --- a/ui/dockpane/TestDockpane.xaml.cs +++ b/ui/dockpane/TestDockpane.xaml.cs @@ -22,17 +22,17 @@ namespace LinkToolAddin.ui.dockpane /// /// Interaction logic for TestDockpaneView.xaml /// - public partial class TestDockpaneView : UserControl + public partial class TestDockpaneView : UserControl//类1 { private static ILog log = LogManager.GetLogger(typeof(TestDockpaneView)); - public TestDockpaneView() + public TestDockpaneView()//构造方法,没有返回参数1 { - InitLogger(); + InitLogger();//初始化日志输出器1 InitializeComponent(); } - protected void InitLogger() + protected void InitLogger()//要复制代码(到哪去)1 { // 1. 创建控制台输出器(Appender) var consoleAppender = new ConsoleAppender @@ -78,7 +78,7 @@ namespace LinkToolAddin.ui.dockpane ArcGISProMcpServer.TestMcpServer(); } - private async void StdioMcp_test() + private async void StdioMcp_test()//标准输入输出的MCP测试,复制过去看能不能返回,有没有东西1 { List args = new List(); args.Add("mcp-server-time"); @@ -91,7 +91,7 @@ namespace LinkToolAddin.ui.dockpane } CallToolResponse response = await stdioMcpClient.CallToolAsync("get_current_time", new Dictionary { { "timezone", "America/New_York" } }); - log.Info(JsonConvert.SerializeObject(response)); + log.Info(JsonConvert.SerializeObject(response));//log看有没有东西和报错,实际调试看对应按钮控制台有没有东西1 } private async void SseMcp_test() @@ -146,7 +146,7 @@ namespace LinkToolAddin.ui.dockpane private void TestWorkflow_OnClick(object sender, RoutedEventArgs e) { - Gateway.SendMessage("你好","qwen-max","test.gdb",ShowMessage); + Gateway.SendMessage("你好","qwen-max","test.gdb",ShowMessage);//标题名称,模型名称,虚构的gdb的路径,回调1 } public void ShowMessage(MessageListItem msg)