Skip to content

Commit 124d07a

Browse files
committed
Fix: Add create folder function
1 parent 1866bf0 commit 124d07a

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

src/components/chat/ChatHistoryList.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ interface ChatHistoryListProps {
99
activeConversationId: string | null;
1010
onSelectConversation: (conversationId: string) => void;
1111
onCreateNewChat: () => void;
12+
onCreateNewFolder: () => void;
1213
onRenameConversation: (conversationId: string, newTitle: string) => void;
1314
onDeleteConversation: (conversationId: string) => void;
1415
}
@@ -18,6 +19,7 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
1819
activeConversationId,
1920
onSelectConversation,
2021
onCreateNewChat,
22+
onCreateNewFolder,
2123
onRenameConversation,
2224
onDeleteConversation,
2325
}) => {
@@ -253,7 +255,7 @@ export const ChatHistoryList: React.FC<ChatHistoryListProps> = ({
253255

254256
<div className={`p-2 border-b border-gray-200 ${isCollapsed ? 'opacity-0 pointer-events-none' : 'flex justify-between items-center'}`}>
255257
<button
256-
onClick={onCreateNewChat}
258+
onClick={onCreateNewFolder}
257259
className="flex items-center justify-center p-2 text-sm font-medium text-gray-700 transition-colors bg-white border border-gray-300 rounded-md aspect-square hover:bg-gray-50 checked:outline-none checked:ring-2 checked:ring-blue-500"
258260
>
259261
<FolderPlus size={16}/>

src/components/ui/ConfirmDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
7171
};
7272

7373
return (
74-
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50">
74+
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50 mt-[29px]">
7575
<div
7676
className="relative w-full max-w-md p-6 mx-4 bg-white rounded-lg shadow-xl focus:outline-none"
7777
onClick={handleDialogClick}

src/pages/ChatPage.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,20 @@ export const ChatPage: React.FC<ChatPageProps> = ({
128128
}
129129
}, [SettingsService.getInstance().getSelectedModel(), isServiceInitialized]);
130130

131+
// Create a new folder
132+
const createNewFolder = useCallback(async () => {
133+
if (!isServiceInitialized || !chatServiceRef.current) return;
134+
135+
try {
136+
const chatService = chatServiceRef.current;
137+
138+
// Update the state with the new list of conversations
139+
140+
} catch (error) {
141+
console.error('Failed to create new folder:', error);
142+
}
143+
}, [isServiceInitialized]);
144+
131145
// Handle sending a message with streaming
132146
const handleSendMessage = async (content: string) => {
133147
if (!activeConversationId || !isServiceInitialized || !chatServiceRef.current) return;
@@ -290,6 +304,7 @@ export const ChatPage: React.FC<ChatPageProps> = ({
290304
activeConversationId={activeConversationId}
291305
onSelectConversation={handleSelectConversation}
292306
onCreateNewChat={createNewChat}
307+
onCreateNewFolder={createNewFolder}
293308
onRenameConversation={handleRenameConversation}
294309
onDeleteConversation={handleDeleteConversation}
295310
/>

src/types/chat.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export interface Conversation {
2727
export interface ConversationFolder{
2828
folderId: string;
2929
folderName: string;
30-
conversations: Conversation[];
3130
createdAt: Date;
3231
updatedAt: Date;
3332
colorFlag: string;

0 commit comments

Comments
 (0)