Skip to content

Commit 9b2eaf1

Browse files
committed
refactor: remove unused NuGet.Config copy from Dockerfile and simplify cancellation logic in DocumentPendingService
1 parent d95c0e4 commit 9b2eaf1

File tree

4 files changed

+3
-32
lines changed

4 files changed

+3
-32
lines changed

NuGet.Config

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/KoalaWiki/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ EXPOSE 8081
77
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
88
ARG BUILD_CONFIGURATION=Release
99
WORKDIR /src
10-
COPY ["NuGet.Config", "."]
1110
COPY ["Directory.Packages.props", "."]
1211
COPY ["Directory.Build.props", "."]
1312
COPY ["src/KoalaWiki/KoalaWiki.csproj", "src/KoalaWiki/"]

src/KoalaWiki/KoalaWarehouse/DocumentPending/DocumentPendingService.cs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,10 @@ 3. Validation → Use Docs.Read after each MultiEdit to verify success before ne
228228
int inputTokenCount = 0;
229229
int outputTokenCount = 0;
230230
int maxRetries = 3;
231-
CancellationTokenSource token = null;
232-
233231
reset:
234232

235233
try
236234
{
237-
// 创建新的取消令牌(每次重试都重新创建)
238-
token?.Dispose();
239-
token = new CancellationTokenSource(TimeSpan.FromMinutes(30)); // 20分钟超时
240-
241235
Console.WriteLine($"开始处理文档 (尝试 {count}/{maxRetries + 1}),超时设置: 30分钟");
242236

243237
try
@@ -248,14 +242,8 @@ 3. Validation → Use Docs.Read after each MultiEdit to verify success before ne
248242
await foreach (var item in chat.GetStreamingChatMessageContentsAsync(
249243
history,
250244
settings,
251-
documentKernel,
252-
token.Token).ConfigureAwait(false))
245+
documentKernel).ConfigureAwait(false))
253246
{
254-
// 检查是否被取消
255-
token.Token.ThrowIfCancellationRequested();
256-
257-
// 更新最后活动时间
258-
lastActivityTime = DateTime.UtcNow;
259247
hasReceivedContent = true;
260248

261249
switch (item.InnerContent)
@@ -294,7 +282,7 @@ 3. Validation → Use Docs.Read after each MultiEdit to verify success before ne
294282
Console.WriteLine("警告: 没有接收到任何流式内容");
295283
}
296284
}
297-
catch (OperationCanceledException) when (token.Token.IsCancellationRequested)
285+
catch (OperationCanceledException)
298286
{
299287
Console.WriteLine("操作被取消 (超时或手动取消)");
300288

@@ -352,8 +340,6 @@ 3. Validation → Use Docs.Read after each MultiEdit to verify success before ne
352340
}
353341
finally
354342
{
355-
// 确保资源被正确释放
356-
token?.Dispose();
357343
Console.WriteLine("资源清理完成");
358344
}
359345

src/KoalaWiki/MCP/SseKeepAliveMiddleware.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Text;
2+
using ILogger = Microsoft.Extensions.Logging.ILogger;
23

34
namespace KoalaWiki.MCP;
45

0 commit comments

Comments
 (0)