Improved RAG issue handling (#313)

This commit is contained in:
Thorsten Sommer 2025-03-08 11:14:20 +01:00 committed by GitHub
parent 3bfca45e11
commit df01ce188e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 6 deletions

View File

@ -44,8 +44,16 @@ public sealed class ContentText : IContent
// Call the RAG process. Right now, we only have one RAG process: // Call the RAG process. Right now, we only have one RAG process:
if (lastPrompt is not null) if (lastPrompt is not null)
{ {
var rag = new AISrcSelWithRetCtxVal(); try
chatThread = await rag.ProcessAsync(provider, lastPrompt, chatThread, token); {
var rag = new AISrcSelWithRetCtxVal();
chatThread = await rag.ProcessAsync(provider, lastPrompt, chatThread, token);
}
catch (Exception e)
{
var logger = Program.SERVICE_PROVIDER.GetService<ILogger<ContentText>>()!;
logger.LogError(e, "Skipping the RAG process due to an error.");
}
} }
// Store the last time we got a response. We use this later // Store the last time we got a response. We use this later

View File

@ -59,7 +59,8 @@
<MudText Typo="Typo.h6" Class="mt-3"> <MudText Typo="Typo.h6" Class="mt-3">
Embeddings Embeddings
</MudText> </MudText>
@if (!info.Embeddings.Any()) @* ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract *@
@if (info.Embeddings is null || !info.Embeddings.Any())
{ {
<MudJustifiedText Typo="Typo.body1" Color="Color.Info" Class="mb-3"> <MudJustifiedText Typo="Typo.body1" Color="Color.Info" Class="mb-3">
The data source does not provide any embedding information. The data source does not provide any embedding information.

View File

@ -130,7 +130,6 @@ public partial class DataSourceERI_V1InfoDialog : ComponentBase, IAsyncDisposabl
} }
this.retrievalInfoformation = retrievalInfoResult.Data ?? []; this.retrievalInfoformation = retrievalInfoResult.Data ?? [];
this.StateHasChanged(); this.StateHasChanged();
} }
catch (Exception e) catch (Exception e)

View File

@ -9,9 +9,10 @@ public abstract class ERIClientBase(string baseAddress) : IDisposable
{ {
WriteIndented = true, WriteIndented = true,
AllowTrailingCommas = true, AllowTrailingCommas = true,
PropertyNameCaseInsensitive = true,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase, PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
DictionaryKeyPolicy = JsonNamingPolicy.CamelCase, DictionaryKeyPolicy = JsonNamingPolicy.CamelCase,
PropertyNameCaseInsensitive = true, UnmappedMemberHandling = JsonUnmappedMemberHandling.Disallow,
Converters = Converters =
{ {
new JsonStringEnumConverter(JsonNamingPolicy.SnakeCaseUpper), new JsonStringEnumConverter(JsonNamingPolicy.SnakeCaseUpper),

View File

@ -1,3 +1,6 @@
# v0.9.32, build 207 (2025-03-xx xx:xx UTC) # v0.9.32, build 207 (2025-03-xx xx:xx UTC)
- Added the "Community & Code" section to the about page. It includes links to the GitHub repositories and the project website. - Added the "Community & Code" section to the about page. It includes links to the GitHub repositories and the project website.
- 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 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.