diff --git a/src/App.tsx b/src/App.tsx index 571b89dc..86c6c1c6 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -9,6 +9,9 @@ import SessionList from "./components/session-list" import MessageStream from "./components/message-stream" import PromptInput from "./components/prompt-input" import InfoView from "./components/info-view" +import AgentSelector from "./components/agent-selector" +import ModelSelector from "./components/model-selector" +import KeyboardHint from "./components/keyboard-hint" import { initMarkdown } from "./lib/markdown" import { useTheme } from "./lib/theme" import { createCommandRegistry } from "./lib/commands" @@ -78,14 +81,6 @@ const SessionView: Component<{ await sendMessage(props.instanceId, props.sessionId, prompt, attachments) } - async function handleAgentChange(agent: string) { - await updateSessionAgent(props.instanceId, props.sessionId, agent) - } - - async function handleModelChange(model: { providerId: string; modelId: string }) { - await updateSessionModel(props.instanceId, props.sessionId, model) - } - async function handleRevert(messageId: string) { const instance = instances().get(props.instanceId) if (!instance || !instance.client) return @@ -148,10 +143,6 @@ const SessionView: Component<{ instanceFolder={props.instanceFolder} sessionId={s().id} onSend={handleSendMessage} - agent={s().agent} - model={s().model} - onAgentChange={handleAgentChange} - onModelChange={handleModelChange} escapeInDebounce={props.escapeInDebounce} /> @@ -189,6 +180,29 @@ const App: Component = () => { return activeSessionId().get(instance.id) || null }) + const activeSessionForInstance = createMemo(() => { + const sessionId = activeSessionIdForInstance() + if (!sessionId || sessionId === "info") return null + return activeSessions().get(sessionId) ?? null + }) + + const handleSidebarAgentChange = async (agent: string) => { + const instance = activeInstance() + const sessionId = activeSessionIdForInstance() + if (!instance || !sessionId || sessionId === "info") return + await updateSessionAgent(instance.id, sessionId, agent) + } + + const handleSidebarModelChange = async (model: { providerId: string; modelId: string }) => { + const instance = activeInstance() + const sessionId = activeSessionIdForInstance() + if (!instance || !sessionId || sessionId === "info") return + await updateSessionModel(instance.id, sessionId, model) + } + + const DEFAULT_SESSION_SIDEBAR_WIDTH = 280 + const [sessionSidebarWidth, setSessionSidebarWidth] = createSignal(DEFAULT_SESSION_SIDEBAR_WIDTH) + async function handleSelectFolder(folderPath?: string, binaryPath?: string) { setIsSelectingFolder(true) try { @@ -813,24 +827,76 @@ const App: Component = () => { {(instance) => ( <> 0} fallback={}> -
- {/* Session List Sidebar */} - setActiveSession(instance().id, id)} - onClose={(id) => handleCloseSession(instance().id, id)} - onNew={() => handleNewSession(instance().id)} - /> +
+ {/* Session Sidebar */} +
+ setActiveSession(instance().id, id)} + onClose={(id) => handleCloseSession(instance().id, id)} + onNew={() => handleNewSession(instance().id)} + showHeader + showFooter={false} + headerContent={ +
+ Sessions +
+ {(() => { + const shortcut = keyboardRegistry.get("session-prev") + return shortcut ? : null + })()} + {(() => { + const shortcut = keyboardRegistry.get("session-next") + return shortcut ? : null + })()} +
+ +
+ } + onWidthChange={setSessionSidebarWidth} + /> +
+ + {(activeSession) => ( +
+ + +
+ )} +
+
{/* Main Content Area */} -
+
@@ -840,13 +906,15 @@ const App: Component = () => {
} > - + {(sessionId) => ( + + )}
} > diff --git a/src/components/agent-selector.tsx b/src/components/agent-selector.tsx index 181b735f..5ff794f6 100644 --- a/src/components/agent-selector.tsx +++ b/src/components/agent-selector.tsx @@ -53,7 +53,7 @@ export default function AgentSelector(props: AgentSelectorProps) { } return ( -
+ diff --git a/src/components/model-selector.tsx b/src/components/model-selector.tsx index 4eb68f10..34a33318 100644 --- a/src/components/model-selector.tsx +++ b/src/components/model-selector.tsx @@ -63,7 +63,7 @@ export default function ModelSelector(props: ModelSelectorProps) { }) return ( -
+