From 80332f1fb15f5792ac50d8ae84b3e973dfeafd48 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sun, 28 Dec 2025 21:07:15 +0100 Subject: [PATCH] Add sub-content image support with interfaces and types for Anthropic --- .../Provider/Anthropic/ISubContentImageSource.cs | 9 +++++++++ .../Provider/Anthropic/SubContentBase64Image.cs | 10 ++++++++++ .../Provider/Anthropic/SubContentImage.cs | 10 ++++++++++ .../Provider/Anthropic/SubContentImageType.cs | 7 +++++++ .../Provider/Anthropic/SubContentImageUrl.cs | 8 ++++++++ 5 files changed, 44 insertions(+) create mode 100644 app/MindWork AI Studio/Provider/Anthropic/ISubContentImageSource.cs create mode 100644 app/MindWork AI Studio/Provider/Anthropic/SubContentBase64Image.cs create mode 100644 app/MindWork AI Studio/Provider/Anthropic/SubContentImage.cs create mode 100644 app/MindWork AI Studio/Provider/Anthropic/SubContentImageType.cs create mode 100644 app/MindWork AI Studio/Provider/Anthropic/SubContentImageUrl.cs diff --git a/app/MindWork AI Studio/Provider/Anthropic/ISubContentImageSource.cs b/app/MindWork AI Studio/Provider/Anthropic/ISubContentImageSource.cs new file mode 100644 index 00000000..84015bdd --- /dev/null +++ b/app/MindWork AI Studio/Provider/Anthropic/ISubContentImageSource.cs @@ -0,0 +1,9 @@ +namespace AIStudio.Provider.Anthropic; + +public interface ISubContentImageSource +{ + /// + /// The type of the sub-content image. + /// + public SubContentImageType Type { get; } +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Provider/Anthropic/SubContentBase64Image.cs b/app/MindWork AI Studio/Provider/Anthropic/SubContentBase64Image.cs new file mode 100644 index 00000000..8123c814 --- /dev/null +++ b/app/MindWork AI Studio/Provider/Anthropic/SubContentBase64Image.cs @@ -0,0 +1,10 @@ +namespace AIStudio.Provider.Anthropic; + +public record SubContentBase64Image : ISubContentImageSource +{ + public SubContentImageType Type => SubContentImageType.BASE64; + + public string MediaType { get; init; } = string.Empty; + + public string Data { get; init; } = string.Empty; +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Provider/Anthropic/SubContentImage.cs b/app/MindWork AI Studio/Provider/Anthropic/SubContentImage.cs new file mode 100644 index 00000000..074f5db0 --- /dev/null +++ b/app/MindWork AI Studio/Provider/Anthropic/SubContentImage.cs @@ -0,0 +1,10 @@ +using AIStudio.Provider.OpenAI; + +namespace AIStudio.Provider.Anthropic; + +public record SubContentImage(SubContentType Type, ISubContentImageSource Source) : ISubContent +{ + public SubContentImage() : this(SubContentType.IMAGE, new SubContentImageUrl()) + { + } +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Provider/Anthropic/SubContentImageType.cs b/app/MindWork AI Studio/Provider/Anthropic/SubContentImageType.cs new file mode 100644 index 00000000..e94c2224 --- /dev/null +++ b/app/MindWork AI Studio/Provider/Anthropic/SubContentImageType.cs @@ -0,0 +1,7 @@ +namespace AIStudio.Provider.Anthropic; + +public enum SubContentImageType +{ + URL, + BASE64 +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Provider/Anthropic/SubContentImageUrl.cs b/app/MindWork AI Studio/Provider/Anthropic/SubContentImageUrl.cs new file mode 100644 index 00000000..0247a40c --- /dev/null +++ b/app/MindWork AI Studio/Provider/Anthropic/SubContentImageUrl.cs @@ -0,0 +1,8 @@ +namespace AIStudio.Provider.Anthropic; + +public record SubContentImageUrl : ISubContentImageSource +{ + public SubContentImageType Type => SubContentImageType.URL; + + public string Url { get; init; } = string.Empty; +} \ No newline at end of file