fix: improve org switching experience
This commit is contained in:
parent
2b089bc83d
commit
ed52c875e4
3 changed files with 7 additions and 17 deletions
|
|
@ -231,7 +231,7 @@ const TUIChat: React.FC<TUIChatProps> = ({
|
|||
const { handleConfigSelect, handleModelSelect } = useSelectors(
|
||||
configPath,
|
||||
setChatHistory,
|
||||
resetChatHistory,
|
||||
handleClear
|
||||
);
|
||||
|
||||
// Session selection handler
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ export function useCurrentMode() {
|
|||
export function useSelectors(
|
||||
configPath: string | undefined,
|
||||
setChatHistory: React.Dispatch<React.SetStateAction<any[]>>,
|
||||
resetChatHistory: () => void,
|
||||
handleClear: () => void,
|
||||
): {
|
||||
handleConfigSelect: (config: ConfigOption) => Promise<void>;
|
||||
handleModelSelect: (model: ModelOption) => Promise<void>;
|
||||
|
|
@ -115,7 +115,7 @@ export function useSelectors(
|
|||
},
|
||||
]);
|
||||
},
|
||||
onChatReset: resetChatHistory,
|
||||
handleClear,
|
||||
});
|
||||
|
||||
const { handleModelSelect } = useModelSelector({
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue