SermonSearch.razorVersion:
1.0.0
Dependencies
Services:AdminSettingsService, UserService, SermonCollectionService, ConversationService, MessageService, ChatService, MarkdownService, CitationService, AuthenticationStateProvider, JS, Snackbar
Variables
Lifecycle Methods
Runtime Methods
StartNewConversationAsync(string, bool, int)
When there is no active conversation, this method calls several other methods to start a new conversation using the inputMessage as the first message.
BuildNewConversation(string)
Instantiates a Conversation object using inputMessage as the Conversation.LastMessage.
BuildStartingMessage(Conversation, bool, int)
Instantiates a Message object using newConversation.
GenerateConversationTitle(string)
Uses ChatService to generate an appropriate 3-5 word title, given the first message in a conversation.
SendMessage()
Checks if_activeSermonCollectionId is empty. If not, this method will either call StartNewConversationAsync or call several methods (including GenerateStreamingResponse) to add the message to the active conversation & stream a response.
BuildUserMessage()
Instantiates a newMessage object from user’s input.
GenerateStreamingResponse(string, string)
Instantiates a new system Message object, prompts Azure Open AI via ChatService using userMessage & sermonCollectionId, and asynchronously fills the new system message with a streaming response.
HandleKeyDown(KeyboardEventArgs)
Monitors for user to press Enter, triggering a SendMessage call.
SaveCitationsFromChatContext(List<ChatMessageContext>, string, string)
Asynchronous method to handle retrieving citations’ information from a streamed response & uses CitationService.AddNewCitationsAsync to save them to Cosmos DB.
TrimCitationContent(string, string)
Used to trim excess metadata off of a citation when ShowCitation is called
ShowCitation(Citation)
Set the state variables for displaying the active citation, given a Citation object.
SetActiveConversation(string)
Sets _activeSermonCollectionId to the sermon collection of the last message & calls ConversationService.SetActiveConversationByIdAsync().
UpdateMessageDictionaries()
Sets_messageCollectionImageSrc and _messageCollectionNames.
GetConversationClass(string)
Determines the class applied to conversations in the Conversation HistoryMudTabPanel.
ToggleDrawer(Anchor)
Toggles the right side drawer open & closed.
ShowStartScreen()
Clears_messages & sets the active conversation to null; returns the user to the start screen for a new conversation.
ClearAndFocusInputAsync()
Clears_userInputValue and focuses on the user input text field _userInputRef.
ToggleLoading()
Toggles_loading between true and false
StripHtmlTags(string)
Removes all HTML tags from input string.
