Compare commits
No commits in common. "master" and "prompt" have entirely different histories.
@ -100,7 +100,7 @@ public class ArcGisPro
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[McpServerTool, Description("列出gdb数据库中的所有数据的名称")]
|
[McpServerTool, Description("列出gdb数据库中的所有数据名称")]
|
||||||
public static async Task<JsonRpcResultEntity> ListData(string gdbPath)
|
public static async Task<JsonRpcResultEntity> ListData(string gdbPath)
|
||||||
{
|
{
|
||||||
var datasets = new List<string>();
|
var datasets = new List<string>();
|
||||||
@ -137,80 +137,6 @@ public class ArcGisPro
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[McpServerTool, Description("获取要素类的属性表内容,可以查看属性表中的至多前20条记录的内容")]
|
|
||||||
public static async Task<JsonRpcResultEntity> GetFeatureDatasetAttributeTable(string datasetPath, string dataName, string rowsLimit)
|
|
||||||
{
|
|
||||||
JsonRpcResultEntity result = new JsonRpcResultEntity();
|
|
||||||
await QueuedTask.Run(async () =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using Geodatabase gdb = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(datasetPath)));
|
|
||||||
FeatureClass featureClass = gdb.OpenDataset<FeatureClass>(dataName);
|
|
||||||
List<Dictionary<string, string>> attributeTable = await GetAttributeTableAsync(featureClass,Convert.ToInt32(rowsLimit));
|
|
||||||
result = new JsonRpcSuccessEntity()
|
|
||||||
{
|
|
||||||
Id = 1,
|
|
||||||
Result = JsonConvert.SerializeObject(attributeTable)
|
|
||||||
};
|
|
||||||
return result;
|
|
||||||
}catch (Exception ex)
|
|
||||||
{
|
|
||||||
result = new JsonRpcErrorEntity()
|
|
||||||
{
|
|
||||||
Error = new Error()
|
|
||||||
{
|
|
||||||
Message = ex.Message,
|
|
||||||
Code = "500"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<List<Dictionary<string, string>>> GetAttributeTableAsync(FeatureClass featureClass,int limit = 5)
|
|
||||||
{
|
|
||||||
if (limit > 20)
|
|
||||||
limit = 20;
|
|
||||||
return await QueuedTask.Run(() =>
|
|
||||||
{
|
|
||||||
var result = new List<Dictionary<string, string>>();
|
|
||||||
|
|
||||||
using (var cursor = featureClass.Search())
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
while (cursor.MoveNext())
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
if (i >= limit && limit != -1)
|
|
||||||
break;
|
|
||||||
var feature = cursor.Current as Feature;
|
|
||||||
if (feature == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
var record = new Dictionary<string, string>();
|
|
||||||
|
|
||||||
foreach (var field in featureClass.GetDefinition().GetFields())
|
|
||||||
{
|
|
||||||
var value = feature[field.Name];
|
|
||||||
|
|
||||||
// 处理 DBNull 值
|
|
||||||
if (value is DBNull)
|
|
||||||
value = null;
|
|
||||||
|
|
||||||
record[field.Name] = value.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.Add(record);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string GetMessagesString(IEnumerable<IGPMessage> messages)
|
private static string GetMessagesString(IEnumerable<IGPMessage> messages)
|
||||||
{
|
{
|
||||||
StringBuilder messagesStr = new StringBuilder();
|
StringBuilder messagesStr = new StringBuilder();
|
||||||
|
|||||||
132
host/Gateway.cs
132
host/Gateway.cs
@ -12,11 +12,9 @@ using System.Windows;
|
|||||||
using System.Windows.Documents;
|
using System.Windows.Documents;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using ArcGIS.Desktop.Internal.Mapping;
|
|
||||||
using ArcGIS.Desktop.Internal.Mapping.Locate;
|
using ArcGIS.Desktop.Internal.Mapping.Locate;
|
||||||
using LinkToolAddin.client;
|
using LinkToolAddin.client;
|
||||||
using LinkToolAddin.client.prompt;
|
using LinkToolAddin.client.prompt;
|
||||||
using LinkToolAddin.client.tool;
|
|
||||||
using LinkToolAddin.host.llm;
|
using LinkToolAddin.host.llm;
|
||||||
using LinkToolAddin.host.llm.entity;
|
using LinkToolAddin.host.llm.entity;
|
||||||
using LinkToolAddin.host.mcp;
|
using LinkToolAddin.host.mcp;
|
||||||
@ -78,11 +76,9 @@ public class Gateway
|
|||||||
{
|
{
|
||||||
Model = model,
|
Model = model,
|
||||||
Messages = messages,
|
Messages = messages,
|
||||||
Temperature = 0.3,
|
Temperature = 0.7,
|
||||||
TopP = 0.6,
|
TopP = 1,
|
||||||
TopK = 25,
|
MaxTokens = 1000,
|
||||||
MaxTokens = 1024,
|
|
||||||
ThinkingBudget = 1024
|
|
||||||
});
|
});
|
||||||
long timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
long timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||||
log.Info(reponse);
|
log.Info(reponse);
|
||||||
@ -269,8 +265,6 @@ public class Gateway
|
|||||||
PromptServerList promptServerList = new PromptServerList();
|
PromptServerList promptServerList = new PromptServerList();
|
||||||
int loop = 0;
|
int loop = 0;
|
||||||
string messageContent = ""; //一次请求下完整的response
|
string messageContent = ""; //一次请求下完整的response
|
||||||
bool queriedKnowledge = false;
|
|
||||||
bool executedTool = false;
|
|
||||||
while (goOn)
|
while (goOn)
|
||||||
{
|
{
|
||||||
loop++;
|
loop++;
|
||||||
@ -404,24 +398,21 @@ public class Gateway
|
|||||||
{
|
{
|
||||||
callback?.Invoke(chatMessageListItem);
|
callback?.Invoke(chatMessageListItem);
|
||||||
});
|
});
|
||||||
if (!executedTool)
|
MessageListItem toolMessageListItem = new ToolMessageItem()
|
||||||
{
|
{
|
||||||
MessageListItem toolMessageListItem = new ToolMessageItem()
|
content = "",
|
||||||
{
|
result = "",
|
||||||
content = toolName,
|
toolName = toolName,
|
||||||
result = "工具运行中" + toolName,
|
toolParams = toolParams,
|
||||||
toolName = toolName,
|
role = "user",
|
||||||
toolParams = toolParams,
|
type = MessageType.TOOL_MESSAGE,
|
||||||
role = "user",
|
id = (timestamp+1).ToString(),
|
||||||
type = MessageType.TOOL_MESSAGE,
|
status = "loading"
|
||||||
id = (timestamp+1).ToString(),
|
};
|
||||||
status = "loading"
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
};
|
{
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
callback?.Invoke(toolMessageListItem);
|
||||||
{
|
});
|
||||||
callback?.Invoke(toolMessageListItem);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
mcpToolRequests = new List<McpToolRequest>();
|
mcpToolRequests = new List<McpToolRequest>();
|
||||||
McpToolRequest mcpToolRequest = new McpToolRequest()
|
McpToolRequest mcpToolRequest = new McpToolRequest()
|
||||||
{
|
{
|
||||||
@ -443,6 +434,7 @@ public class Gateway
|
|||||||
log.Error(e.Message);
|
log.Error(e.Message);
|
||||||
MessageBox.Show(e.Message, "请求大模型出错");
|
MessageBox.Show(e.Message, "请求大模型出错");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (messageContent != "")
|
if (messageContent != "")
|
||||||
{
|
{
|
||||||
messages.Add(new Message
|
messages.Add(new Message
|
||||||
@ -454,7 +446,6 @@ public class Gateway
|
|||||||
/*统一处理本次请求中的MCP工具调用需求*/
|
/*统一处理本次请求中的MCP工具调用需求*/
|
||||||
foreach (McpToolRequest mcpToolRequest in mcpToolRequests)
|
foreach (McpToolRequest mcpToolRequest in mcpToolRequests)
|
||||||
{
|
{
|
||||||
executedTool = true;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
McpServer mcpServer = mcpToolRequest.McpServer;
|
McpServer mcpServer = mcpToolRequest.McpServer;
|
||||||
@ -465,7 +456,7 @@ public class Gateway
|
|||||||
SseMcpServer sseMcpServer = mcpServer as SseMcpServer;
|
SseMcpServer sseMcpServer = mcpServer as SseMcpServer;
|
||||||
SseMcpClient client = new SseMcpClient(sseMcpServer.BaseUrl);
|
SseMcpClient client = new SseMcpClient(sseMcpServer.BaseUrl);
|
||||||
CallToolResponse toolResponse = await client.CallToolAsync(toolName, toolParams);
|
CallToolResponse toolResponse = await client.CallToolAsync(toolName, toolParams);
|
||||||
MessageListItem toolMessageItem1 = new ToolMessageItem
|
MessageListItem toolMessageItem = new ToolMessageItem
|
||||||
{
|
{
|
||||||
toolName = toolName,
|
toolName = toolName,
|
||||||
toolParams = toolParams,
|
toolParams = toolParams,
|
||||||
@ -485,7 +476,7 @@ public class Gateway
|
|||||||
});
|
});
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
callback?.Invoke(toolMessageItem1);
|
callback?.Invoke(toolMessageItem);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (mcpServer is StdioMcpServer)
|
else if (mcpServer is StdioMcpServer)
|
||||||
@ -493,7 +484,7 @@ public class Gateway
|
|||||||
StdioMcpServer stdioMcpServer = mcpServer as StdioMcpServer;
|
StdioMcpServer stdioMcpServer = mcpServer as StdioMcpServer;
|
||||||
StdioMcpClient client = new StdioMcpClient(stdioMcpServer.Command, stdioMcpServer.Args);
|
StdioMcpClient client = new StdioMcpClient(stdioMcpServer.Command, stdioMcpServer.Args);
|
||||||
CallToolResponse toolResponse = await client.CallToolAsync(toolName, toolParams);
|
CallToolResponse toolResponse = await client.CallToolAsync(toolName, toolParams);
|
||||||
MessageListItem toolMessageItem1 = new ToolMessageItem
|
MessageListItem toolMessageItem = new ToolMessageItem
|
||||||
{
|
{
|
||||||
toolName = toolName,
|
toolName = toolName,
|
||||||
toolParams = toolParams,
|
toolParams = toolParams,
|
||||||
@ -513,67 +504,11 @@ public class Gateway
|
|||||||
});
|
});
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
callback?.Invoke(toolMessageItem1);
|
callback?.Invoke(toolMessageItem);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (mcpServer is InnerMcpServer)
|
else if (mcpServer is InnerMcpServer)
|
||||||
{
|
{
|
||||||
InnerMcpServer innerMcpServer = mcpServer as InnerMcpServer;
|
|
||||||
string mcpServerName = innerMcpServer.Name;
|
|
||||||
if (toolName == "ArcGisProTool" && queriedKnowledge == false)
|
|
||||||
{
|
|
||||||
JsonRpcResultEntity knowledgeResult = await KnowledgeBase.QueryArcgisToolDoc(toolParams["toolName"].ToString());
|
|
||||||
if (knowledgeResult is JsonRpcSuccessEntity)
|
|
||||||
{
|
|
||||||
JsonRpcSuccessEntity knowledgeSuccessResult = knowledgeResult as JsonRpcSuccessEntity;
|
|
||||||
MessageListItem toolMessageItem = new ToolMessageItem
|
|
||||||
{
|
|
||||||
toolName = "QueryArcgisToolDoc",
|
|
||||||
toolParams = new Dictionary<string, object>(){{"query",toolParams["toolName"].ToString()}},
|
|
||||||
type = MessageType.TOOL_MESSAGE,
|
|
||||||
status = "success",
|
|
||||||
content = JsonConvert.SerializeObject(knowledgeSuccessResult.Result),
|
|
||||||
result = JsonConvert.SerializeObject(knowledgeSuccessResult.Result),
|
|
||||||
id = (timestamp + 4).ToString(),
|
|
||||||
role = "user"
|
|
||||||
};
|
|
||||||
messages.Add(new Message
|
|
||||||
{
|
|
||||||
Role = "user",
|
|
||||||
Content = SystemPrompt.ToolContinuePrompt(JsonConvert.SerializeObject(knowledgeSuccessResult))
|
|
||||||
});
|
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
|
||||||
{
|
|
||||||
callback?.Invoke(toolMessageItem);
|
|
||||||
});
|
|
||||||
queriedKnowledge = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
JsonRpcErrorEntity knowledgeErrorResult = knowledgeResult as JsonRpcErrorEntity;
|
|
||||||
MessageListItem toolMessageItem = new ToolMessageItem
|
|
||||||
{
|
|
||||||
toolName = "QueryArcgisToolDoc",
|
|
||||||
toolParams = new Dictionary<string, object>(){{"query",toolParams["toolName"].ToString()}},
|
|
||||||
type = MessageType.TOOL_MESSAGE,
|
|
||||||
status = "fail",
|
|
||||||
content = JsonConvert.SerializeObject(knowledgeErrorResult.Error),
|
|
||||||
result = JsonConvert.SerializeObject(knowledgeErrorResult.Error),
|
|
||||||
id = (timestamp + 4).ToString(),
|
|
||||||
role = "user"
|
|
||||||
};
|
|
||||||
messages.Add(new Message
|
|
||||||
{
|
|
||||||
Role = "user",
|
|
||||||
Content = SystemPrompt.ErrorPrompt(JsonConvert.SerializeObject(knowledgeErrorResult))
|
|
||||||
});
|
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
|
||||||
{
|
|
||||||
callback?.Invoke(toolMessageItem);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Type type = Type.GetType("LinkToolAddin.client.tool." + (mcpServer as InnerMcpServer).Name);
|
Type type = Type.GetType("LinkToolAddin.client.tool." + (mcpServer as InnerMcpServer).Name);
|
||||||
MethodInfo method = type.GetMethod(toolName, BindingFlags.Public | BindingFlags.Static);
|
MethodInfo method = type.GetMethod(toolName, BindingFlags.Public | BindingFlags.Static);
|
||||||
var methodParams = toolParams.Values.ToArray();
|
var methodParams = toolParams.Values.ToArray();
|
||||||
@ -599,10 +534,9 @@ public class Gateway
|
|||||||
{
|
{
|
||||||
displayToolName = "【GP】"+toolParams["toolName"].ToString();
|
displayToolName = "【GP】"+toolParams["toolName"].ToString();
|
||||||
}
|
}
|
||||||
queriedKnowledge = false;
|
|
||||||
if (innerResult is JsonRpcErrorEntity)
|
if (innerResult is JsonRpcErrorEntity)
|
||||||
{
|
{
|
||||||
MessageListItem toolMessageItem1 = new ToolMessageItem
|
MessageListItem toolMessageItem = new ToolMessageItem
|
||||||
{
|
{
|
||||||
toolName = displayToolName,
|
toolName = displayToolName,
|
||||||
toolParams = toolParams,
|
toolParams = toolParams,
|
||||||
@ -616,16 +550,16 @@ public class Gateway
|
|||||||
messages.Add(new Message
|
messages.Add(new Message
|
||||||
{
|
{
|
||||||
Role = "user",
|
Role = "user",
|
||||||
Content = SystemPrompt.ErrorPrompt(JsonConvert.SerializeObject(innerResult))
|
Content = SystemPrompt.ErrorPrompt(JsonConvert.SerializeObject(toolMessageItem))
|
||||||
});
|
});
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
callback?.Invoke(toolMessageItem1);
|
callback?.Invoke(toolMessageItem);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (innerResult is JsonRpcSuccessEntity)
|
else if (innerResult is JsonRpcSuccessEntity)
|
||||||
{
|
{
|
||||||
MessageListItem toolMessageItem1 = new ToolMessageItem
|
MessageListItem toolMessageItem = new ToolMessageItem
|
||||||
{
|
{
|
||||||
toolName = displayToolName,
|
toolName = displayToolName,
|
||||||
toolParams = toolParams,
|
toolParams = toolParams,
|
||||||
@ -639,11 +573,11 @@ public class Gateway
|
|||||||
messages.Add(new Message
|
messages.Add(new Message
|
||||||
{
|
{
|
||||||
Role = "user",
|
Role = "user",
|
||||||
Content = SystemPrompt.ContinuePrompt(JsonConvert.SerializeObject(innerResult))
|
Content = SystemPrompt.ContinuePrompt(JsonConvert.SerializeObject(toolMessageItem))
|
||||||
});
|
});
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
callback?.Invoke(toolMessageItem1);
|
callback?.Invoke(toolMessageItem);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -669,7 +603,7 @@ public class Gateway
|
|||||||
MessageListItem toolMessageItem = new ToolMessageItem
|
MessageListItem toolMessageItem = new ToolMessageItem
|
||||||
{
|
{
|
||||||
toolName = "调用提示词",
|
toolName = "调用提示词",
|
||||||
toolParams = new Dictionary<string, object>(),
|
toolParams = null,
|
||||||
type = MessageType.TOOL_MESSAGE,
|
type = MessageType.TOOL_MESSAGE,
|
||||||
status = "success",
|
status = "success",
|
||||||
content = "成功调用提示词:"+promptRequest.PromptName,
|
content = "成功调用提示词:"+promptRequest.PromptName,
|
||||||
@ -704,7 +638,6 @@ public class Gateway
|
|||||||
StringBuilder toolInfos = new StringBuilder();
|
StringBuilder toolInfos = new StringBuilder();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
List<int> failedMcp = new List<int>();
|
List<int> failedMcp = new List<int>();
|
||||||
List<string> failedMcpString = new List<string>();
|
|
||||||
foreach (McpServer mcpServer in mcpServerList.GetAllServers())
|
foreach (McpServer mcpServer in mcpServerList.GetAllServers())
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
@ -784,7 +717,6 @@ public class Gateway
|
|||||||
{
|
{
|
||||||
log.Error(e.Message);
|
log.Error(e.Message);
|
||||||
failedMcp.Add(i);
|
failedMcp.Add(i);
|
||||||
failedMcpString.Add(mcpServerList.GetAllServerNames()[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -802,11 +734,7 @@ public class Gateway
|
|||||||
log.Error(e.Message);
|
log.Error(e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MessageBox.Show($"读取失败的MCP序号:{JsonConvert.SerializeObject(failedMcp)}","MCP读取错误");
|
||||||
if (!failedMcp.IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
MessageBox.Show($"读取失败的MCP服务有:{JsonConvert.SerializeObject(failedMcpString)}","MCP读取错误");
|
|
||||||
}
|
|
||||||
return toolInfos.ToString();
|
return toolInfos.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -106,14 +106,4 @@ public class McpServerList
|
|||||||
}
|
}
|
||||||
return serverList;
|
return serverList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<string> GetAllServerNames()
|
|
||||||
{
|
|
||||||
List<string> serverList = new List<string>();
|
|
||||||
foreach (var server in servers)
|
|
||||||
{
|
|
||||||
serverList.Add(server.Key);
|
|
||||||
}
|
|
||||||
return serverList;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -49,11 +49,4 @@ public class SystemPrompt
|
|||||||
errPrompt = errPrompt.Replace("{{toolResult}}", toolResult);
|
errPrompt = errPrompt.Replace("{{toolResult}}", toolResult);
|
||||||
return errPrompt;
|
return errPrompt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ToolContinuePrompt(string toolResult)
|
|
||||||
{
|
|
||||||
string continuePrompt = "根据你需要调用的工具查询到如下帮助文档内容,请严格按照帮助文档中的参数和名称要求再次生成准确的工具调用请求以确保工具调用成功。\n{{toolResult}}";
|
|
||||||
continuePrompt = continuePrompt.Replace("{{toolResult}}", toolResult);
|
|
||||||
return continuePrompt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -22,7 +22,7 @@ namespace LinkToolAddin
|
|||||||
{
|
{
|
||||||
internal class VersionButton : Button
|
internal class VersionButton : Button
|
||||||
{
|
{
|
||||||
private string version = "0.1.4";
|
private string version = "0.1.3";
|
||||||
protected override void OnClick()
|
protected override void OnClick()
|
||||||
{
|
{
|
||||||
MessageBox.Show($"当前LinkTool版本为{version}", "版本信息");
|
MessageBox.Show($"当前LinkTool版本为{version}", "版本信息");
|
||||||
|
|||||||
@ -122,7 +122,6 @@ namespace LinkToolAddin.ui.dockpane
|
|||||||
{
|
{
|
||||||
model = ShowInputBox("自定义模型", "请输入模型名称:", "");
|
model = ShowInputBox("自定义模型", "请输入模型名称:", "");
|
||||||
}
|
}
|
||||||
ScrollViewer.ScrollToBottom();
|
|
||||||
Gateway.SendMessageStream(question,model,defaultGdbPath,NewMessage_Recall);
|
Gateway.SendMessageStream(question,model,defaultGdbPath,NewMessage_Recall);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,13 +218,6 @@ namespace LinkToolAddin.ui.dockpane
|
|||||||
StatusTextBlock.Text = "回答生成中";
|
StatusTextBlock.Text = "回答生成中";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (msg.role == "system")
|
|
||||||
{
|
|
||||||
if (msg.type == MessageType.WARNING)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -249,10 +241,7 @@ namespace LinkToolAddin.ui.dockpane
|
|||||||
Border borderItem = borderItemsDict[msgId];
|
Border borderItem = borderItemsDict[msgId];
|
||||||
Grid grid = borderItem.Child as Grid;
|
Grid grid = borderItem.Child as Grid;
|
||||||
TextBlock textBlock = grid.Children[1] as TextBlock;
|
TextBlock textBlock = grid.Children[1] as TextBlock;
|
||||||
ToolMessageItem msgItem = msg as ToolMessageItem;
|
textBlock.Text = (msg as ToolMessageItem).toolName;
|
||||||
textBlock.Text = msgItem.toolName + " | " + msgItem.status;
|
|
||||||
Button resButton = grid.Children[3] as Button;
|
|
||||||
resButton.Tag = msg;
|
|
||||||
StatusTextBlock.Text = "正在执行工具";
|
StatusTextBlock.Text = "正在执行工具";
|
||||||
}else if (msg.type == MessageType.CHAT_MESSAGE)
|
}else if (msg.type == MessageType.CHAT_MESSAGE)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -25,7 +25,6 @@
|
|||||||
<RowDefinition Height="24"/>
|
<RowDefinition Height="24"/>
|
||||||
<RowDefinition Height="24"/>
|
<RowDefinition Height="24"/>
|
||||||
<RowDefinition Height="24"/>
|
<RowDefinition Height="24"/>
|
||||||
<RowDefinition Height="24"/>
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Button Grid.Row="0" Content="Test Workflow" Name="TestServer" Click="TestWorkflow_OnClick"></Button>
|
<Button Grid.Row="0" Content="Test Workflow" Name="TestServer" Click="TestWorkflow_OnClick"></Button>
|
||||||
<Grid Grid.Row="1">
|
<Grid Grid.Row="1">
|
||||||
@ -42,6 +41,5 @@
|
|||||||
<Button Grid.Row="4" Content="Test Stream" Name="TestStream" Click="TestStream_OnClick"></Button>
|
<Button Grid.Row="4" Content="Test Stream" Name="TestStream" Click="TestStream_OnClick"></Button>
|
||||||
<Button Grid.Row="5" Content="Test Arcgis Tool" Name="TestArcGisTool" Click="TestArcGisTool_OnClick"></Button>
|
<Button Grid.Row="5" Content="Test Arcgis Tool" Name="TestArcGisTool" Click="TestArcGisTool_OnClick"></Button>
|
||||||
<Button Grid.Row="6" Content="Test Resource" Name="TestResource" Click="TestResource_OnClick"></Button>
|
<Button Grid.Row="6" Content="Test Resource" Name="TestResource" Click="TestResource_OnClick"></Button>
|
||||||
<Button Grid.Row="7" Content="测试获取属性表" Name="TestAttrTable" Click="TestAttrTable_OnClick"></Button>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -9,7 +9,6 @@ using System.Windows;
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using LinkToolAddin.client;
|
using LinkToolAddin.client;
|
||||||
using LinkToolAddin.client.tool;
|
|
||||||
using LinkToolAddin.common;
|
using LinkToolAddin.common;
|
||||||
using LinkToolAddin.host;
|
using LinkToolAddin.host;
|
||||||
using LinkToolAddin.host.llm;
|
using LinkToolAddin.host.llm;
|
||||||
@ -312,13 +311,5 @@ namespace LinkToolAddin.ui.dockpane
|
|||||||
string content = LocalResource.ReadFileByResource("LinkToolAddin.resource.SystemPrompt.txt");
|
string content = LocalResource.ReadFileByResource("LinkToolAddin.resource.SystemPrompt.txt");
|
||||||
MessageBox.Show(content);
|
MessageBox.Show(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void TestAttrTable_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
JsonRpcResultEntity result = await ArcGisPro.GetFeatureDatasetAttributeTable(
|
|
||||||
"D:\\01_Project\\20250305_LinkTool\\20250420_AiDemoProject\\20250420_AiDemoProject.gdb",
|
|
||||||
"LandUse_2005_Copy", "30");
|
|
||||||
log.Info("finish");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,9 +5,7 @@ public enum MessageType
|
|||||||
TOOL_MESSAGE,
|
TOOL_MESSAGE,
|
||||||
CHAT_MESSAGE,
|
CHAT_MESSAGE,
|
||||||
REASON_MESSAGE,
|
REASON_MESSAGE,
|
||||||
END_TAG,
|
END_TAG
|
||||||
WARNING,
|
|
||||||
ERROR
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface MessageListItem
|
public interface MessageListItem
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user