mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.NET Workflows - Enhance support and validation for image input (#1274)
* Updated * Comments * Namespace * Comment * Cleanup * Update agent definition * Disable * Config * Enable
This commit is contained in:
+7
-2
@@ -131,7 +131,7 @@ internal static class ChatMessageExtensions
|
||||
return
|
||||
contentType switch
|
||||
{
|
||||
AgentMessageContentType.ImageUrl => new UriContent(contentValue, "image/*"),
|
||||
AgentMessageContentType.ImageUrl => GetImageContent(contentValue),
|
||||
AgentMessageContentType.ImageFile => new HostedFileContent(contentValue),
|
||||
_ => new TextContent(contentValue)
|
||||
};
|
||||
@@ -169,7 +169,7 @@ internal static class ChatMessageExtensions
|
||||
yield return
|
||||
contentItem?.GetProperty<StringDataValue>(TypeSchema.Message.Fields.ContentType)?.Value switch
|
||||
{
|
||||
TypeSchema.Message.ContentTypes.ImageUrl => new UriContent(contentValue.Value, "image/*"),
|
||||
TypeSchema.Message.ContentTypes.ImageUrl => GetImageContent(contentValue.Value),
|
||||
TypeSchema.Message.ContentTypes.ImageFile => new HostedFileContent(contentValue.Value),
|
||||
_ => new TextContent(contentValue.Value)
|
||||
};
|
||||
@@ -177,6 +177,11 @@ internal static class ChatMessageExtensions
|
||||
}
|
||||
}
|
||||
|
||||
private static AIContent GetImageContent(string uriText) =>
|
||||
uriText.StartsWith("data:", StringComparison.OrdinalIgnoreCase) ?
|
||||
new DataContent(uriText, "image/*") :
|
||||
new UriContent(uriText, "image/*");
|
||||
|
||||
private static TValue? GetProperty<TValue>(this RecordDataValue record, string name)
|
||||
where TValue : DataValue
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user