Merge branch 'main' of https://github.com/continuedev/continue into dallin/docsapalooza

This commit is contained in:
Dallin Romney 2025-01-23 10:44:58 -08:00
commit c61c22e40d
14 changed files with 112 additions and 74 deletions

View file

@ -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) {

View file

@ -947,7 +947,6 @@ declare global {
fontSize?: number;
displayRawMarkdown?: boolean;
showChatScrollbar?: boolean;
getChatTitles?: boolean;
codeWrap?: boolean;
}

1
core/index.d.ts vendored
View file

@ -994,7 +994,6 @@ export interface ContinueUIConfig {
fontSize?: number;
displayRawMarkdown?: boolean;
showChatScrollbar?: boolean;
getChatTitles?: boolean;
codeWrap?: boolean;
}

View file

@ -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.

View file

@ -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}")]`),

View file

@ -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", () => {

View file

@ -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"
/>
<InputSubtext>
<a
@ -133,6 +134,7 @@ function BestExperienceConfigForm({
placeholder="Enter your Mistral API Key"
value={autocompleteApiKey}
onChange={(e) => setAutocompleteApiKey(e.target.value)}
data-testid="best-autocomplete-api-key-input"
/>
<InputSubtext>
<a

View file

@ -84,6 +84,7 @@ export function OnboardingCardTabs({
key={tabType}
isActive={activeTab === tabType}
onClick={() => onTabClick(tabType as TabTitle)}
data-testid={`onboarding-tab-${tabType}`}
>
<p className="m-0 hidden font-medium md:block">
{titles.default}

View file

@ -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 (
<>
<HeaderButtonWithToolTip
tooltipPlacement="top"
tooltipPlacement={tooltipPlacement}
tabIndex={tabIndex}
text={copied ? "Copied" : "Copy"}
onClick={copyText}

View file

@ -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 mx-1",
},
}),
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) {

View file

@ -44,7 +44,7 @@ export function TutorialCard({ onClose }: TutorialCardProps) {
const ideMessenger = useContext(IdeMessengerContext);
return (
<TutorialCardDiv>
<TutorialCardDiv data-testid={`tutorial-card`}>
<CloseButton onClick={onClose}>
<XMarkIcon className="h-5 w-5" />
</CloseButton>
@ -57,10 +57,7 @@ export function TutorialCard({ onClose }: TutorialCardProps) {
<span
className="cursor-pointer underline"
onClick={() =>
ideMessenger.post(
"vscode/openMoveRightMarkdown",
undefined,
)
ideMessenger.post("vscode/openMoveRightMarkdown", undefined)
}
>
Move Chat panel to the right

View file

@ -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 (
<TopDiv
tabIndex={-1}
onMouseEnter={() => setHovering(true)}
onMouseLeave={() => setHovering(false)}
>
{children}
</TopDiv>
);
}
return (
<TopDiv
<div
tabIndex={-1}
onMouseEnter={() => setHovering(true)}
onMouseLeave={() => setHovering(false)}
className="bg-vsc-editor-background border-vsc-input-border relative rounded-md border-[1px] border-solid"
>
<HoverDiv>
<InnerHoverDiv isBottomToolbarPosition={isBottomToolbarPosition}>
<div className="h-full w-full overflow-hidden rounded-md">{children}</div>
{hovering && !isStreaming && (
<div
className="bg-vsc-editor-background border-0.5 border-vsc-input-border z-100 absolute right-3 z-50 flex -translate-y-1/2 gap-1.5 rounded-md border border-solid px-1 py-0.5"
style={{
top: !isBottomToolbarPosition ? 0 : "100%",
}}
>
{shouldRunTerminalCmd && (
<HeaderButtonWithToolTip
text="Run in terminal"
style={{ backgroundColor: vscEditorBackground }}
onClick={onClickRunTerminal}
tooltipPlacement={toolTipPlacement}
>
<CommandLineIcon className="h-4 w-4 text-gray-400" />
</HeaderButtonWithToolTip>
@ -140,6 +108,7 @@ export default function StepContainerPreActionButtons({
text="Apply"
style={{ backgroundColor: vscEditorBackground }}
onClick={onClickApply}
tooltipPlacement={toolTipPlacement}
>
<PlayIcon className="h-4 w-4 text-gray-400" />
</HeaderButtonWithToolTip>
@ -149,13 +118,16 @@ export default function StepContainerPreActionButtons({
onClick={() =>
ideMessenger.post("insertAtCursor", { text: codeBlockContent })
}
tooltipPlacement={toolTipPlacement}
>
<ArrowLeftEndOnRectangleIcon className="h-4 w-4 text-gray-400" />
</HeaderButtonWithToolTip>
<CopyIconButton text={codeBlockContent} />
</InnerHoverDiv>
</HoverDiv>
{children}
</TopDiv>
<CopyIconButton
text={codeBlockContent}
tooltipPlacement={toolTipPlacement}
/>
</div>
)}
</div>
);
}

View file

@ -550,7 +550,7 @@ export function Chat() {
</div>
)}
{showTutorialCard !== false && !onboardingCard.open && (
{showTutorialCard !== false && !onboardingCard.show && (
<div className="flex w-full justify-center">
<TutorialCard onClose={closeTutorialCard} />
</div>

View file

@ -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);
}