yuanrf 1 тиждень тому
батько
коміт
1abfe9c8f9

+ 3 - 0
OASystem/OASystem.Api/Controllers/AITestController.cs

@@ -387,6 +387,9 @@ namespace OASystem.API.Controllers
                     await Response.WriteAsync(NdjsonLine(chunk) + "\n", cancellationToken);
                     await Response.Body.FlushAsync(cancellationToken);
                 }
+
+                await Response.WriteAsync(JsonConvert.SerializeObject(new { phase = "success", text = "结束" }) + "\n", cancellationToken);
+                await Response.Body.FlushAsync(cancellationToken);
             }
             catch (OperationCanceledException)
             {

+ 6 - 1
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -13988,7 +13988,7 @@ FROM
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpPost]
-        public async Task<IActionResult> BusinessInvitationInstructionsFileContentStream(BusinessInvitationInstructionsFileDto dto)
+        public async Task<IActionResult> BusinessInvitationInstructionsFileContentStream([FromBody] BusinessInvitationInstructionsFileDto dto, CancellationToken cancellationToken = default)
         {
             if (dto.Diid < 1)
             {
@@ -14094,15 +14094,20 @@ FROM
 
             try
             {
+                cancellationToken.ThrowIfCancellationRequested();
                 await foreach (var chunk in _deepSeekService.ChatStreamAsync(chat, "deepseek-reasoner", 0.7f, 60000))
                 {
                     await Response.WriteAsync(NdjsonLine(chunk) + "\n");
                     await Response.Body.FlushAsync();
                 }
+
+                await Response.WriteAsync(JsonConvert.SerializeObject(new { phase = "success", text = "结束" }) + "\n");
+                await Response.Body.FlushAsync(cancellationToken);
             }
             catch (Exception ex)
             {
                 await Response.WriteAsync(JsonConvert.SerializeObject(new { phase = "error", text = ex.Message }) + "\n");
+                await Response.Body.FlushAsync(cancellationToken);
             }
 
             return new EmptyResult();