fix: Windows-Kompatibilität - Streaming, Execute-Deadlock, Plan-Modus bei Choice
- HttpResponseMessage mit using disposen (3 Stellen in AnthropicService) verhindert Socket-Exhaustion unter Windows (2 Connections/Host Limit) - SSE DisableBuffering() in ChatEndpoint für sofortigen Flush unter Windows - Execute: stdout/stderr vor WaitForExitAsync lesen statt danach verhindert Pipe-Deadlock bei vollem Buffer (Windows: 4KB) - Plan-Modus: Frontend sendet planMode bei Choice-Response mit Backend-Fallback auf vorherigen Chain entfernt - User-Entscheidung gilt
This commit is contained in:
1 parent
b40a872c29
commit
3e590a6d03
5 files changed
+19
-21
No files matched your search
@@ -52,19 +52,7 @@ public static class ChatEndpoint
|
||||
var userId = req.HttpContext.GetUserId();
|
||||
var maxIterations = config.GetValue<int>("MaxIterations", 100);
|
||||
|
||||
// Bei Choice-Response: planMode vom vorherigen Chain übernehmen
|
||||
var effectivePlanMode = body.PlanMode;
|
||||
if (isChoiceResponse && !effectivePlanMode)
|
||||
{
|
||||
var prevChainId = await chatService.FindChainWithToolCall(sessionId, body.ChoiceToolCallId);
|
||||
if (prevChainId != null)
|
||||
{
|
||||
var prevChain = await db.GetChain(prevChainId);
|
||||
if (prevChain != null) effectivePlanMode = prevChain.PlanMode;
|
||||
}
|
||||
}
|
||||
|
||||
var ctx = await chatService.PrepareContext(sessionId, userId, maxIterations, planMode: effectivePlanMode);
|
||||
var ctx = await chatService.PrepareContext(sessionId, userId, maxIterations, planMode: body.PlanMode);
|
||||
if (ctx == null)
|
||||
{
|
||||
res.StatusCode = 400;
|
||||
@@ -132,6 +120,10 @@ public static class ChatEndpoint
|
||||
res.Headers["Cache-Control"] = "no-cache";
|
||||
res.Headers["Connection"] = "keep-alive";
|
||||
|
||||
// Response-Buffering deaktivieren – wichtig für SSE unter Windows
|
||||
var bufferingFeature = res.HttpContext.Features.Get<Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature>();
|
||||
bufferingFeature?.DisableBuffering();
|
||||
|
||||
// ── Preparer-Agent Phase (vor dem Worker) ──
|
||||
if (ctx.Preparer != null && !isChoiceResponse)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user