mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 08:19:47 +00:00
Fixed the chat thread we use for the data retrieval
This commit is contained in:
parent
df01ce188e
commit
51bf077485
@ -79,12 +79,19 @@ public sealed class AISrcSelWithRetCtxVal : IRagProcess
|
|||||||
var dataContexts = new List<IRetrievalContext>();
|
var dataContexts = new List<IRetrievalContext>();
|
||||||
if (proceedWithRAG)
|
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:
|
// We kick off the retrieval process for each data source in parallel:
|
||||||
//
|
//
|
||||||
var retrievalTasks = new List<Task<IReadOnlyList<IRetrievalContext>>>(selectedDataSources.Count);
|
var retrievalTasks = new List<Task<IReadOnlyList<IRetrievalContext>>>(selectedDataSources.Count);
|
||||||
foreach (var dataSource in selectedDataSources)
|
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:
|
// Wait for all retrieval tasks to finish:
|
||||||
|
@ -3,4 +3,5 @@
|
|||||||
- Improved the ERI client to expect JSON responses and send JSON requests using camel case.
|
- Improved the ERI client to expect JSON responses and send JSON requests using camel case.
|
||||||
- Improved the ERI client to raise an error when the server responds with additional JSON data that is not expected.
|
- 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 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.
|
- 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.
|
Loading…
Reference in New Issue
Block a user