mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-12 21:41:36 +00:00
Log error when attempting to deserialize IMessageBase in MessageBaseConverter
This commit is contained in:
parent
139c4fa036
commit
110932548e
@ -13,11 +13,14 @@ namespace AIStudio.Provider;
|
||||
/// </remarks>
|
||||
public sealed class MessageBaseConverter : JsonConverter<IMessageBase>
|
||||
{
|
||||
public override IMessageBase Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
private static readonly ILogger<MessageBaseConverter> LOGGER = Program.LOGGER_FACTORY.CreateLogger<MessageBaseConverter>();
|
||||
|
||||
public override IMessageBase? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
// Deserialization is not needed for request objects, as messages are only serialized
|
||||
// when sending requests to LLM providers.
|
||||
throw new NotImplementedException("Deserializing IMessageBase is not supported. This converter is only used for serializing request messages.");
|
||||
LOGGER.LogError("Deserializing IMessageBase is not supported. This converter is only used for serializing request messages.");
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, IMessageBase value, JsonSerializerOptions options)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user