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