diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index 2ce444ef6b..6341579cae 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -8,7 +8,6 @@ import { AppSidebar } from './components/AppSidebar' import { Modals } from './components/Modals' import { ThemeProvider } from './contexts/ThemeContext' import { SidebarProvider } from '@/components/ui/sidebar' -import { useModalStore } from './stores/modalStore' import { useUIStore } from './stores/uiStore' import { RightPanel, @@ -32,13 +31,12 @@ function AppContent(): React.JSX.Element { createSession, selectSession, deleteSession, + clearCurrentSession, sendPrompt, cancelRequest, clearError, } = useApp() - const openModal = useModalStore((s) => s.openModal) - // UI state const sidebarOpen = useUIStore((s) => s.sidebarOpen) const setSidebarOpen = useUIStore((s) => s.setSidebarOpen) @@ -47,7 +45,7 @@ function AppContent(): React.JSX.Element { const [defaultAgentId, setDefaultAgentId] = useState('opencode') const handleNewSession = () => { - openModal('newSession') + clearCurrentSession() } const handleCreateSession = async (cwd: string) => { @@ -55,6 +53,13 @@ function AppContent(): React.JSX.Element { await createSession(cwd, defaultAgentId) } + const handleSelectFolder = async () => { + const dir = await window.electronAPI.selectDirectory() + if (dir) { + await createSession(dir, defaultAgentId) + } + } + const handleSelectSession = async (sessionId: string) => { // Select session (agent starts automatically via resumeSession) await selectSession(sessionId) @@ -105,7 +110,6 @@ function AppContent(): React.JSX.Element { updates={sessionUpdates} isProcessing={isProcessing} hasSession={!!currentSession} - onNewSession={handleNewSession} /> {/* Input */} @@ -114,6 +118,8 @@ function AppContent(): React.JSX.Element { onCancel={cancelRequest} isProcessing={isProcessing} disabled={!currentSession} + workingDirectory={currentSession?.workingDirectory} + onSelectFolder={handleSelectFolder} /> diff --git a/src/renderer/src/components/ChatView.tsx b/src/renderer/src/components/ChatView.tsx index 5e63ffae31..50a39f6b6f 100644 --- a/src/renderer/src/components/ChatView.tsx +++ b/src/renderer/src/components/ChatView.tsx @@ -5,7 +5,6 @@ import { useEffect, useRef, useState } from 'react' import ReactMarkdown from 'react-markdown' import remarkGfm from 'remark-gfm' import type { StoredSessionUpdate } from '../../../shared/types' -import { Button } from '@/components/ui/button' import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible' import { ChevronDown } from 'lucide-react' import { ToolCallItem, type ToolCall } from './ToolCallItem' @@ -16,10 +15,9 @@ interface ChatViewProps { updates: StoredSessionUpdate[] isProcessing: boolean hasSession: boolean - onNewSession?: () => void } -export function ChatView({ updates, isProcessing, hasSession, onNewSession }: ChatViewProps) { +export function ChatView({ updates, isProcessing, hasSession }: ChatViewProps) { const bottomRef = useRef(null) const pendingPermission = usePermissionStore((s) => s.pendingRequest) @@ -36,16 +34,11 @@ export function ChatView({ updates, isProcessing, hasSession, onNewSession }: Ch

Multica

-

+

{hasSession ? 'Start a conversation with your coding agent' - : 'Create a session to start chatting'} + : 'Select a folder below to start'}

- {!hasSession && onNewSession && ( - - )}
) diff --git a/src/renderer/src/components/MessageInput.tsx b/src/renderer/src/components/MessageInput.tsx index 6312962ff5..9e5540c131 100644 --- a/src/renderer/src/components/MessageInput.tsx +++ b/src/renderer/src/components/MessageInput.tsx @@ -2,7 +2,7 @@ * Message input component */ import { useState, useRef, useEffect } from 'react' -import { ArrowUp, Square } from 'lucide-react' +import { ArrowUp, Square, Folder } from 'lucide-react' import { Button } from '@/components/ui/button' interface MessageInputProps { @@ -11,6 +11,8 @@ interface MessageInputProps { isProcessing: boolean disabled: boolean placeholder?: string + workingDirectory?: string | null + onSelectFolder: () => Promise } export function MessageInput({ @@ -19,11 +21,18 @@ export function MessageInput({ isProcessing, disabled, placeholder = 'Type a message...', + workingDirectory, + onSelectFolder, }: MessageInputProps) { const [value, setValue] = useState('') const [isComposing, setIsComposing] = useState(false) const textareaRef = useRef(null) + // Get folder name from path + const folderName = workingDirectory + ? workingDirectory.split('/').filter(Boolean).pop() || workingDirectory + : null + // Auto-resize textarea useEffect(() => { const textarea = textareaRef.current @@ -55,11 +64,46 @@ export function MessageInput({ } const canSubmit = !disabled && value.trim().length > 0 + const hasFolder = !!workingDirectory + // Render folder selection mode when no folder is selected + if (!hasFolder) { + return ( +
+
+
+ {/* Folder selection prompt */} +
+ + Select a folder to start... + +
+ + {/* Bottom toolbar */} +
+ +
+
+
+
+ ) + } + + // Normal chat input mode return (
-
+
+ {/* Text input */}