Azure-Samples / azure-search-openai-demo-csharp

A sample app for the Retrieval-Augmented Generation pattern running in Azure, using Azure Cognitive Search for retrieval and Azure OpenAI large language models to power ChatGPT-style and Q&A experiences.
MIT License
552 stars 345 forks source link

Blazor App has exception due to recent RetrievalMode change #275

Closed Eilon closed 4 months ago

Eilon commented 4 months ago

If you run the Blazor Client App it gets a yellow Blazor error bar and this exception:

image

blazor.webassembly.js:1  crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: Unable to set property 'IMudRadioGroup' on object of type 'MudBlazor.MudRadio`1[[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]'. The error was: MudRadioGroup<RetrievalMode> has a child MudRadio<System.String> with mismatching generic type.
System.InvalidOperationException: Unable to set property 'IMudRadioGroup' on object of type 'MudBlazor.MudRadio`1[[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]'. The error was: MudRadioGroup<RetrievalMode> has a child MudRadio<System.String> with mismatching generic type.
 ---> MudBlazor.Utilities.Exceptions.GenericTypeMismatchException: MudRadioGroup<RetrievalMode> has a child MudRadio<System.String> with mismatching generic type.
   at MudBlazor.MudRadioGroup`1[[Shared.Models.RetrievalMode, Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].CheckGenericTypeMatch(Object selectItem)
   at MudBlazor.MudRadio`1[[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].set_IMudRadioGroup(IMudRadioGroup value)
   at Microsoft.AspNetCore.Components.Reflection.PropertySetter.CallPropertySetter[MudRadio`1,IMudRadioGroup](Action`2 setter, Object target, Object value)
   at Microsoft.AspNetCore.Components.Reflection.PropertySetter.SetValue(Object target, Object value)
   at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.<SetProperties>g__SetProperty|3_0(Object target, PropertySetter writer, String parameterName, Object value)
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.<SetProperties>g__SetProperty|3_0(Object target, PropertySetter writer, String parameterName, Object value)
   at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.SetProperties(ParameterView& parameters, Object target)
   at Microsoft.AspNetCore.Components.ParameterView.SetParameterProperties(Object target)
   at Microsoft.AspNetCore.Components.ComponentBase.SetParametersAsync(ParameterView parameters)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.SupplyCombinedParameters(ParameterView directAndCascadingParameters)

The issue appears to have been introduced in this PR where the RetrievalMode was changed from a string to an enum: https://github.com/Azure-Samples/azure-search-openai-demo-csharp/pull/270

Eilon commented 4 months ago

PR to fix it is here: #276