Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Conversation Organization with Optimized Folder Structure #321

Merged
merged 13 commits into from
Jan 3, 2024
Prev Previous commit
Next Next commit
Assign new conversation to selected folder
  • Loading branch information
joriskalz committed Jan 1, 2024
commit fa5007cb3b029743bdccf6cf68e51b21f1434b49
19 changes: 14 additions & 5 deletions src/apps/chat/AppChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 66,10 @@ export function AppChat() {

const { chatLLM } = useChatLLM();

// Get the list of conversations from the store
const conversations = useChatStore(state => state.conversations);
// Get the list of conversations from the store
const conversations = useChatStore(state => state.conversations);

const addConversationToFolder = useFolderStore((state) => state.addConversationToFolder);

const {
chatPanes,
Expand Down Expand Up @@ -276,10 278,17 @@ export function AppChat() {

const handleConversationNew = React.useCallback(() => {
// activate an existing new conversation if present, or create another
setFocusedConversationId(newConversationId ? newConversationId : prependNewConversation(focusedSystemPurposeId ?? undefined));
const conversationId = newConversationId ? newConversationId : prependNewConversation(focusedSystemPurposeId ?? undefined);
setFocusedConversationId(conversationId);
composerTextAreaRef.current?.focus();
}, [focusedSystemPurposeId, newConversationId, prependNewConversation, setFocusedConversationId]);


// If a folder is selected, add the new conversation to the folder
if (selectedFolderId && conversationId) {
addConversationToFolder(selectedFolderId, conversationId);
}

}, [focusedSystemPurposeId, newConversationId, prependNewConversation, setFocusedConversationId, selectedFolderId, addConversationToFolder]);

const handleConversationImportDialog = () => setTradeConfig({ dir: 'import' });

const handleConversationExport = (conversationId: DConversationId | null) => setTradeConfig({ dir: 'export', conversationId });
Expand Down