use value kind

This commit is contained in:
Jicheng Lu 2024-04-16 14:48:55 -05:00
parent 46fdf455ee
commit 8af7466ecf

View file

@ -344,10 +344,12 @@ public class ConversationStateService : IConversationStateService, IDisposable
{
foreach (JsonProperty property in root.EnumerateObject())
{
var stateValue = property.Value.ToString();
var propertyValue = property.Value;
var stateValue = propertyValue.ToString();
if (!string.IsNullOrEmpty(stateValue))
{
if (bool.TryParse(stateValue, out _))
if (propertyValue.ValueKind == JsonValueKind.True ||
propertyValue.ValueKind == JsonValueKind.False)
{
stateValue = stateValue?.ToLower();
}