去除所有打断流程的对话框
This commit is contained in:
parent
ab78de8078
commit
2a80940879
@ -260,7 +260,15 @@ public class Gateway
|
||||
}catch (Exception ex)
|
||||
{
|
||||
log.Error(ex);
|
||||
MessageBox.Show(ex.Message,"获取MCP列表失败");
|
||||
MessageListItem endMessageListItem2 = new ChatMessageItem
|
||||
{
|
||||
type = MessageType.WARNING,
|
||||
content = $"MCP列表读取失败{ex.Message}",
|
||||
id = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString(),
|
||||
role = "system"
|
||||
};
|
||||
callback?.Invoke(endMessageListItem2);
|
||||
// MessageBox.Show(ex.Message,"获取MCP列表失败");
|
||||
}
|
||||
goOn = true;
|
||||
string toolPattern = "<tool_use>([\\s\\S]*?)<name>([\\s\\S]*?)<\\/name>([\\s\\S]*?)<arguments>([\\s\\S]*?)<\\/arguments>([\\s\\S]*?)<\\/tool_use>";
|
||||
@ -273,10 +281,19 @@ public class Gateway
|
||||
bool executedTool = false;
|
||||
while (goOn)
|
||||
{
|
||||
long timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||
loop++;
|
||||
if (loop > 500)
|
||||
{
|
||||
MessageBox.Show("达到最大循环次数", "退出循环");
|
||||
MessageListItem endMessageListItem2 = new ChatMessageItem
|
||||
{
|
||||
type = MessageType.ERROR,
|
||||
content = "达到最大循环次数,已退出循环。",
|
||||
id = timestamp.ToString(),
|
||||
role = "system"
|
||||
};
|
||||
callback?.Invoke(endMessageListItem2);
|
||||
// MessageBox.Show("达到最大循环次数", "退出循环");
|
||||
break;
|
||||
}
|
||||
LlmJsonContent jsonContent = new LlmJsonContent()
|
||||
@ -288,7 +305,6 @@ public class Gateway
|
||||
TopK = 7,
|
||||
MaxTokens = 1000,
|
||||
};
|
||||
long timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||
List<McpToolRequest> mcpToolRequests = new List<McpToolRequest>();
|
||||
List<PromptRequest> promptRequests = new List<PromptRequest>();
|
||||
var (toolMatched, toolRemaining) = ExtractMatchedPart(messageContent, toolPattern);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user