Skip to content

Commit

Permalink
Add function for new conversations
Browse files Browse the repository at this point in the history
  • Loading branch information
fallaciousreasoning committed Feb 25, 2025
1 parent 01fb947 commit 31db001
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions components/ai_chat/resources/page/state/conversation_context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -557,9 +557,16 @@ export function useConversation() {
return React.useContext(ConversationReactContext)
}

export function useIsNewConversation() {
const conversationContext = useConversation()
const aiChatContext = useAIChat()

// A conversation is new if it isn't in the list of visible conversations.
return !aiChatContext.visibleConversations.find(c => c.uuid === conversationContext.conversationUuid)
}

export function useSupportsAttachments() {
const aiChatContext = useAIChat()
const conversationContext = useConversation()
return aiChatContext.isStandalone
&& !aiChatContext.visibleConversations.find(c => c.uuid === conversationContext.conversationUuid)
const isNew = useIsNewConversation()
return aiChatContext.isStandalone && isNew
}

0 comments on commit 31db001

Please sign in to comment.