Skip to content

Commit 95e1d08

Browse files
authored
Merge pull request #341 from koadna/main
Fix null reference exception in AbstractionMapper.ToChatResponseUpdate
2 parents 47f02d6 + e279506 commit 95e1d08

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/OllamaSharp/MicrosoftAi/AbstractionMapper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,8 @@ public static ChatResponseUpdate ToChatResponseUpdate(ChatResponseStream? respon
358358
ModelId = done.Model
359359
};
360360
}
361-
362-
return new ChatResponseUpdate(ToAbstractionRole(response?.Message.Role), contents)
361+
362+
return new ChatResponseUpdate(ToAbstractionRole(response?.Message?.Role), contents)
363363
{
364364
// no need to set "Contents" as we set the text
365365
CreatedAt = response?.CreatedAt,
@@ -536,4 +536,4 @@ public static GeneratedEmbeddings<Embedding<float>> ToGeneratedEmbeddings(EmbedR
536536
}
537537
};
538538
}
539-
}
539+
}

0 commit comments

Comments
 (0)