namespace AIStudio.Chat.Embedded; /// /// Decides when an embedded chat sends the message it opens with, see EmbeddedChat.OpeningMessage. /// public static class EmbeddedChatOpening { /// /// Tells whether an embedded chat sends its opening message now. /// /// /// The message may arrive after the chat loaded, e.g., when the parent learns it only then: it is sent all the /// same, as long as the user wrote nothing in the chat meanwhile. It is sent once per chat, also when sending /// fails and it waits in the field instead. /// /// The message the chat opens with, or null without one. /// The chat shown, or null while it loads. /// Whether the chat sent its opening message already. /// True when the chat sends the message now. public static bool SendsNow(ContentText? openingMessage, EmbeddedConversation? conversation, bool wasSent) => openingMessage is not null && !wasSent && conversation is { IsAvailable: true, IsRunning: false, UserMessageCount: 0 }; }