Fixed the chat thread we use for the data retrieval

This commit is contained in:
Thorsten Sommer 2025-03-08 11:32:38 +01:00
parent df01ce188e
commit 51bf077485
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 10 additions and 2 deletions

View File

@ -79,12 +79,19 @@ public sealed class AISrcSelWithRetCtxVal : IRagProcess
var dataContexts = new List<IRetrievalContext>();
if (proceedWithRAG)
{
//
// At this point in time, the chat thread contains already the
// last block, which is the waiting AI block. We need to remove
// this block before we call the RAG process:
//
var chatThreadWithoutWaitingAIBlock = chatThread with { Blocks = chatThread.Blocks[..^1] };
//
// We kick off the retrieval process for each data source in parallel:
//
var retrievalTasks = new List<Task<IReadOnlyList<IRetrievalContext>>>(selectedDataSources.Count);
foreach (var dataSource in selectedDataSources)
retrievalTasks.Add(dataSource.RetrieveDataAsync(lastPrompt, chatThread, token));
retrievalTasks.Add(dataSource.RetrieveDataAsync(lastPrompt, chatThreadWithoutWaitingAIBlock, token));
//
// Wait for all retrieval tasks to finish:

View File

@ -4,3 +4,4 @@
- Improved the ERI client to raise an error when the server responds with additional JSON data that is not expected.
- Improved the error handling in the ERI data source info dialog in cases where servers respond with an invalid message.
- Improved the error handling for the entire RAG process.
- Fixed the chat thread we use for the data retrieval by removing the last block, which is meant to be for the final AI answer.