Skip to content

Commit e4e4196

Browse files
committed
update deps
1 parent 6551c48 commit e4e4196

File tree

7 files changed

+53
-49
lines changed

7 files changed

+53
-49
lines changed

src/HuaJiBot.NET.Adapter.Satori/HuaJiBot.NET.Adapter.Satori.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="HtmlAgilityPack" Version="1.12.3" />
14+
<PackageReference Include="HtmlAgilityPack" Version="1.12.4" />
1515
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
1616
</ItemGroup>
1717

src/HuaJiBot.NET.Plugin.AIChat/HuaJiBot.NET.Plugin.AIChat.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
77
</PropertyGroup>
88
<ItemGroup>
9-
<PackageReference Include="Microsoft.SemanticKernel" Version="1.65.0" />
10-
<PackageReference Include="Microsoft.SemanticKernel.Agents.Core" Version="1.65.0" />
9+
<PackageReference Include="Microsoft.SemanticKernel" Version="1.66.0" />
10+
<PackageReference Include="Microsoft.SemanticKernel.Agents.Core" Version="1.66.0" />
1111
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Google" Version="1.65.0-alpha" />
1212
<PackageReference Include="Microsoft.SemanticKernel.Plugins.Core" Version="1.65.0-preview" />
1313
</ItemGroup>

src/HuaJiBot.NET.Plugin.AIChat/Service/KernelExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ IReadOnlyDictionary<string, IEnumerable<AgentFunctionInfo>> extraFunctions
1414
#pragma warning disable SKEXP0050
1515
// https://github.com/microsoft/semantic-kernel/tree/main/dotnet/src/Plugins/Plugins.Core
1616
builder.Plugins.AddFromType<ConversationSummaryPlugin>(nameof(ConversationSummaryPlugin));
17-
builder.Plugins.AddFromType<HttpPlugin>(nameof(HttpPlugin));
18-
builder.Plugins.AddFromType<TextPlugin>(nameof(TextPlugin));
17+
//builder.Plugins.AddFromType<HttpPlugin>(nameof(HttpPlugin));
18+
//builder.Plugins.AddFromType<TextPlugin>(nameof(TextPlugin));
1919
builder.Plugins.AddFromType<TimePlugin>(nameof(TimePlugin));
2020
#pragma warning restore SKEXP0050
2121

src/HuaJiBot.NET.Plugin.Calendar/HuaJiBot.NET.Plugin.Calendar.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
77
</PropertyGroup>
88
<ItemGroup>
9-
<PackageReference Include="Ical.Net" Version="5.1.0" />
9+
<PackageReference Include="Ical.Net" Version="5.1.1" />
1010
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
1111
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
1212
</ItemGroup>

src/HuaJiBot.NET.UnitTest/HuaJiBot.NET.UnitTest.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.9" />
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
13+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.10" />
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
1515
<PackageReference Include="NUnit" Version="4.4.0" />
16-
<PackageReference Include="NUnit3TestAdapter" Version="5.1.0" />
16+
<PackageReference Include="NUnit3TestAdapter" Version="5.2.0" />
1717
<PackageReference Include="NUnit.Analyzers" Version="4.10.0">
1818
<PrivateAssets>all</PrivateAssets>
1919
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

src/HuaJiBot.NET/HuaJiBot.NET.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<ItemGroup>
1111
<PackageReference Include="LiteDB" Version="5.0.21" />
1212
<PackageReference Include="Markdig" Version="0.42.0" />
13-
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.9" />
13+
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.10" />
1414
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
1515
<PackageReference Include="SixLabors.Fonts" Version="2.1.3" />
1616
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />

src/HuaJiBot.NET/Websocket/WebsocketClient.cs

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public WebsocketClient(
7575

7676
// Start connection
7777
_ = StartConnectionAsync();
78-
78+
7979
// Start health check
8080
_healthCheckTask = RunHealthCheckAsync();
8181
}
@@ -85,22 +85,24 @@ private async Task StartConnectionAsync()
8585
try
8686
{
8787
_logger?.LogInformation($"WebSocket connecting to {_url}");
88-
88+
8989
await Task.Run(() => _client.Start(), _cancellationTokenSource.Token);
90-
90+
9191
// 重置重连计数
9292
_reconnectAttempts = 0;
9393
}
9494
catch (Exception e)
9595
{
9696
_logger?.LogError(e, "Error starting WebSocket connection");
97-
OnClosed?.Invoke(new DisconnectionInfo
98-
{
99-
Type = DisconnectionType.Error,
100-
Reason = e.Message,
101-
Exception = e
102-
});
103-
97+
OnClosed?.Invoke(
98+
new DisconnectionInfo
99+
{
100+
Type = DisconnectionType.Error,
101+
Reason = e.Message,
102+
Exception = e,
103+
}
104+
);
105+
104106
// 启动自动重连
105107
_ = TryReconnectAsync();
106108
}
@@ -109,11 +111,11 @@ private async Task StartConnectionAsync()
109111
private void OnServerConnected(object? sender, EventArgs e)
110112
{
111113
_logger?.LogInformation("WebSocket connected");
112-
114+
113115
var connectionInfo = new ConnectionInfo
114116
{
115117
IsReconnect = _hasConnectedBefore,
116-
Timestamp = DateTimeOffset.Now
118+
Timestamp = DateTimeOffset.Now,
117119
};
118120

119121
_hasConnectedBefore = true;
@@ -123,14 +125,16 @@ private void OnServerConnected(object? sender, EventArgs e)
123125
private void OnServerDisconnected(object? sender, EventArgs e)
124126
{
125127
_logger?.LogInformation("WebSocket disconnected");
126-
127-
OnClosed?.Invoke(new DisconnectionInfo
128-
{
129-
Type = DisconnectionType.ByServer,
130-
Reason = "Server disconnected",
131-
Timestamp = DateTimeOffset.Now
132-
});
133-
128+
129+
OnClosed?.Invoke(
130+
new DisconnectionInfo
131+
{
132+
Type = DisconnectionType.ByServer,
133+
Reason = "Server disconnected",
134+
Timestamp = DateTimeOffset.Now,
135+
}
136+
);
137+
134138
// 只要 _shouldReconnect 为 true,就启动自动重连
135139
if (_shouldReconnect && !_disposed)
136140
{
@@ -157,12 +161,17 @@ private async Task TryReconnectAsync()
157161
while (!_disposed && _shouldReconnect)
158162
{
159163
_reconnectAttempts++;
160-
161-
// 计算延迟时间(指数退避,最大30秒)
162-
var delay = Math.Min(InitialReconnectDelay * (int)Math.Pow(2, _reconnectAttempts - 1), MaxReconnectDelay);
163-
164-
_logger?.LogInformation($"Attempting to reconnect (attempt {_reconnectAttempts}) in {delay}ms...");
165-
164+
165+
// 计算延迟时间(简化的指数退避,1秒到30秒)
166+
var delay = Math.Min(
167+
InitialReconnectDelay << Math.Min(_reconnectAttempts - 1, 5),
168+
MaxReconnectDelay
169+
);
170+
171+
_logger?.LogInformation(
172+
$"Attempting to reconnect (attempt {_reconnectAttempts}) in {delay}ms..."
173+
);
174+
166175
try
167176
{
168177
await Task.Delay(delay, _cancellationTokenSource.Token);
@@ -172,7 +181,9 @@ private async Task TryReconnectAsync()
172181
// 如果被取消但仍需要重连,继续尝试
173182
if (_shouldReconnect && !_disposed)
174183
{
175-
_logger?.LogInformation("Reconnect delay cancelled, but will continue trying...");
184+
_logger?.LogInformation(
185+
"Reconnect delay cancelled, but will continue trying..."
186+
);
176187
await Task.Delay(delay); // 使用不带取消令牌的版本
177188
}
178189
else
@@ -190,7 +201,7 @@ private async Task TryReconnectAsync()
190201
}
191202

192203
_logger?.LogInformation($"Reconnecting to {_url}...");
193-
204+
194205
// 尝试停止现有连接(如果有)
195206
if (_client.Connected)
196207
{
@@ -203,9 +214,9 @@ private async Task TryReconnectAsync()
203214
_logger?.LogDebug(stopEx, "Error stopping client before reconnect");
204215
}
205216
}
206-
217+
207218
await Task.Run(() => _client.Start());
208-
219+
209220
_logger?.LogInformation("Reconnected successfully");
210221
_reconnectAttempts = 0;
211222
break;
@@ -232,8 +243,6 @@ private async Task TryReconnectAsync()
232243
/// </summary>
233244
private async Task RunHealthCheckAsync()
234245
{
235-
_logger?.LogDebug("Health check task started");
236-
237246
while (!_disposed && _shouldReconnect)
238247
{
239248
try
@@ -258,20 +267,15 @@ private async Task RunHealthCheckAsync()
258267
// 检查连接状态
259268
if (!_client.Connected && !_isReconnecting)
260269
{
261-
_logger?.LogWarning("Health check detected disconnection, triggering reconnect...");
262270
_ = TryReconnectAsync();
263271
}
264-
else if (_client.Connected)
265-
{
266-
_logger?.LogDebug("Health check: Connection is healthy");
267-
}
268272
}
269273
catch (Exception ex)
270274
{
271275
_logger?.LogError(ex, "Error during health check");
272276
}
273277
}
274-
278+
275279
_logger?.LogDebug("Health check task stopped");
276280
}
277281

@@ -343,7 +347,7 @@ public void Dispose()
343347
try
344348
{
345349
_cancellationTokenSource.Cancel();
346-
350+
347351
if (_client.Connected)
348352
{
349353
_client.Stop();

0 commit comments

Comments
 (0)