Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sdcb committed Dec 18, 2024
1 parent 79ab5bb commit 505eca0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/BE/Controllers/Chats/Chats/ChatController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ ..await GetMessageTree(existingMessages, messageId).ToAsyncEnumerable().SelectAw
Response.Headers.CacheControl = "no-cache";
Response.Headers.Connection = "keep-alive";
stopId = stopService.CreateAndCombineCancellationToken(ref cancellationToken);
await YieldResponse(SseResponseLine.CreateStopId(stopId));
await YieldResponse(SseResponseLine.StopId(stopId));
everYield = true;
}
await YieldResponse(SseResponseLine.CreateSegment(seg.TextSegment));
await YieldResponse(SseResponseLine.Segment(seg.TextSegment));

if (cancellationToken.IsCancellationRequested)
{
Expand Down Expand Up @@ -236,7 +236,7 @@ ..await GetMessageTree(existingMessages, messageId).ToAsyncEnumerable().SelectAw
if (errorText != null)
{
dbAssistantMessage.MessageContents.Add(MessageContent.FromError(errorText));
await YieldResponse(SseResponseLine.CreateError(errorText));
await YieldResponse(SseResponseLine.Error(errorText));
}
dbAssistantMessage.Usage = icc.ToUserModelUsage(currentUser.Id, await clientInfoManager.GetClientInfo(cancellationToken), isApi: false);
db.Messages.Add(dbAssistantMessage);
Expand Down Expand Up @@ -264,7 +264,7 @@ private async Task YieldTitle(string title)
await YieldResponse(SseResponseLine.UpdateTitle(""));
foreach (string segment in TestChatService.UnicodeCharacterSplit(title))
{
await YieldResponse(SseResponseLine.CreateSegment(segment));
await YieldResponse(SseResponseLine.TitleSegment(segment));
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/BE/Controllers/Chats/Chats/Dtos/SseResponseLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public record SseResponseLine<T>

public static class SseResponseLine
{
public static SseResponseLine<string> CreateSegment(string segment)
public static SseResponseLine<string> Segment(string segment)
{
return new SseResponseLine<string>
{
Expand All @@ -27,7 +27,7 @@ public static SseResponseLine<string> CreateSegment(string segment)
};
}

public static SseResponseLine<string> CreateError(string error)
public static SseResponseLine<string> Error(string error)
{
return new SseResponseLine<string>
{
Expand Down Expand Up @@ -84,7 +84,7 @@ public static SseResponseLine<SseEndMessage> PostMessage(
};
}

public static SseResponseLine<string> CreateStopId(string stopId)
public static SseResponseLine<string> StopId(string stopId)
{
return new SseResponseLine<string>
{
Expand Down

0 comments on commit 505eca0

Please sign in to comment.