From 0ff5efcd5af41e6cf2dcd592c5d8b608b3e5cf7b Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Mon, 5 Aug 2024 13:01:07 -0700 Subject: [PATCH] feat ux improvements on control plane settings (#1924) --- extensions/vscode/package.json | 2 +- gui/src/components/ProfileSwitcher.tsx | 20 ++++++++++++++++--- gui/src/components/gui/StepContainer.tsx | 6 +++--- .../components/modelSelection/ModelSelect.tsx | 5 +++-- gui/src/pages/gui.tsx | 2 +- gui/src/redux/slices/miscSlice.ts | 13 +++++++++++- 6 files changed, 37 insertions(+), 11 deletions(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 9c47f34b0..cac67cba1 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -78,7 +78,7 @@ "continue.enableContinueForTeams": { "type": "boolean", "default": false, - "markdownDescription": "Enable Continue for teams beta features (requires window reload)" + "markdownDescription": "_(Requires window reload)_ Enable Continue for teams beta features. To sign in, click the person icon in the bottom right of the sidebar." }, "continue.showInlineTip": { "type": "boolean", diff --git a/gui/src/components/ProfileSwitcher.tsx b/gui/src/components/ProfileSwitcher.tsx index b9789acc4..7d3aa8410 100644 --- a/gui/src/components/ProfileSwitcher.tsx +++ b/gui/src/components/ProfileSwitcher.tsx @@ -7,7 +7,7 @@ import { import { ProfileDescription } from "core/config/ConfigHandler"; import { Fragment, useContext, useEffect, useState } from "react"; import ReactDOM from "react-dom"; -import { useSelector } from "react-redux"; +import { useDispatch, useSelector } from "react-redux"; import styled from "styled-components"; import { defaultBorderRadius, @@ -24,6 +24,7 @@ import { useWebviewListener } from "../hooks/useWebviewListener"; import { RootState } from "../redux/store"; import { getFontSize } from "../util"; import HeaderButtonWithText from "./HeaderButtonWithText"; +import { setLastControlServerBetaEnabledStatus } from "../redux/slices/miscSlice"; const StyledListbox = styled(Listbox)` background-color: ${vscBackground}; @@ -127,6 +128,11 @@ function ProfileSwitcher(props: {}) { const { session, logout, login } = useAuth(); const [profiles, setProfiles] = useState([]); + const dispatch = useDispatch(); + const lastControlServerBetaEnabledStatus = useSelector( + (state: RootState) => state.misc.lastControlServerBetaEnabledStatus, + ); + const selectedProfileId = useSelector( (store: RootState) => store.state.selectedProfileId, ); @@ -135,8 +141,16 @@ function ProfileSwitcher(props: {}) { useState(false); useEffect(() => { - ideMessenger.ide.getIdeSettings().then((settings) => { - setControlServerBetaEnabled(settings.enableControlServerBeta); + ideMessenger.ide.getIdeSettings().then(({ enableControlServerBeta }) => { + const shouldShowPopup = + !lastControlServerBetaEnabledStatus && enableControlServerBeta; + + if (shouldShowPopup) { + ideMessenger.ide.infoPopup("Continue for Teams enabled"); + } + + setControlServerBetaEnabled(enableControlServerBeta); + dispatch(setLastControlServerBetaEnabledStatus(enableControlServerBeta)); }); }, []); diff --git a/gui/src/components/gui/StepContainer.tsx b/gui/src/components/gui/StepContainer.tsx index 66af32a54..0d159b302 100644 --- a/gui/src/components/gui/StepContainer.tsx +++ b/gui/src/components/gui/StepContainer.tsx @@ -37,7 +37,7 @@ interface StepContainerProps { isFirst: boolean; isLast: boolean; index: number; - subtext?: string; + modelTitle?: string; } const ContentDiv = styled.div<{ isUserInput: boolean; fontSize?: number }>` @@ -132,10 +132,10 @@ function StepContainer(props: StepContainerProps) { fontSize: getFontSize() - 3, }} > - {props.subtext && ( + {props.modelTitle && (
- {props.subtext} + {props.modelTitle}
-
+ {modelSelectTitle(defaultModel) || "Select model"}{" "}
+ {options.map((option, idx) => ( diff --git a/gui/src/pages/gui.tsx b/gui/src/pages/gui.tsx index fa7065b49..c03712c60 100644 --- a/gui/src/pages/gui.tsx +++ b/gui/src/pages/gui.tsx @@ -483,7 +483,7 @@ function GUI() { onDelete={() => { dispatch(deleteMessage(index)); }} - subtext={ + modelTitle={ item.promptLogs?.[0]?.completionOptions?.model ?? "" } diff --git a/gui/src/redux/slices/miscSlice.ts b/gui/src/redux/slices/miscSlice.ts index e07340590..a01b02374 100644 --- a/gui/src/redux/slices/miscSlice.ts +++ b/gui/src/redux/slices/miscSlice.ts @@ -5,6 +5,7 @@ export const miscSlice = createSlice({ initialState: { takenAction: false, serverStatusMessage: "Continue Server Starting", + lastControlServerBetaEnabledStatus: false, }, reducers: { setTakenActionTrue: (state) => { @@ -13,8 +14,18 @@ export const miscSlice = createSlice({ setServerStatusMessage: (state, action: PayloadAction) => { state.serverStatusMessage = action.payload; }, + setLastControlServerBetaEnabledStatus: ( + state, + action: PayloadAction, + ) => { + state.lastControlServerBetaEnabledStatus = action.payload; + }, }, }); -export const { setTakenActionTrue, setServerStatusMessage } = miscSlice.actions; +export const { + setTakenActionTrue, + setServerStatusMessage, + setLastControlServerBetaEnabledStatus, +} = miscSlice.actions; export default miscSlice.reducer;