From 8e677d8ea47327513aa6b8ede711ccdc8334bd8d Mon Sep 17 00:00:00 2001 From: joelhulen Date: Fri, 9 Aug 2024 14:29:17 -0400 Subject: [PATCH 1/3] Add file name to message content and introduce constants --- .../Constants/Chat/MessageContentTypes.cs | 34 +++++++++++++++++++ .../Common/Models/Chat/MessageContent.cs | 6 ++++ 2 files changed, 40 insertions(+) create mode 100644 src/dotnet/Common/Constants/Chat/MessageContentTypes.cs diff --git a/src/dotnet/Common/Constants/Chat/MessageContentTypes.cs b/src/dotnet/Common/Constants/Chat/MessageContentTypes.cs new file mode 100644 index 0000000000..4fb7ba4598 --- /dev/null +++ b/src/dotnet/Common/Constants/Chat/MessageContentTypes.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FoundationaLLM.Common.Constants.Chat +{ + /// + /// + /// + public static class MessageContentTypes + { + /// + /// Plaintext and formatted text, such as markdown. + /// + public const string Text = "text"; + + /// + /// Image file link. + /// + public const string Image = "image"; + + /// + /// General file link. + /// + public const string File = "file"; + + /// + /// HTML file link. + /// + public const string Html = "html"; + } +} diff --git a/src/dotnet/Common/Models/Chat/MessageContent.cs b/src/dotnet/Common/Models/Chat/MessageContent.cs index 81d646862a..8486ca8e92 100644 --- a/src/dotnet/Common/Models/Chat/MessageContent.cs +++ b/src/dotnet/Common/Models/Chat/MessageContent.cs @@ -13,6 +13,12 @@ public class MessageContent [JsonPropertyName("type")] public string? Type { get; set; } + /// + /// The file name related to the Value, if applicable. + /// + [JsonPropertyName("file_name")] + public string? FileName { get; set; } + /// /// The value of the message content. /// From d0ad08ca55be9267cdbe1d24f85f2aeccc10f303 Mon Sep 17 00:00:00 2001 From: joelhulen Date: Fri, 9 Aug 2024 14:30:03 -0400 Subject: [PATCH 2/3] Handle processing message content items in the User Portal and rendering based on type --- src/ui/UserPortal/components/ChatMessage.vue | 46 +++++++++++++++++++- src/ui/UserPortal/js/types/index.ts | 7 +++ 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/ui/UserPortal/components/ChatMessage.vue b/src/ui/UserPortal/components/ChatMessage.vue index e91092569c..5125c10887 100644 --- a/src/ui/UserPortal/components/ChatMessage.vue +++ b/src/ui/UserPortal/components/ChatMessage.vue @@ -40,8 +40,23 @@ - - + +