Skip to content

Commit

Permalink
fix missing user message issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sdcb committed Dec 23, 2024
1 parent 2815586 commit fc0a40d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/BE/Controllers/Chats/Chats/ChatController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public async Task<IActionResult> StartConversationStreamed(
ParentId = req.MessageId,
};
db.Messages.Add(dbUserMessage);
existingMessages.Add(dbUserMessage.Id, MessageLiteDto.FromDB(dbUserMessage));
existingMessages.Add(-1, MessageLiteDto.FromDB(dbUserMessage));
}

Response.Headers.ContentType = "text/event-stream";
Expand Down Expand Up @@ -249,7 +249,7 @@ private static async Task<ChatSpanResponse> ProcessChatSpan(
OpenAIChatMessage[] messageToSend = await ((MessageLiteDto[])
[
..systemMessages.Where(x => x.Role == DBChatRole.System && x.SpanId == span.Id || x.SpanId == null),
..GetMessageTree(existingMessages, req.MessageId),
..GetMessageTree(filteredMessages, req.MessageId ?? -1),
])
.ToAsyncEnumerable()
.SelectAwait(async x => await x.ToOpenAI(fup, cancellationToken))
Expand Down

0 comments on commit fc0a40d

Please sign in to comment.