控制面实现模拟消息测试

This commit is contained in:
PeterZhong 2025-05-17 00:04:47 +08:00
parent a3cfcb90e3
commit 6e0908a4fa

View File

@ -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<MessageListItem> 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<MessageListItem> callback)
{
MessageListItem toolListItem = new ToolMessageItem
{
content = message,
type = MessageType.TOOL_MESSAGE,
toolName = "arcgis_pro.executeTool",
toolParams = new Dictionary<string, object>
{
{"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<MessageListItem> 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<string, object>
{
{"gp_name","analysis.Buffer"},
{"gp_params","[\"C:\\test.gdb\\river\",\"30 Meters\"]"}
},
id = "testtool123456",
status = "success",
role = "user",
result = "成功创建缓冲区"
};
callback?.Invoke(toolListItem);
}
}