diff --git a/extensions/cli/src/ui/TUIChat.tsx b/extensions/cli/src/ui/TUIChat.tsx index 6c474df77..768563bc0 100644 --- a/extensions/cli/src/ui/TUIChat.tsx +++ b/extensions/cli/src/ui/TUIChat.tsx @@ -231,7 +231,7 @@ const TUIChat: React.FC = ({ const { handleConfigSelect, handleModelSelect } = useSelectors( configPath, setChatHistory, - resetChatHistory, + handleClear ); // Session selection handler diff --git a/extensions/cli/src/ui/hooks/useConfigSelector.ts b/extensions/cli/src/ui/hooks/useConfigSelector.ts index 4d57695ca..a04d88694 100644 --- a/extensions/cli/src/ui/hooks/useConfigSelector.ts +++ b/extensions/cli/src/ui/hooks/useConfigSelector.ts @@ -20,14 +20,14 @@ interface UseConfigSelectorProps { content: string; messageType: "system"; }) => void; - onChatReset: () => void; + handleClear: () => void; } const CONFIG_PATH = path.join(env.continueHome, "config.yaml"); export function useConfigSelector({ onMessage, - onChatReset, + handleClear }: UseConfigSelectorProps) { const { closeCurrentScreen } = useNavigation(); @@ -98,12 +98,6 @@ export function useConfigSelector({ // Only config path is changing, no organization switch needed await services.config.updateConfigPath(targetConfigPath); } else { - onMessage({ - role: "system", - content: `Switching to organization for ${config.name}...`, - messageType: "system" as const, - }); - // Switch organization first await services.auth.switchOrganization(config.organizationId ?? null); @@ -111,12 +105,8 @@ export function useConfigSelector({ // This avoids the double reload issue await services.config.updateConfigPath(targetConfigPath); } - - // Reset chat history - onChatReset(); - - // Clear the screen completely - process.stdout.write("\x1b[2J\x1b[H"); + + handleClear(); // Show success message onMessage({ diff --git a/extensions/cli/src/ui/hooks/useTUIChatHooks.ts b/extensions/cli/src/ui/hooks/useTUIChatHooks.ts index f79f29083..7ae87bb06 100644 --- a/extensions/cli/src/ui/hooks/useTUIChatHooks.ts +++ b/extensions/cli/src/ui/hooks/useTUIChatHooks.ts @@ -98,7 +98,7 @@ export function useCurrentMode() { export function useSelectors( configPath: string | undefined, setChatHistory: React.Dispatch>, - resetChatHistory: () => void, + handleClear: () => void, ): { handleConfigSelect: (config: ConfigOption) => Promise; handleModelSelect: (model: ModelOption) => Promise; @@ -115,7 +115,7 @@ export function useSelectors( }, ]); }, - onChatReset: resetChatHistory, + handleClear, }); const { handleModelSelect } = useModelSelector({