From 95c87f4763efd4ea576532ff60b836e64b22cd0e Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 20 Jan 2025 15:17:58 -0800 Subject: [PATCH 1/7] fix tutorial card logic --- gui/src/pages/gui/Chat.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 && (
From cef9116bd04352906bdd858866ce019aacf372f3 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 20 Jan 2025 19:19:09 -0800 Subject: [PATCH 2/7] tutorial card test --- .../vscode/e2e/selectors/GUI.selectors.ts | 25 +++++++++++ extensions/vscode/e2e/tests/GUI.test.ts | 42 ++++++++++++++++++- .../components/BestExperienceConfigForm.tsx | 2 + .../components/OnboardingCardTabs.tsx | 1 + gui/src/components/mainInput/TutorialCard.tsx | 7 +--- 5 files changed, 71 insertions(+), 6 deletions(-) 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..c6ee4d30c 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, @@ -45,7 +46,7 @@ describe("GUI Test", () => { await new EditorView().closeAllEditors(); }); - describe("Onboarding", () => { + describe.only("Onboarding", () => { it("should display correct panel description", async () => { const description = await GUISelectors.getDescription(view); @@ -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/mainInput/TutorialCard.tsx b/gui/src/components/mainInput/TutorialCard.tsx index 4e07ead6d..c94f63598 100644 --- a/gui/src/components/mainInput/TutorialCard.tsx +++ b/gui/src/components/mainInput/TutorialCard.tsx @@ -44,7 +44,7 @@ export function TutorialCard({ onClose }: TutorialCardProps) { const ideMessenger = useContext(IdeMessengerContext); 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 From 9109fb2cfc34fdc1613c9372c32b9f3d8ff7dcb8 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 20 Jan 2025 19:42:52 -0800 Subject: [PATCH 3/7] remove describe.only --- extensions/vscode/e2e/tests/GUI.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index c6ee4d30c..4369a917f 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -46,7 +46,7 @@ describe("GUI Test", () => { await new EditorView().closeAllEditors(); }); - describe.only("Onboarding", () => { + describe("Onboarding", () => { it("should display correct panel description", async () => { const description = await GUISelectors.getDescription(view); From 08cfd6a65e2b9e1d844e9f621a309c9da9d40fae Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 10:46:02 -0800 Subject: [PATCH 4/7] update image plugin styling --- gui/src/components/mainInput/TipTapEditor.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index 8b360457d..cde2975b7 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -303,7 +303,6 @@ function TipTapEditor(props: TipTapEditorProps) { "Images need to be in jpg or png format and less than 10MB in size.", ]); } - return undefined; } const { prevRef, nextRef, addRef } = useInputHistory(props.historyKey); @@ -351,7 +350,7 @@ function TipTapEditor(props: TipTapEditorProps) { }, }).configure({ HTMLAttributes: { - class: "editor-image bg-black object-contain max-h-[250px] w-full", + class: "object-contain max-h-[210px] max-w-full", }, }), Placeholder.configure({ @@ -802,7 +801,7 @@ function TipTapEditor(props: TipTapEditorProps) { const contextItem = rifWithContentsToContextItem( data.rangeInFileWithContents, ); - console.log(contextItem); + let index = 0; for (const el of editor.getJSON()?.content ?? []) { if (el.attrs?.item?.name === contextItem.name) { From 156301d213678dc6aa48fc4bec25ead3b525fd5a Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 13:12:07 -0800 Subject: [PATCH 5/7] padding between images --- gui/src/components/mainInput/TipTapEditor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index cde2975b7..232dafae3 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -350,7 +350,7 @@ function TipTapEditor(props: TipTapEditorProps) { }, }).configure({ HTMLAttributes: { - class: "object-contain max-h-[210px] max-w-full", + class: "object-contain max-h-[210px] max-w-full mx-1", }, }), Placeholder.configure({ From 17a976538714de453aaf78e6a94eba3f37b4dbe6 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 22 Jan 2025 10:31:01 -0800 Subject: [PATCH 6/7] remove getChatTitles --- core/config/load.ts | 13 ++++++++----- core/config/types.ts | 1 - core/index.d.ts | 1 - docs/docs/reference.md | 2 ++ gui/src/redux/thunks/session.ts | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) 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 63847aa14..a8b423bfd 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -986,7 +986,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/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); } From c8b47ea7ad26338a2e9d3c52289030ea3c252964 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 22 Jan 2025 17:43:01 -0800 Subject: [PATCH 7/7] codeblock action button makeover --- gui/src/components/gui/CopyIconButton.tsx | 7 +- .../StepContainerPreActionButtons.tsx | 76 ++++++------------- 2 files changed, 27 insertions(+), 56 deletions(-) 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 ( <> ` - 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} - + +
+ )} + ); }