Use ReadOnlyMemory<byte> for binary data to eliminate UTF-16 transcoding (#1070)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> Co-authored-by: ericstj <8918108+ericstj@users.noreply.github.com> Co-authored-by: Eric StJohn <ericstj@microsoft.com>
This commit is contained in:
parent
a3ce9e9606
commit
80b1ad21d7
1 changed files with 400 additions and 103 deletions
|
|
@ -85,12 +85,7 @@ public class Program
|
|||
Name = $"Resource {i + 1}",
|
||||
MimeType = "application/octet-stream"
|
||||
});
|
||||
resourceContents.Add(new BlobResourceContents
|
||||
{
|
||||
Uri = uri,
|
||||
MimeType = "application/octet-stream",
|
||||
Blob = Convert.ToBase64String(buffer)
|
||||
});
|
||||
resourceContents.Add(BlobResourceContents.FromBytes(buffer, uri, "application/octet-stream"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -381,7 +376,7 @@ public class Program
|
|||
Role = Role.User,
|
||||
Content = new ImageContentBlock
|
||||
{
|
||||
Data = MCP_TINY_IMAGE,
|
||||
Data = System.Text.Encoding.UTF8.GetBytes(MCP_TINY_IMAGE),
|
||||
MimeType = "image/png"
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue