diff --git a/core/config/load.ts b/core/config/load.ts index 689f53ca5..c1c3c4261 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -135,11 +135,14 @@ function loadSerializedConfig( config.allowAnonymousTelemetry = true; } - if (config.ui?.getChatTitles === undefined) { - config.ui = { - ...config.ui, - getChatTitles: true, - }; + // Deprecated getChatTitles property should be accounted for + // This is noted in docs + if ( + config.ui && + "getChatTitles" in config.ui && + config.ui.getChatTitles === false + ) { + config.disableSessionTitles = true; } if (ideSettings.remoteConfigServerUrl) { diff --git a/core/config/types.ts b/core/config/types.ts index e5797bdb7..269ae0e12 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -947,7 +947,6 @@ declare global { fontSize?: number; displayRawMarkdown?: boolean; showChatScrollbar?: boolean; - getChatTitles?: boolean; codeWrap?: boolean; } diff --git a/core/index.d.ts b/core/index.d.ts index 7707c04fc..5f2a39e17 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -994,7 +994,6 @@ export interface ContinueUIConfig { fontSize?: number; displayRawMarkdown?: boolean; showChatScrollbar?: boolean; - getChatTitles?: boolean; codeWrap?: boolean; } diff --git a/docs/docs/reference.md b/docs/docs/reference.md index d3c491f4c..8e2265d59 100644 --- a/docs/docs/reference.md +++ b/docs/docs/reference.md @@ -345,6 +345,8 @@ Example Prevents generating summary titles for each chat session when set to `true`. +Note that if the deprecated setting `ui.getChatTitles` is set to `false`, it will override this. + ### `ui` Customizable UI settings to control interface appearance and behavior. diff --git a/extensions/vscode/e2e/selectors/GUI.selectors.ts b/extensions/vscode/e2e/selectors/GUI.selectors.ts index 71a38c9f2..319157500 100644 --- a/extensions/vscode/e2e/selectors/GUI.selectors.ts +++ b/extensions/vscode/e2e/selectors/GUI.selectors.ts @@ -79,6 +79,31 @@ export class GUISelectors { ); } + public static getOnboardingTabButton(view: WebView, title: string) { + return SelectorUtils.getElementByDataTestId( + view, + `onboarding-tab-${title}`, + ); + } + + public static getBestChatApiKeyInput(view: WebView) { + return SelectorUtils.getElementByDataTestId( + view, + "best-chat-api-key-input", + ); + } + + public static getBestAutocompleteApiKeyInput(view: WebView) { + return SelectorUtils.getElementByDataTestId( + view, + "best-autocomplete-api-key-input", + ); + } + + public static getTutorialCard(view: WebView) { + return SelectorUtils.getElementByDataTestId(view, "tutorial-card"); + } + public static getThreadMessageByText(view: WebView, text: string) { return view.findWebElement( By.xpath(`//*[@class="thread-message"]//*[contains(text(), "${text}")]`), diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index 316db2d0e..4369a917f 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -1,5 +1,6 @@ import { expect } from "chai"; import { + By, EditorView, Key, VSBrowser, @@ -53,6 +54,45 @@ describe("GUI Test", () => { "Quickly get up and running using our API keys.", ); }).timeout(DEFAULT_TIMEOUT.XL); + + it("should display tutorial card after accepting onboarding quick start", async () => { + // Get paragraph with text Best + const bestTab = await GUISelectors.getOnboardingTabButton(view, "Best"); + await bestTab.click(); + + const anthropicInput = await TestUtils.waitForSuccess( + async () => await GUISelectors.getBestChatApiKeyInput(view), + ); + anthropicInput.sendKeys("invalid_api_key"); + + const mistralInput = + await GUISelectors.getBestAutocompleteApiKeyInput(view); + mistralInput.sendKeys("invalid_api_key"); + + // Get button with text "Connect" and click it + const connectButton = await view.findWebElement( + By.xpath("//button[text()='Connect']"), + ); + await connectButton.click(); + + await TestUtils.waitForSuccess( + async () => await GUISelectors.getTutorialCard(view), + ); + + // TODO validate that claude has been added to list + + // Skip testing Quick Start because github auth opens external app and breaks test + // const quickStartButton = await view.findWebElement( + // By.xpath("//*[contains(text(), 'Get started using our API keys')]") + // ); + // await quickStartButton.click(); + // await view.switchBack(); + // const allowButton = await TestUtils.waitForSuccess( + // async () => await driver.findElement(By.xpath(`//a[contains(text(), "Allow")]`)) + // ); + // await allowButton.click(); + // ({ view, driver } = await GUIActions.switchToReactIframe()); + }).timeout(DEFAULT_TIMEOUT.XL); }); describe("Chat", () => { diff --git a/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx b/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx index 575e1e8a3..86e7cd693 100644 --- a/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx +++ b/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx @@ -99,6 +99,7 @@ function BestExperienceConfigForm({ placeholder="Enter your Anthropic API Key" value={chatApiKey} onChange={(e) => setChatApiKey(e.target.value)} + data-testid="best-chat-api-key-input" /> setAutocompleteApiKey(e.target.value)} + data-testid="best-autocomplete-api-key-input" /> onTabClick(tabType as TabTitle)} + data-testid={`onboarding-tab-${tabType}`} >

{titles.default} diff --git a/gui/src/components/gui/CopyIconButton.tsx b/gui/src/components/gui/CopyIconButton.tsx index 560042026..c2fcfd322 100644 --- a/gui/src/components/gui/CopyIconButton.tsx +++ b/gui/src/components/gui/CopyIconButton.tsx @@ -1,7 +1,4 @@ import { CheckIcon, ClipboardIcon } from "@heroicons/react/24/outline"; -import { useContext, useState } from "react"; -import { IdeMessengerContext } from "../../context/IdeMessenger"; -import { isJetBrains } from "../../util"; import HeaderButtonWithToolTip from "./HeaderButtonWithToolTip"; import useCopy from "../../hooks/useCopy"; @@ -10,6 +7,7 @@ interface CopyIconButtonProps { tabIndex?: number; checkIconClassName?: string; clipboardIconClassName?: string; + tooltipPlacement?: "top" | "bottom"; } export function CopyIconButton({ @@ -17,13 +15,14 @@ export function CopyIconButton({ tabIndex, checkIconClassName = "h-4 w-4 text-green-400", clipboardIconClassName = "h-4 w-4 text-gray-400", + tooltipPlacement = "bottom", }: CopyIconButtonProps) { const { copyText, copied } = useCopy(text); return ( <> + @@ -57,10 +57,7 @@ export function TutorialCard({ onClose }: TutorialCardProps) { - ideMessenger.post( - "vscode/openMoveRightMarkdown", - undefined, - ) + ideMessenger.post("vscode/openMoveRightMarkdown", undefined) } > Move Chat panel to the right diff --git a/gui/src/components/markdown/StepContainerPreActionButtons.tsx b/gui/src/components/markdown/StepContainerPreActionButtons.tsx index 4ecce8315..641e17c13 100644 --- a/gui/src/components/markdown/StepContainerPreActionButtons.tsx +++ b/gui/src/components/markdown/StepContainerPreActionButtons.tsx @@ -1,5 +1,4 @@ import { useContext, useRef, useState } from "react"; -import styled from "styled-components"; import { CommandLineIcon, PlayIcon, @@ -19,36 +18,6 @@ import { selectUIConfig, } from "../../redux/slices/configSlice"; -const TopDiv = styled.div` - outline: 0.5px solid rgba(153, 153, 152); - outline-offset: -0.5px; - border-radius: ${defaultBorderRadius}; - margin-bottom: 8px; - background-color: ${vscEditorBackground}; -`; - -const HoverDiv = styled.div` - position: sticky; - top: 0; - left: 100%; - height: 0; - width: 0; - overflow: visible; - z-index: 100; -`; - -const InnerHoverDiv = styled.div<{ isBottomToolbarPosition: boolean }>` - position: absolute; - ${(props) => (props.isBottomToolbarPosition ? "bottom: 3px;" : "top: -11px;")} - right: 10px; - display: flex; - padding: 1px 2px; - gap: 4px; - border: 0.5px solid #8888; - border-radius: ${defaultBorderRadius}; - background-color: ${vscEditorBackground}; -`; - interface StepContainerPreActionButtonsProps { language: string | null; codeBlockContent: string; @@ -69,9 +38,12 @@ export default function StepContainerPreActionButtons({ const nextCodeBlockIndex = useAppSelector( (state) => state.session.codeBlockApplyStates.curIndex, ); - + const isStreaming = useAppSelector((state) => state.session.isStreaming); const isBottomToolbarPosition = uiConfig?.codeBlockToolbarPosition == "bottom"; + + const toolTipPlacement = isBottomToolbarPosition ? "top" : "bottom"; + const shouldRunTerminalCmd = !isJetBrains() && isTerminalCodeBlock(language, codeBlockContent); const isNextCodeBlock = nextCodeBlockIndex === codeBlockIndex; @@ -107,31 +79,27 @@ export default function StepContainerPreActionButtons({ !isNextCodeBlock, ); - if (!hovering) { - return ( - setHovering(true)} - onMouseLeave={() => setHovering(false)} - > - {children} - - ); - } - return ( - setHovering(true)} onMouseLeave={() => setHovering(false)} + className="bg-vsc-editor-background border-vsc-input-border relative rounded-md border-[1px] border-solid" > - - +

{children}
+ {hovering && !isStreaming && ( +
{shouldRunTerminalCmd && ( @@ -140,6 +108,7 @@ export default function StepContainerPreActionButtons({ text="Apply" style={{ backgroundColor: vscEditorBackground }} onClick={onClickApply} + tooltipPlacement={toolTipPlacement} > @@ -149,13 +118,16 @@ export default function StepContainerPreActionButtons({ onClick={() => ideMessenger.post("insertAtCursor", { text: codeBlockContent }) } + tooltipPlacement={toolTipPlacement} > - - - - {children} - + +
+ )} + ); } diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 3f36adcef..2d688a8b3 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -550,7 +550,7 @@ export function Chat() { )} - {showTutorialCard !== false && !onboardingCard.open && ( + {showTutorialCard !== false && !onboardingCard.show && (
diff --git a/gui/src/redux/thunks/session.ts b/gui/src/redux/thunks/session.ts index d9f35cfd6..c311df194 100644 --- a/gui/src/redux/thunks/session.ts +++ b/gui/src/redux/thunks/session.ts @@ -166,7 +166,7 @@ export const saveCurrentSession = createAsyncThunk< let title = state.session.title; if (title === NEW_SESSION_TITLE) { if ( - state.config.config?.ui?.getChatTitles && + !state.config.config?.disableSessionTitles && state.config.defaultModelTitle ) { let assistantResponse = state.session.history @@ -190,7 +190,7 @@ export const saveCurrentSession = createAsyncThunk< } } } - // Fallbacks if above doesn't work out or getChatTitles = false + // Fallbacks if above doesn't work out or session titles disabled if (title === NEW_SESSION_TITLE) { title = getChatTitleFromMessage(state.session.history[0].message); }