From 4341d240e574e774d5f6c6f7beae10eec5df8226 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 23 Mar 2025 10:57:33 -0700 Subject: [PATCH 01/40] fix kb shortcut for jb --- gui/src/components/modelSelection/ModeSelect.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gui/src/components/modelSelection/ModeSelect.tsx b/gui/src/components/modelSelection/ModeSelect.tsx index afc0588fa..8757f6694 100644 --- a/gui/src/components/modelSelection/ModeSelect.tsx +++ b/gui/src/components/modelSelection/ModeSelect.tsx @@ -157,7 +157,10 @@ function ModeSelect() { Chat - {getMetaKeyLabel()}L + + {getMetaKeyLabel()} + {jetbrains ? "J" : "L"} + {mode === "chat" && } From 3f83c0852385a8c136b0a8fd420c66726d1514df Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 23 Mar 2025 11:01:11 -0700 Subject: [PATCH 02/40] better border color in models section --- gui/src/pages/config/ModelRoleSelector.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/gui/src/pages/config/ModelRoleSelector.tsx b/gui/src/pages/config/ModelRoleSelector.tsx index bd777c44b..9c95f048b 100644 --- a/gui/src/pages/config/ModelRoleSelector.tsx +++ b/gui/src/pages/config/ModelRoleSelector.tsx @@ -2,7 +2,10 @@ import { Listbox, Transition } from "@headlessui/react"; import { CheckIcon, ChevronUpDownIcon } from "@heroicons/react/24/outline"; import { type ModelDescription } from "core"; import { Fragment } from "react"; -import { defaultBorderRadius } from "../../components"; +import { + defaultBorderRadius, + vscCommandCenterInactiveBorder, +} from "../../components"; import { ToolTip } from "../../components/gui/Tooltip"; import InfoHover from "../../components/InfoHover"; import { fontSize } from "../../util"; @@ -46,7 +49,11 @@ const ModelRoleSelector = ({
0 ? "hover:bg-vsc-input-background cursor-pointer" : "cursor-not-allowed opacity-50"} text-vsc-foreground relative m-0 flex w-full items-center justify-between rounded-md border border-solid px-1.5 py-0.5 text-left text-sm`} + style={{ + border: `1px solid ${vscCommandCenterInactiveBorder}`, + borderRadius: defaultBorderRadius, + }} + className={`bg-vsc-background ${models.length > 0 ? "hover:bg-vsc-input-background cursor-pointer" : "cursor-not-allowed opacity-50"} text-vsc-foreground relative m-0 flex w-full items-center justify-between px-1.5 py-0.5 text-left text-sm`} > {models.length === 0 ? ( {models.map((option, idx) => ( Date: Sun, 23 Mar 2025 11:10:32 -0700 Subject: [PATCH 03/40] make atmentiondropdown match size better --- .../mainInput/AtMentionDropdown/index.tsx | 14 +-- .../mainInput/Lump/sections/ModelsSection.tsx | 108 +++++++++--------- 2 files changed, 63 insertions(+), 59 deletions(-) diff --git a/gui/src/components/mainInput/AtMentionDropdown/index.tsx b/gui/src/components/mainInput/AtMentionDropdown/index.tsx index 176120153..0b354d902 100644 --- a/gui/src/components/mainInput/AtMentionDropdown/index.tsx +++ b/gui/src/components/mainInput/AtMentionDropdown/index.tsx @@ -25,6 +25,7 @@ import { } from "../.."; import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { setDialogMessage, setShowDialog } from "../../../redux/slices/uiSlice"; +import { fontSize } from "../../../util"; import FileIcon from "../../FileIcon"; import SafeImg from "../../SafeImg"; import AddDocsDialog from "../../dialogs/AddDocsDialog"; @@ -43,9 +44,7 @@ export function getIconFromDropdownItem( function DropdownIcon(props: { className?: string; item: ComboBoxItem }) { if (props.item.type === "action") { - return ( - - ); + return ; } const provider = @@ -83,7 +82,7 @@ const ItemsDiv = styled.div` box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0px 10px 20px rgba(0, 0, 0, 0.1); - font-size: 0.9rem; + font-size: ${fontSize(-2)}; overflow-x: hidden; overflow-y: auto; max-height: 330px; @@ -100,10 +99,11 @@ const ItemDiv = styled.div` border-radius: 0.4rem; display: block; margin: 0; - padding: 0.2rem 0.4rem; + padding: 2px 4px; text-align: left; width: 100%; color: ${vscForeground}; + font-size: ${fontSize(-2)}; &.is-selected { background-color: ${vscListActiveBackground}; @@ -372,7 +372,7 @@ const AtMentionDropdown = forwardRef((props: AtMentionDropdownProps, ref) => { textAlign: "right", minWidth: "30px", }} - className="ml-2 flex items-center overflow-hidden overflow-ellipsis whitespace-nowrap text-xs" + className="ml-2 flex items-center overflow-hidden overflow-ellipsis whitespace-nowrap" > {loadingSubmenuItem.description} @@ -417,7 +417,7 @@ const AtMentionDropdown = forwardRef((props: AtMentionDropdownProps, ref) => { opacity: isSelected ? 1 : 0, minWidth: "30px", }} - className="ml-2 flex items-center overflow-hidden overflow-ellipsis whitespace-nowrap text-xs" + className="ml-2 flex items-center overflow-hidden overflow-ellipsis whitespace-nowrap" > {item.description} {item.type === "contextProvider" && diff --git a/gui/src/components/mainInput/Lump/sections/ModelsSection.tsx b/gui/src/components/mainInput/Lump/sections/ModelsSection.tsx index cd16e8453..fa061716f 100644 --- a/gui/src/components/mainInput/Lump/sections/ModelsSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/ModelsSection.tsx @@ -11,6 +11,7 @@ import { updateConfig, } from "../../../../redux/slices/configSlice"; import { isJetBrains } from "../../../../util"; +import { AddBlockButton } from "./AddBlockButton"; export function ModelsSection() { const { selectedProfile } = useAuth(); @@ -51,60 +52,63 @@ export function ModelsSection() { } return ( -
- handleChatModelSelection(model)} - /> - handleRoleUpdate("autocomplete", model)} - /> - {/* Jetbrains has a model selector inline */} - {!jetbrains && ( +
+
handleRoleUpdate("edit", model)} + displayName="Chat" + description="Used in the chat interface" + models={config.modelsByRole.chat} + selectedModel={ + selectedChatModel + ? { + title: selectedChatModel.title, + provider: selectedChatModel.provider, + model: selectedChatModel.model, + } + : null + } + onSelect={(model) => handleChatModelSelection(model)} /> - )} - handleRoleUpdate("apply", model)} - /> - handleRoleUpdate("embed", model)} - /> - handleRoleUpdate("rerank", model)} - /> + handleRoleUpdate("autocomplete", model)} + /> + {/* Jetbrains has a model selector inline */} + {!jetbrains && ( + handleRoleUpdate("edit", model)} + /> + )} + handleRoleUpdate("apply", model)} + /> + handleRoleUpdate("embed", model)} + /> + handleRoleUpdate("rerank", model)} + /> +
+
); } From fd7f3dc93b0208a5de051da3cc1ebef482f3c8e8 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 23 Mar 2025 13:06:19 -0700 Subject: [PATCH 04/40] load secrets from local config --- core/config/ConfigHandler.ts | 2 +- .../profile/ControlPlaneProfileLoader.ts | 1 + core/config/profile/LocalProfileLoader.ts | 1 + core/config/profile/PlatformProfileLoader.ts | 7 +++--- core/config/profile/doLoadConfig.ts | 3 ++- core/config/yaml/loadYaml.ts | 22 ++++++++++--------- extensions/vscode/package-lock.json | 4 ++-- 7 files changed, 23 insertions(+), 17 deletions(-) diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 7db61161a..3a3c81fab 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -199,8 +199,8 @@ export class ConfigHandler { this.ide, this.ideSettingsPromise, this.writeLog, - this.reloadConfig.bind(this), assistant.rawYaml, + selectedOrgId, ); return new ProfileLifecycleManager(profileLoader, this.ide); diff --git a/core/config/profile/ControlPlaneProfileLoader.ts b/core/config/profile/ControlPlaneProfileLoader.ts index 09a1846a4..85130676b 100644 --- a/core/config/profile/ControlPlaneProfileLoader.ts +++ b/core/config/profile/ControlPlaneProfileLoader.ts @@ -71,6 +71,7 @@ export default class ControlPlaneProfileLoader implements IProfileLoader { undefined, this.workspaceId, undefined, + null, ); } diff --git a/core/config/profile/LocalProfileLoader.ts b/core/config/profile/LocalProfileLoader.ts index 46245a7f0..464d16804 100644 --- a/core/config/profile/LocalProfileLoader.ts +++ b/core/config/profile/LocalProfileLoader.ts @@ -65,6 +65,7 @@ export default class LocalProfileLoader implements IProfileLoader { undefined, this.description.id, this.overrideAssistantFile?.path, + null, ); this.description.errors = result.errors; diff --git a/core/config/profile/PlatformProfileLoader.ts b/core/config/profile/PlatformProfileLoader.ts index 1eddedb6a..468d3511a 100644 --- a/core/config/profile/PlatformProfileLoader.ts +++ b/core/config/profile/PlatformProfileLoader.ts @@ -31,8 +31,8 @@ export default class PlatformProfileLoader implements IProfileLoader { private readonly ide: IDE, private ideSettingsPromise: Promise, private writeLog: (message: string) => Promise, - private readonly onReload: () => void, readonly description: ProfileDescription, + private readonly orgScopeId: string | null, ) {} static async create( @@ -45,8 +45,8 @@ export default class PlatformProfileLoader implements IProfileLoader { ide: IDE, ideSettingsPromise: Promise, writeLog: (message: string) => Promise, - onReload: () => void, rawYaml: string, + orgScopeId: string | null, ): Promise { const controlPlaneEnv = await getControlPlaneEnv(ideSettingsPromise); @@ -75,8 +75,8 @@ export default class PlatformProfileLoader implements IProfileLoader { ide, ideSettingsPromise, writeLog, - onReload, description, + orgScopeId, ); } @@ -102,6 +102,7 @@ export default class PlatformProfileLoader implements IProfileLoader { }, this.description.id, undefined, + this.orgScopeId, ); return { diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index 28371a220..5380cc408 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -45,6 +45,7 @@ export default async function doLoadConfig( platformConfigMetadata: PlatformConfigMetadata | undefined, profileId: string, overrideConfigYamlByPath: string | undefined, + orgScopeId: string | null, ): Promise> { const workspaceConfigs = await getWorkspaceConfigs(ide); const ideInfo = await ide.getIdeInfo(); @@ -70,7 +71,6 @@ export default async function doLoadConfig( if (overrideConfigYaml || fs.existsSync(configYamlPath)) { const result = await loadContinueConfigFromYaml( ide, - workspaceConfigs.map((c) => JSON.stringify(c)), ideSettings, ideInfo, uniqueId, @@ -80,6 +80,7 @@ export default async function doLoadConfig( platformConfigMetadata, controlPlaneClient, configYamlPath, + orgScopeId, ); newConfig = result.config; errors = result.errors; diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 1ca54337b..1a522eaf6 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -44,19 +44,22 @@ import { modifyAnyConfigWithSharedConfig } from "../sharedConfig"; import { llmsFromModelConfig } from "./models"; export class LocalPlatformClient implements PlatformClient { + constructor( + private orgScopeId: string | null, + private readonly client: ControlPlaneClient, + ) {} + async resolveFQSNs(fqsns: FQSN[]): Promise<(SecretResult | undefined)[]> { - return fqsns.map((fqsn) => { - return undefined; - }); + const response = await this.client.resolveFQSNs(fqsns, this.orgScopeId); + return response; } } async function loadConfigYaml( - workspaceConfigs: string[], rawYaml: string, overrideConfigYaml: AssistantUnrolled | undefined, - ide: IDE, controlPlaneClient: ControlPlaneClient, + orgScopeId: string | null, ): Promise> { let config = overrideConfigYaml ?? @@ -72,8 +75,8 @@ async function loadConfigYaml( { currentUserSlug: "", onPremProxyUrl: null, - orgScopeId: null, - platformClient: new LocalPlatformClient(), + orgScopeId, + platformClient: new LocalPlatformClient(orgScopeId, controlPlaneClient), renderSecrets: true, }, )); @@ -387,7 +390,6 @@ async function configYamlToContinueConfig( export async function loadContinueConfigFromYaml( ide: IDE, - workspaceConfigs: string[], ideSettings: IdeSettings, ideInfo: IdeInfo, uniqueId: string, @@ -397,6 +399,7 @@ export async function loadContinueConfigFromYaml( platformConfigMetadata: PlatformConfigMetadata | undefined, controlPlaneClient: ControlPlaneClient, configYamlPath: string | undefined, + orgScopeId: string | null, ): Promise> { const rawYaml = overrideConfigYaml === undefined @@ -407,11 +410,10 @@ export async function loadContinueConfigFromYaml( : ""; const configYamlResult = await loadConfigYaml( - workspaceConfigs, rawYaml, overrideConfigYaml, - ide, controlPlaneClient, + orgScopeId, ); if (!configYamlResult.config || configYamlResult.configLoadInterrupted) { diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index e8f7b966b..f1b847bfa 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.13", + "version": "1.1.14", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.13", + "version": "1.1.14", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", From 588dda88225df4a2268fa390582da505ae2969ab Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 23 Mar 2025 13:23:27 -0700 Subject: [PATCH 05/40] use model-proxy endpoint instead of /openai to avoid confusion --- core/llm/llms/stubs/ContinueProxy.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/llm/llms/stubs/ContinueProxy.ts b/core/llm/llms/stubs/ContinueProxy.ts index 01f62cd00..181db2abd 100644 --- a/core/llm/llms/stubs/ContinueProxy.ts +++ b/core/llm/llms/stubs/ContinueProxy.ts @@ -11,7 +11,7 @@ class ContinueProxy extends OpenAI { this.apiKey = value.workOsAccessToken; if (!this.onPremProxyUrl) { this.apiBase = new URL( - "openai/v1/", + "model-proxy/v1/", value.controlPlaneProxyUrl, ).toString(); } @@ -29,7 +29,7 @@ class ContinueProxy extends OpenAI { this.orgScopeId = options.orgScopeId; this.onPremProxyUrl = options.onPremProxyUrl; if (this.onPremProxyUrl) { - this.apiBase = new URL("openai/v1/", this.onPremProxyUrl).toString(); + this.apiBase = new URL("model-proxy/v1/", this.onPremProxyUrl).toString(); } } From f5802fd77035bd79d345f14467d83b20a8c19ab2 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 23 Mar 2025 13:25:41 -0700 Subject: [PATCH 06/40] ui polish --- gui/src/components/modelSelection/ModeSelect.tsx | 9 +++++++-- gui/src/components/modelSelection/ModelSelect.tsx | 11 ++++++++--- gui/src/components/modelSelection/platform/shared.tsx | 8 ++++++-- gui/src/pages/config/AccountButton.tsx | 7 ++++++- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/gui/src/components/modelSelection/ModeSelect.tsx b/gui/src/components/modelSelection/ModeSelect.tsx index 8757f6694..340db7604 100644 --- a/gui/src/components/modelSelection/ModeSelect.tsx +++ b/gui/src/components/modelSelection/ModeSelect.tsx @@ -11,7 +11,12 @@ import { MessageModes } from "core"; import { modelSupportsTools } from "core/llm/autodetect"; import { useEffect } from "react"; import styled from "styled-components"; -import { defaultBorderRadius, lightGray, vscInputBackground } from ".."; +import { + defaultBorderRadius, + lightGray, + vscCommandCenterInactiveBorder, + vscInputBackground, +} from ".."; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; import { selectDefaultModel } from "../../redux/slices/configSlice"; import { @@ -51,7 +56,7 @@ const StyledListboxOptions = styled(Listbox.Options)` display: flex; flex-direction: column; border-radius: ${defaultBorderRadius}; - border: 0.5px solid ${lightGray}; + border: 1px solid ${vscCommandCenterInactiveBorder}; background-color: ${vscInputBackground}; `; diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index 437e2304f..125ae410b 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -9,7 +9,12 @@ import { import { useContext, useEffect, useRef, useState } from "react"; import { useDispatch } from "react-redux"; import styled from "styled-components"; -import { defaultBorderRadius, lightGray, vscInputBackground } from ".."; +import { + defaultBorderRadius, + lightGray, + vscCommandCenterInactiveBorder, + vscInputBackground, +} from ".."; import { useAuth } from "../../context/Auth"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import AddModelForm from "../../forms/AddModelForm"; @@ -66,7 +71,7 @@ const StyledListboxOptions = styled(Listbox.Options)<{ $showabove: boolean }>` font-size: ${fontSize(-3)}; border-radius: ${defaultBorderRadius}; - border: 0.5px solid ${lightGray}; + border: 1px solid ${vscCommandCenterInactiveBorder}; background-color: ${vscInputBackground}; max-height: ${MAX_HEIGHT_PX}px; @@ -318,7 +323,7 @@ function ModelSelect() {
- + {sortedOptions.length > 0 && } {selectedProfile?.profileType === "local" && ( <> diff --git a/gui/src/components/modelSelection/platform/shared.tsx b/gui/src/components/modelSelection/platform/shared.tsx index 627d39133..b617fd34e 100644 --- a/gui/src/components/modelSelection/platform/shared.tsx +++ b/gui/src/components/modelSelection/platform/shared.tsx @@ -6,7 +6,11 @@ import { } from "@heroicons/react/24/outline"; import { useState } from "react"; import styled from "styled-components"; -import { defaultBorderRadius, lightGray } from "../.."; +import { + defaultBorderRadius, + lightGray, + vscCommandCenterInactiveBorder, +} from "../.."; import { ToolTip } from "../../gui/Tooltip"; export const OptionDiv = styled.div<{ @@ -45,7 +49,7 @@ export const MAX_HEIGHT_PX = 300; export const Divider = styled.div` height: 0.5px; - background-color: ${lightGray}; + background-color: ${vscCommandCenterInactiveBorder}; `; interface ModelOptionProps { diff --git a/gui/src/pages/config/AccountButton.tsx b/gui/src/pages/config/AccountButton.tsx index 0eaf4e471..03c050228 100644 --- a/gui/src/pages/config/AccountButton.tsx +++ b/gui/src/pages/config/AccountButton.tsx @@ -11,7 +11,12 @@ export function AccountButton() { if (!session) { return ( - login(false)}>Sign in + login(false)} + > + Sign in + ); } From c946c51b7eef7807260dec59b5e8e91b75b6bbd9 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 23 Mar 2025 13:26:00 -0700 Subject: [PATCH 07/40] ui polish --- gui/src/components/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/components/index.ts b/gui/src/components/index.ts index e4aad87c2..37dbc2441 100644 --- a/gui/src/components/index.ts +++ b/gui/src/components/index.ts @@ -133,7 +133,7 @@ export const Button = styled.button` export const SecondaryButton = styled.button` padding: 6px 12px; - margin: 8px 0; + margin: 8px; border-radius: ${defaultBorderRadius}; border: 1px solid ${vscInputBorder}; From 6c5405f7788acca3f70aaddcdf3f36dc52f21bf0 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 23 Mar 2025 14:18:17 -0700 Subject: [PATCH 08/40] allow loading private packages from local yaml --- core/config/yaml/loadYaml.ts | 11 ++++++++++- core/package-lock.json | 8 ++++---- core/package.json | 2 +- extensions/vscode/package-lock.json | 2 +- gui/package-lock.json | 10 +++++----- gui/package.json | 2 +- packages/config-yaml/package.json | 2 +- packages/config-yaml/src/registryClient.ts | 17 ++++++++++++++++- 8 files changed, 39 insertions(+), 15 deletions(-) diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 1a522eaf6..98a4d96e5 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -41,6 +41,7 @@ import { getSystemPromptDotFile } from "../getSystemPromptDotFile"; import { PlatformConfigMetadata } from "../profile/PlatformProfileLoader"; import { modifyAnyConfigWithSharedConfig } from "../sharedConfig"; +import { getControlPlaneEnvSync } from "../../control-plane/env"; import { llmsFromModelConfig } from "./models"; export class LocalPlatformClient implements PlatformClient { @@ -60,6 +61,7 @@ async function loadConfigYaml( overrideConfigYaml: AssistantUnrolled | undefined, controlPlaneClient: ControlPlaneClient, orgScopeId: string | null, + ideSettings: IdeSettings, ): Promise> { let config = overrideConfigYaml ?? @@ -71,7 +73,13 @@ async function loadConfigYaml( versionSlug: "", }, rawYaml, - new RegistryClient(), + new RegistryClient( + await controlPlaneClient.getAccessToken(), + getControlPlaneEnvSync( + ideSettings.continueTestEnvironment, + ideSettings.enableControlServerBeta, + ).CONTROL_PLANE_URL, + ), { currentUserSlug: "", onPremProxyUrl: null, @@ -414,6 +422,7 @@ export async function loadContinueConfigFromYaml( overrideConfigYaml, controlPlaneClient, orgScopeId, + ideSettings, ); if (!configYamlResult.config || configYamlResult.configLoadInterrupted) { diff --git a/core/package-lock.json b/core/package-lock.json index 765c3541e..f414891dd 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -13,7 +13,7 @@ "@aws-sdk/client-sagemaker-runtime": "^3.758.0", "@aws-sdk/credential-providers": "^3.758.0", "@continuedev/config-types": "^1.0.13", - "@continuedev/config-yaml": "^1.0.63", + "@continuedev/config-yaml": "^1.0.67", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.18", @@ -2973,9 +2973,9 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.0.63", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.63.tgz", - "integrity": "sha512-KBfyOUU/mWOXeNf6v+4IfMkbvfEEe/YP6n/g/reJBhrpApchG2A/P11JviH87N2To1SrhZxnW//0g5FIGupDFw==", + "version": "1.0.67", + "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.67.tgz", + "integrity": "sha512-RbJXSH2Z9XmaN1h9Dm0Qfru7UeAdCAEWMiEgJ9A2FGHysR9oxbQDqptk1Y61oDSpYeX+lWsxkz/SFIc2PjNnKg==", "dependencies": { "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", diff --git a/core/package.json b/core/package.json index a60eda4ad..7583ef044 100644 --- a/core/package.json +++ b/core/package.json @@ -46,7 +46,7 @@ "@aws-sdk/client-sagemaker-runtime": "^3.758.0", "@aws-sdk/credential-providers": "^3.758.0", "@continuedev/config-types": "^1.0.13", - "@continuedev/config-yaml": "^1.0.63", + "@continuedev/config-yaml": "^1.0.67", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.18", diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index f1b847bfa..6f0f06497 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -106,7 +106,7 @@ "@aws-sdk/client-sagemaker-runtime": "^3.758.0", "@aws-sdk/credential-providers": "^3.758.0", "@continuedev/config-types": "^1.0.13", - "@continuedev/config-yaml": "^1.0.63", + "@continuedev/config-yaml": "^1.0.66", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.18", diff --git a/gui/package-lock.json b/gui/package-lock.json index b0918360d..2d8b0125d 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -7,7 +7,7 @@ "name": "gui", "license": "Apache-2.0", "dependencies": { - "@continuedev/config-yaml": "^1.0.63", + "@continuedev/config-yaml": "^1.0.67", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", @@ -109,7 +109,7 @@ "@aws-sdk/client-sagemaker-runtime": "^3.758.0", "@aws-sdk/credential-providers": "^3.758.0", "@continuedev/config-types": "^1.0.13", - "@continuedev/config-yaml": "^1.0.63", + "@continuedev/config-yaml": "^1.0.67", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.18", @@ -551,9 +551,9 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.0.63", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.63.tgz", - "integrity": "sha512-KBfyOUU/mWOXeNf6v+4IfMkbvfEEe/YP6n/g/reJBhrpApchG2A/P11JviH87N2To1SrhZxnW//0g5FIGupDFw==", + "version": "1.0.67", + "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.67.tgz", + "integrity": "sha512-RbJXSH2Z9XmaN1h9Dm0Qfru7UeAdCAEWMiEgJ9A2FGHysR9oxbQDqptk1Y61oDSpYeX+lWsxkz/SFIc2PjNnKg==", "dependencies": { "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", diff --git a/gui/package.json b/gui/package.json index 6724bd757..20df90df1 100644 --- a/gui/package.json +++ b/gui/package.json @@ -15,7 +15,7 @@ "test:watch": "vitest" }, "dependencies": { - "@continuedev/config-yaml": "^1.0.63", + "@continuedev/config-yaml": "^1.0.67", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", diff --git a/packages/config-yaml/package.json b/packages/config-yaml/package.json index b395588ea..d7d96c4f0 100644 --- a/packages/config-yaml/package.json +++ b/packages/config-yaml/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-yaml", - "version": "1.0.63", + "version": "1.0.67", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/config-yaml/src/registryClient.ts b/packages/config-yaml/src/registryClient.ts index 66e7f9549..d6d3f28fc 100644 --- a/packages/config-yaml/src/registryClient.ts +++ b/packages/config-yaml/src/registryClient.ts @@ -2,9 +2,24 @@ import { Registry } from "./interfaces/index.js"; import { FullSlug } from "./interfaces/slugs.js"; export class RegistryClient implements Registry { + constructor( + private readonly accessToken?: string, + private readonly apiBase: string = "https://api.continue.dev/", + ) { + if (!this.apiBase.endsWith("/")) { + this.apiBase += "/"; + } + } async getContent(fullSlug: FullSlug): Promise { const response = await fetch( - `https://api.continue.dev/registry/v1/${fullSlug.ownerSlug}/${fullSlug.packageSlug}/${fullSlug.versionSlug}`, + `${this.apiBase}registry/v1/${fullSlug.ownerSlug}/${fullSlug.packageSlug}/${fullSlug.versionSlug}`, + { + headers: { + ...(this.accessToken + ? { Authorization: `Bearer ${this.accessToken}` } + : {}), + }, + }, ); const data = await response.json(); return data.content; From 2fd8112588d57e321116a6abece0c5b67a496d2b Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 23 Mar 2025 14:18:41 -0700 Subject: [PATCH 09/40] bump package.json --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index c96eee528..b855a8248 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "1.1.14", + "version": "1.1.15", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From 5ec3f88b87f67e891ff7770a3288e3ccfaf6806e Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 23 Mar 2025 15:55:44 -0700 Subject: [PATCH 10/40] fix loading hub blocks when signed out --- core/config/yaml/loadYaml.ts | 4 + core/control-plane/client.ts | 10 ++- .../mainInput/Lump/sections/RulesSection.tsx | 88 +++++++++---------- 3 files changed, 54 insertions(+), 48 deletions(-) diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 98a4d96e5..fdeffce07 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -51,6 +51,10 @@ export class LocalPlatformClient implements PlatformClient { ) {} async resolveFQSNs(fqsns: FQSN[]): Promise<(SecretResult | undefined)[]> { + if (fqsns.length === 0) { + return []; + } + const response = await this.client.resolveFQSNs(fqsns, this.orgScopeId); return response; } diff --git a/core/control-plane/client.ts b/core/control-plane/client.ts index dee4d7ef4..77a3dc108 100644 --- a/core/control-plane/client.ts +++ b/core/control-plane/client.ts @@ -5,6 +5,7 @@ import { FQSN, FullSlug, SecretResult, + SecretType, } from "@continuedev/config-yaml"; import fetch, { RequestInit, Response } from "node-fetch"; @@ -46,7 +47,14 @@ export class ControlPlaneClient { ): Promise<(SecretResult | undefined)[]> { const userId = await this.userId; if (!userId) { - throw new Error("No user id"); + return fqsns.map((fqsn) => ({ + found: false, + fqsn, + secretLocation: { + secretName: fqsn.secretName, + secretType: SecretType.NotFound, + }, + })); } const resp = await this.request("ide/sync-secrets", { diff --git a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx index 200472b22..d24316e9e 100644 --- a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx @@ -86,62 +86,56 @@ export function RulesSection() { }); return ( -
- {mergedRules.length === 0 ? ( -
-

No rules defined yet

-
- ) : ( -
- {mergedRules.map((rule, index) => { - if (!rule.ruleFromYaml) { - return ( - - ideMessenger.post("config/openProfile", { - profileId: undefined, - }) - } - title="Locally Defined Rule" - /> - ); - } +
+
+ {mergedRules.map((rule, index) => { + if (!rule.ruleFromYaml) { + return ( + + ideMessenger.post("config/openProfile", { + profileId: undefined, + }) + } + title="Locally Defined Rule" + /> + ); + } - if (typeof rule.ruleFromYaml === "string") { - const slug = `${selectedProfile?.fullSlug.ownerSlug}/${selectedProfile?.fullSlug.packageSlug}`; - - return ( - openUrl(`${slug}/new-version`)} - title="Inline Rule" - /> - ); - } - - if (!rule.ruleFromYaml?.uses) { - return null; - } - - const ruleSlug = rule.ruleFromYaml?.uses; + if (typeof rule.ruleFromYaml === "string") { + const slug = `${selectedProfile?.fullSlug.ownerSlug}/${selectedProfile?.fullSlug.packageSlug}`; return ( openUrl(`${ruleSlug}/new-version`)} - title={ruleSlug} + onClick={() => openUrl(`${slug}/new-version`)} + title="Inline Rule" /> ); - })} -
- )} + } + + if (!rule.ruleFromYaml?.uses) { + return null; + } + + const ruleSlug = rule.ruleFromYaml?.uses; + + return ( + openUrl(`${ruleSlug}/new-version`)} + title={ruleSlug} + /> + ); + })} +
); From f76b10c40e86fdd51ab893333427a3c10f6fb555 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Sun, 23 Mar 2025 22:49:28 -0700 Subject: [PATCH 11/40] various fixes --- .../Lump/BlockSettingsTopToolbar.tsx | 58 +++++++++---------- .../platform/AssistantSelect.tsx | 20 +++++-- .../platform/AssistantSelectOptions.tsx | 14 ++--- gui/src/pages/config/KeyboardShortcuts.tsx | 49 +++++++--------- gui/src/pages/config/index.tsx | 18 +++--- gui/src/pages/gui/Chat.tsx | 2 +- 6 files changed, 83 insertions(+), 78 deletions(-) diff --git a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx index f6abe9e85..a561d2e1c 100644 --- a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx +++ b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx @@ -98,38 +98,38 @@ export function BlockSettingsTopToolbar(props: BlockSettingsTopToolbarProps) { }; return ( -
-
- -
-
- {sections.map((section) => ( - - props.setSelectedSection( - props.selectedSection === section.id ? null : section.id, - ) - } - /> - ))} +
+
+
+ +
+
+ {sections.map((section) => ( + + props.setSelectedSection( + props.selectedSection === section.id ? null : section.id, + ) + } + /> + ))} +
-
- -
+
); } diff --git a/gui/src/components/modelSelection/platform/AssistantSelect.tsx b/gui/src/components/modelSelection/platform/AssistantSelect.tsx index 43caa02a9..214b1b495 100644 --- a/gui/src/components/modelSelection/platform/AssistantSelect.tsx +++ b/gui/src/components/modelSelection/platform/AssistantSelect.tsx @@ -5,19 +5,24 @@ import { useContext, useEffect, useRef } from "react"; import { useAuth } from "../../../context/Auth"; import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { cycleProfile } from "../../../redux"; -import { useAppDispatch } from "../../../redux/hooks"; +import { useAppDispatch, useAppSelector } from "../../../redux/hooks"; import { fontSize, isMetaEquivalentKeyPressed } from "../../../util"; import PopoverTransition from "../../mainInput/InputToolbar/bottom/PopoverTransition"; import AssistantIcon from "./AssistantIcon"; import { AssistantSelectOptions } from "./AssistantSelectOptions"; function AssistantSelectButton(props: { selectedProfile: ProfileDescription }) { + const isLumpToolbarExpanded = useAppSelector( + (state) => state.ui.isBlockSettingsToolbarExpanded, + ); return (
- +
- + {props.selectedProfile.title} Create your first assistant @@ -89,7 +94,12 @@ export default function AssistantSelect() { - + { if (buttonRef.current) { diff --git a/gui/src/components/modelSelection/platform/AssistantSelectOptions.tsx b/gui/src/components/modelSelection/platform/AssistantSelectOptions.tsx index c7b9caa80..a33bccc19 100644 --- a/gui/src/components/modelSelection/platform/AssistantSelectOptions.tsx +++ b/gui/src/components/modelSelection/platform/AssistantSelectOptions.tsx @@ -48,7 +48,7 @@ export function AssistantSelectOptions({ } return ( -
+
{profiles.map((profile, idx) => { return ( @@ -68,13 +68,13 @@ export function AssistantSelectOptions({ onClose(); }} > -
-
+
+
{profile.title} @@ -90,10 +90,10 @@ export function AssistantSelectOptions({ onClick={session ? onNewAssistant : () => login(false)} >
- + New Assistant
diff --git a/gui/src/pages/config/KeyboardShortcuts.tsx b/gui/src/pages/config/KeyboardShortcuts.tsx index 072223453..d393f43a8 100644 --- a/gui/src/pages/config/KeyboardShortcuts.tsx +++ b/gui/src/pages/config/KeyboardShortcuts.tsx @@ -1,3 +1,4 @@ +import { useMemo } from "react"; import styled from "styled-components"; import { defaultBorderRadius, @@ -7,16 +8,6 @@ import { import { ToolTip } from "../../components/gui/Tooltip"; import { getPlatform, isJetBrains } from "../../util"; -const GridDiv = styled.div` - display: grid; - grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); - grid-gap: 1rem; - padding: 1rem 0; - justify-items: center; - align-items: center; - overflow-x: hidden; -`; - const StyledKeyDiv = styled.div` border: 0.5px solid ${lightGray}; border-radius: ${defaultBorderRadius}; @@ -64,9 +55,9 @@ interface KeyboardShortcutProps { function KeyboardShortcut(props: KeyboardShortcutProps) { const shortcut = getPlatform() === "mac" ? props.mac : props.windows; return ( -
- {props.description} -
+
+ {props.description}: +
{shortcut.split(" ").map((key, i) => { return ; })} @@ -201,23 +192,25 @@ const jetbrainsShortcuts: KeyboardShortcutProps[] = [ ]; function KeyboardShortcuts() { + const shortcuts = useMemo(() => { + return isJetBrains() ? jetbrainsShortcuts : vscodeShortcuts; + }, []); + return ( -
+

Keyboard shortcuts

- - {(isJetBrains() ? jetbrainsShortcuts : vscodeShortcuts).map( - (shortcut, i) => { - return ( - - ); - }, - )} - +
+ {shortcuts.map((shortcut, i) => { + return ( + + ); + })} +
); } diff --git a/gui/src/pages/config/index.tsx b/gui/src/pages/config/index.tsx index a336cb69c..d4d50103e 100644 --- a/gui/src/pages/config/index.tsx +++ b/gui/src/pages/config/index.tsx @@ -32,30 +32,32 @@ function ConfigPage() { id: "settings", label: "Settings", component: , - icon: , + icon: , }, { id: "indexing", label: "Indexing", component: , - icon: , + icon: , }, { id: "help", label: "Help", component: , - icon: , + icon: ( + + ), }, { id: "shortcuts", label: "Shortcuts", component: , - icon: , + icon: , }, ]; return ( -
+
{/* Tab Headers */} -
+
{tabs.map((tab) => (
setActiveTab(tab.id)} @@ -85,7 +87,7 @@ function ConfigPage() {
{/* Tab Content */} -
+
{tabs.find((tab) => tab.id === activeTab)?.component}
diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index c75256813..653efcd3d 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -292,7 +292,7 @@ export function Chat() { 0 ? "flex-1" : ""}`} + className={`mt-[2px] overflow-y-scroll ${showPageHeader ? "" : "pt-[8px]"} ${showScrollbar ? "thin-scrollbar" : "no-scrollbar"} ${history.length > 0 ? "flex-1" : ""}`} > {highlights} {history.map((item, index: number) => ( From c285a9582da7c3cbf81667f7b7e42ce357120a47 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 24 Mar 2025 02:39:57 -0700 Subject: [PATCH 12/40] diff checker --- gui/src/components/mainInput/InputToolbar.tsx | 8 +- .../components/modelSelection/ModeSelect.tsx | 23 ++- .../components/modelSelection/ModelSelect.tsx | 175 +++++++--------- .../platform/AssistantSelect.tsx | 6 +- gui/src/components/usePopoverPosition.ts | 193 ++++++++++++++++++ 5 files changed, 292 insertions(+), 113 deletions(-) create mode 100644 gui/src/components/usePopoverPosition.ts diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index f3a8b975f..c4044dc5b 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -28,7 +28,7 @@ import { isMetaEquivalentKeyPressed, } from "../../util"; import { ToolTip } from "../gui/Tooltip"; -import ModelSelect from "../modelSelection/ModelSelect"; +import ExampleListbox from "../Listbox"; import ModeSelect from "../modelSelection/ModeSelect"; import HoverItem from "./InputToolbar/bottom/HoverItem"; @@ -116,7 +116,11 @@ function InputToolbar(props: InputToolbarProps) { >
- + + {/*
+ + +
*/}
{props.toolbarOptions?.hideImageUpload || (supportsImages && ( diff --git a/gui/src/components/modelSelection/ModeSelect.tsx b/gui/src/components/modelSelection/ModeSelect.tsx index afc0588fa..efb670ae6 100644 --- a/gui/src/components/modelSelection/ModeSelect.tsx +++ b/gui/src/components/modelSelection/ModeSelect.tsx @@ -9,7 +9,7 @@ import { } from "@heroicons/react/24/outline"; import { MessageModes } from "core"; import { modelSupportsTools } from "core/llm/autodetect"; -import { useEffect } from "react"; +import { useEffect, useMemo } from "react"; import styled from "styled-components"; import { defaultBorderRadius, lightGray, vscInputBackground } from ".."; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; @@ -25,6 +25,7 @@ import { getMetaKeyLabel, isJetBrains, } from "../../util"; +import Shortcut from "../gui/Shortcut"; const StyledListboxButton = styled(Listbox.Button)` font-family: inherit; @@ -81,7 +82,13 @@ function ModeSelect() { const mode = useAppSelector(selectCurrentMode); const selectedModel = useAppSelector(selectDefaultModel); const agentModeSupported = selectedModel && modelSupportsTools(selectedModel); - const jetbrains = isJetBrains(); + + const jetbrains = useMemo(() => { + return isJetBrains(); + }, []); + const metaKeyLabel = useMemo(() => { + return getMetaKeyLabel(); + }, []); const getModeIcon = (mode: MessageModes) => { switch (mode) { @@ -133,7 +140,9 @@ function ModeSelect() { className="flex items-center gap-1 rounded-full px-2 py-0.5 text-gray-400 transition-colors duration-200" > {getModeIcon(mode)} - {mode.charAt(0).toUpperCase() + mode.slice(1)} + + {mode.charAt(0).toUpperCase() + mode.slice(1)} +
diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index 437e2304f..00ed5fec3 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -1,4 +1,4 @@ -import { Listbox } from "@headlessui/react"; +import { Listbox, Transition } from "@headlessui/react"; import { CheckIcon, ChevronDownIcon, @@ -9,7 +9,7 @@ import { import { useContext, useEffect, useRef, useState } from "react"; import { useDispatch } from "react-redux"; import styled from "styled-components"; -import { defaultBorderRadius, lightGray, vscInputBackground } from ".."; +import { defaultBorderRadius, lightGray } from ".."; import { useAuth } from "../../context/Auth"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import AddModelForm from "../../forms/AddModelForm"; @@ -36,8 +36,6 @@ interface Option { apiKey?: string; } -const MAX_HEIGHT_PX = 300; - const StyledListboxButton = styled(Listbox.Button)` font-family: inherit; display: flex; @@ -53,30 +51,6 @@ const StyledListboxButton = styled(Listbox.Button)` } `; -const StyledListboxOptions = styled(Listbox.Options)<{ $showabove: boolean }>` - margin-top: 4px; - position: absolute; - list-style: none; - padding: 0px; - white-space: nowrap; - cursor: default; - - display: flex; - flex-direction: column; - - font-size: ${fontSize(-3)}; - border-radius: ${defaultBorderRadius}; - border: 0.5px solid ${lightGray}; - background-color: ${vscInputBackground}; - - max-height: ${MAX_HEIGHT_PX}px; - overflow-y: scroll; - - scrollbar-width: none; - - ${(props) => (props.$showabove ? "bottom: 100%;" : "top: 100%;")} -`; - const StyledListboxOption = styled(Listbox.Option)<{ isDisabled?: boolean }>` border-radius: ${defaultBorderRadius}; padding: 4px 12px; @@ -216,12 +190,6 @@ function ModelSelect() { ); }, [allModels]); - useEffect(() => { - const handleResize = () => calculatePosition(); - window.addEventListener("resize", handleResize); - return () => window.removeEventListener("resize", handleResize); - }, []); - useEffect(() => { const handleKeyDown = (event: KeyboardEvent) => { if (event.key === "'" && isMetaEquivalentKeyPressed(event as any)) { @@ -242,18 +210,6 @@ function ModelSelect() { }; }, [options, defaultModel]); - function calculatePosition() { - if (!buttonRef.current) { - return; - } - const rect = buttonRef.current.getBoundingClientRect(); - const spaceBelow = window.innerHeight - rect.bottom; - const spaceAbove = rect.top; - const dropdownHeight = MAX_HEIGHT_PX; - - setShowAbove(spaceBelow < dropdownHeight && spaceAbove > spaceBelow); - } - function onClickAddModel(e: MouseEvent) { e.stopPropagation(); e.preventDefault(); @@ -281,68 +237,83 @@ function ModelSelect() { dispatch(setDefaultModel({ title: val })); }} > -
- -
- - {modelSelectTitle(defaultModel) || "Select model"}{" "} - -
-
- -
( +
+ - {sortedOptions.map((option, idx) => ( - + + {modelSelectTitle(defaultModel) || "Select model"}{" "} + +
+
+ + + +
+ {sortedOptions.map((option, idx) => ( + + ))} +
-
- +
+ - {selectedProfile?.profileType === "local" && ( - <> - -
- - Add Chat model -
-
- - )} + {selectedProfile?.profileType === "local" && ( + <> + +
+ + Add Chat model +
+
+ + )} - + - - meta ' to toggle model - -
- -
+ + meta ' to toggle model + +
+ + +
+ )} ); } diff --git a/gui/src/components/modelSelection/platform/AssistantSelect.tsx b/gui/src/components/modelSelection/platform/AssistantSelect.tsx index 214b1b495..f5ed3105f 100644 --- a/gui/src/components/modelSelection/platform/AssistantSelect.tsx +++ b/gui/src/components/modelSelection/platform/AssistantSelect.tsx @@ -95,9 +95,11 @@ export default function AssistantSelect() { , +// // popoverRef: RefObject, +// // defaultHorizontalAlign: "left" | "right", +// // defaultVerticalAlign: "bottom" | "top", +// // ) => { +// // // const defaultSizes = useMemo(() => { +// // // return { +// // // minHeight: defaults?.minHeight ?? DEFAULT_POPOVER_MIN_HEIGHT, +// // // maxHeight: defaults?.maxHeight ?? DEFAULT_POPOVER_MAX_HEIGHT, +// // // minWidth: defaults?.minWidth ?? DEFAULT_POPOVER_MIN_WIDTH, +// // // maxWidth: defaults?.maxWidth ?? DEFAULT_POPOVER_MAX_WIDTH, +// // // }; +// // // }, [defaults]); + +// // const [styles, setStyles] = useState({ +// // top: defaultVerticalAlign === "top" ? "100%" : undefined, +// // bottom: defaultVerticalAlign === "bottom" ? "100%" : undefined, +// // right: defaultHorizontalAlign === "right" ? 0 : undefined, +// // left: defaultHorizontalAlign === "left" ? undefined : 0, +// // }); + +// // const calculatePosition = useCallback(() => { +// // if (!containerRef?.current || !popoverRef?.current) { +// // return; +// // } +// // const containerRect = containerRef.current.getBoundingClientRect(); +// // const popoverRect = popoverRef.current.getBoundingClientRect(); + +// // // Decide to show popup above or below and determine min/max height +// // const spaceBelow = window.innerHeight - rect.bottom; +// // const spaceAbove = rect.top; +// // const showBelow = spaceBelow > spaceAbove; +// // const verticalSpace = showBelow ? spaceBelow : spaceAbove; +// // // const maxHeight = Math.min(defaultSizes.maxHeight, verticalSpace); +// // // const minHeight = Math.min(defaultSizes.minHeight, verticalSpace); + +// // // Decide to show popup aligned left/right/left window/right window +// // const minWidth = Math.min(window.innerWidth, defaultSizes.minWidth); +// // const maxWidth = Math.min(window.innerWidth, defaultSizes.maxWidth); + +// // // const spaceRight = window.innerWidth - rect.left; // including container +// // // const spaceLeft = rect.right; // including container + +// // // const alignLeft = spaceRight > spaceLeft; + +// // // // TODO fix this optimization +// // // const horizontalSpace = alignLeft ? spaceRight : spaceLeft; +// // // const showCenter = horizontalSpace < defaultSizes.minWidth; + +// // const distanceToEdge = defaultAlign === "right" ? rect.right : window.innerWidth - rect.left; +// // const useAlign = distanceToEdge > maxWidth +// // // const aligne + +// // setStyles({ +// // top: showBelow ? "100%" : undefined, +// // bottom: showBelow ? undefined : "100%", +// // right: defaultAlign === "right" ? (useAlign ? 0 : undefined): undefined, +// // left: rect.right > maxWidth ? undefined : -rect.left, +// // }); + +// // // setPositionClass( +// // // `${showBelow ? "top-full" : "bottom-full"} ${align === "right" ? "right-0" : align === "left" ? "left-0" : "left-1/2 -translate-x-1/2"} `, +// // // ); +// // }, [containerRef.current, popoverRef.current, defaultHorizontalAlign, defaultVerticalAlign]); + +// // useEffect(() => { +// // calculatePosition(); + +// // if(!containerRef.current || popoverRef.current) { +// // return; +// // } + +// // const handleResize = () => calculatePosition(); +// // window.addEventListener("resize", handleResize); + +// // if(containerRef) +// // const containerObserver = new ResizeObserver((entries) => { +// // calculatePosition(); +// // }); +// // containerObserver.observe(containerRef.current); + +// // return () => { +// // observer.disconnect(); +// // }; + +// // const resizeObserver = new ResizeObserver() +// // containerRef.current?.addEventListener("resize") + +// // return () => window.removeEventListener("resize", handleResize); + +// // }, [calculatePosition, popoverRef.current,containerRef.current ]); + +// // const reCalculate = useCallback(() => { +// // calculatePosition(); +// // }, [calculatePosition]); + +// // return { styles, reCalculate }; +// // }; + +// import { RefObject, useEffect, useState } from "react"; + +// export const usePopoverPosition = ( +// containerRef: RefObject, +// popoverRef: RefObject, +// defaultHorizontalAlign: "left" | "right", +// defaultVerticalAlign: "bottom" | "top", +// ) => { +// const [styles, setStyles] = useState<{ [key: string]: number | string }>({}); + +// useEffect(() => { +// console.log(containerRef, popoverRef); +// const calculatePosition = () => { +// if (!containerRef.current || !popoverRef.current) return; + +// const containerRect = containerRef.current.getBoundingClientRect(); +// const popoverRect = popoverRef.current.getBoundingClientRect(); +// const windowWidth = window.innerWidth; +// const windowHeight = window.innerHeight; + +// // Calculate horizontal position +// let left: number | undefined; +// let right: number | undefined; + +// if (defaultHorizontalAlign === "left") { +// if (containerRect.left + popoverRect.width <= windowWidth) { +// left = containerRect.left; +// } else { +// right = windowWidth - containerRect.right; +// } +// } else { +// if (containerRect.right - popoverRect.width >= 0) { +// right = windowWidth - containerRect.right; +// } else { +// left = 0; +// } +// } + +// // Calculate vertical position +// let top: number | string | undefined; +// let bottom: number | string | undefined; + +// if (defaultVerticalAlign === "bottom") { +// if (containerRect.bottom + popoverRect.height <= windowHeight) { +// top = "100%"; +// } else { +// bottom = "100%"; +// } +// } else { +// if (containerRect.top - popoverRect.height >= 0) { +// bottom = "100%"; +// } else { +// top = "100%"; +// } +// } + +// setStyles({ +// ...(left !== undefined && { left }), +// ...(right !== undefined && { right }), +// ...(top !== undefined && { top }), +// ...(bottom !== undefined && { bottom }), +// // position: "fixed", +// }); +// }; + +// calculatePosition(); +// window.addEventListener("resize", calculatePosition); +// return () => window.removeEventListener("resize", calculatePosition); +// }, [containerRef, popoverRef, defaultHorizontalAlign, defaultVerticalAlign]); + +// return styles; +// }; From 2a0bfc19107bf1a143ed8ce7a902c83317f0633f Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 24 Mar 2025 02:42:53 -0700 Subject: [PATCH 13/40] revert half baked changes --- gui/src/components/mainInput/InputToolbar.tsx | 8 +- .../components/modelSelection/ModelSelect.tsx | 175 +++++++++------- .../platform/AssistantSelectOptions.tsx | 14 +- gui/src/components/usePopoverPosition.ts | 193 ------------------ 4 files changed, 111 insertions(+), 279 deletions(-) delete mode 100644 gui/src/components/usePopoverPosition.ts diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index c4044dc5b..f3a8b975f 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -28,7 +28,7 @@ import { isMetaEquivalentKeyPressed, } from "../../util"; import { ToolTip } from "../gui/Tooltip"; -import ExampleListbox from "../Listbox"; +import ModelSelect from "../modelSelection/ModelSelect"; import ModeSelect from "../modelSelection/ModeSelect"; import HoverItem from "./InputToolbar/bottom/HoverItem"; @@ -116,11 +116,7 @@ function InputToolbar(props: InputToolbarProps) { >
- - {/*
- - -
*/} +
{props.toolbarOptions?.hideImageUpload || (supportsImages && ( diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index 00ed5fec3..437e2304f 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -1,4 +1,4 @@ -import { Listbox, Transition } from "@headlessui/react"; +import { Listbox } from "@headlessui/react"; import { CheckIcon, ChevronDownIcon, @@ -9,7 +9,7 @@ import { import { useContext, useEffect, useRef, useState } from "react"; import { useDispatch } from "react-redux"; import styled from "styled-components"; -import { defaultBorderRadius, lightGray } from ".."; +import { defaultBorderRadius, lightGray, vscInputBackground } from ".."; import { useAuth } from "../../context/Auth"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import AddModelForm from "../../forms/AddModelForm"; @@ -36,6 +36,8 @@ interface Option { apiKey?: string; } +const MAX_HEIGHT_PX = 300; + const StyledListboxButton = styled(Listbox.Button)` font-family: inherit; display: flex; @@ -51,6 +53,30 @@ const StyledListboxButton = styled(Listbox.Button)` } `; +const StyledListboxOptions = styled(Listbox.Options)<{ $showabove: boolean }>` + margin-top: 4px; + position: absolute; + list-style: none; + padding: 0px; + white-space: nowrap; + cursor: default; + + display: flex; + flex-direction: column; + + font-size: ${fontSize(-3)}; + border-radius: ${defaultBorderRadius}; + border: 0.5px solid ${lightGray}; + background-color: ${vscInputBackground}; + + max-height: ${MAX_HEIGHT_PX}px; + overflow-y: scroll; + + scrollbar-width: none; + + ${(props) => (props.$showabove ? "bottom: 100%;" : "top: 100%;")} +`; + const StyledListboxOption = styled(Listbox.Option)<{ isDisabled?: boolean }>` border-radius: ${defaultBorderRadius}; padding: 4px 12px; @@ -190,6 +216,12 @@ function ModelSelect() { ); }, [allModels]); + useEffect(() => { + const handleResize = () => calculatePosition(); + window.addEventListener("resize", handleResize); + return () => window.removeEventListener("resize", handleResize); + }, []); + useEffect(() => { const handleKeyDown = (event: KeyboardEvent) => { if (event.key === "'" && isMetaEquivalentKeyPressed(event as any)) { @@ -210,6 +242,18 @@ function ModelSelect() { }; }, [options, defaultModel]); + function calculatePosition() { + if (!buttonRef.current) { + return; + } + const rect = buttonRef.current.getBoundingClientRect(); + const spaceBelow = window.innerHeight - rect.bottom; + const spaceAbove = rect.top; + const dropdownHeight = MAX_HEIGHT_PX; + + setShowAbove(spaceBelow < dropdownHeight && spaceAbove > spaceBelow); + } + function onClickAddModel(e: MouseEvent) { e.stopPropagation(); e.preventDefault(); @@ -237,83 +281,68 @@ function ModelSelect() { dispatch(setDefaultModel({ title: val })); }} > - {({ open }) => ( -
- + +
+ + {modelSelectTitle(defaultModel) || "Select model"}{" "} + +
+
+ +
-
- - {modelSelectTitle(defaultModel) || "Select model"}{" "} - -
- - - -
- {sortedOptions.map((option, idx) => ( - - ))} -
+ ))} +
-
- +
+ - {selectedProfile?.profileType === "local" && ( - <> - -
- - Add Chat model -
-
- - )} + {selectedProfile?.profileType === "local" && ( + <> + +
+ + Add Chat model +
+
+ + )} - + - - meta ' to toggle model - -
- - -
- )} + + meta ' to toggle model + +
+ +
); } diff --git a/gui/src/components/modelSelection/platform/AssistantSelectOptions.tsx b/gui/src/components/modelSelection/platform/AssistantSelectOptions.tsx index a33bccc19..c7b9caa80 100644 --- a/gui/src/components/modelSelection/platform/AssistantSelectOptions.tsx +++ b/gui/src/components/modelSelection/platform/AssistantSelectOptions.tsx @@ -48,7 +48,7 @@ export function AssistantSelectOptions({ } return ( -
+
{profiles.map((profile, idx) => { return ( @@ -68,13 +68,13 @@ export function AssistantSelectOptions({ onClose(); }} > -
-
+
+
{profile.title} @@ -90,10 +90,10 @@ export function AssistantSelectOptions({ onClick={session ? onNewAssistant : () => login(false)} >
- + New Assistant
diff --git a/gui/src/components/usePopoverPosition.ts b/gui/src/components/usePopoverPosition.ts deleted file mode 100644 index 33471b7b4..000000000 --- a/gui/src/components/usePopoverPosition.ts +++ /dev/null @@ -1,193 +0,0 @@ -// // import { RefObject, useCallback, useEffect, useMemo, useState } from "react"; - -// // interface PopoverSizes { -// // maxHeight: number; -// // minHeight: number; -// // minWidth: number; -// // maxWidth: number; -// // } - -// // interface PopoverStyles { -// // right?: number; -// // left?: number; -// // top?: string; -// // bottom?: string; -// // } - -// // const DEFAULT_POPOVER_MAX_HEIGHT = 300; -// // const DEFAULT_POPOVER_MIN_HEIGHT = 100; -// // const DEFAULT_POPOVER_MIN_WIDTH = 100; -// // const DEFAULT_POPOVER_MAX_WIDTH = 400; - -// // export const usePopoverPosition = ( -// // containerRef: RefObject, -// // popoverRef: RefObject, -// // defaultHorizontalAlign: "left" | "right", -// // defaultVerticalAlign: "bottom" | "top", -// // ) => { -// // // const defaultSizes = useMemo(() => { -// // // return { -// // // minHeight: defaults?.minHeight ?? DEFAULT_POPOVER_MIN_HEIGHT, -// // // maxHeight: defaults?.maxHeight ?? DEFAULT_POPOVER_MAX_HEIGHT, -// // // minWidth: defaults?.minWidth ?? DEFAULT_POPOVER_MIN_WIDTH, -// // // maxWidth: defaults?.maxWidth ?? DEFAULT_POPOVER_MAX_WIDTH, -// // // }; -// // // }, [defaults]); - -// // const [styles, setStyles] = useState({ -// // top: defaultVerticalAlign === "top" ? "100%" : undefined, -// // bottom: defaultVerticalAlign === "bottom" ? "100%" : undefined, -// // right: defaultHorizontalAlign === "right" ? 0 : undefined, -// // left: defaultHorizontalAlign === "left" ? undefined : 0, -// // }); - -// // const calculatePosition = useCallback(() => { -// // if (!containerRef?.current || !popoverRef?.current) { -// // return; -// // } -// // const containerRect = containerRef.current.getBoundingClientRect(); -// // const popoverRect = popoverRef.current.getBoundingClientRect(); - -// // // Decide to show popup above or below and determine min/max height -// // const spaceBelow = window.innerHeight - rect.bottom; -// // const spaceAbove = rect.top; -// // const showBelow = spaceBelow > spaceAbove; -// // const verticalSpace = showBelow ? spaceBelow : spaceAbove; -// // // const maxHeight = Math.min(defaultSizes.maxHeight, verticalSpace); -// // // const minHeight = Math.min(defaultSizes.minHeight, verticalSpace); - -// // // Decide to show popup aligned left/right/left window/right window -// // const minWidth = Math.min(window.innerWidth, defaultSizes.minWidth); -// // const maxWidth = Math.min(window.innerWidth, defaultSizes.maxWidth); - -// // // const spaceRight = window.innerWidth - rect.left; // including container -// // // const spaceLeft = rect.right; // including container - -// // // const alignLeft = spaceRight > spaceLeft; - -// // // // TODO fix this optimization -// // // const horizontalSpace = alignLeft ? spaceRight : spaceLeft; -// // // const showCenter = horizontalSpace < defaultSizes.minWidth; - -// // const distanceToEdge = defaultAlign === "right" ? rect.right : window.innerWidth - rect.left; -// // const useAlign = distanceToEdge > maxWidth -// // // const aligne - -// // setStyles({ -// // top: showBelow ? "100%" : undefined, -// // bottom: showBelow ? undefined : "100%", -// // right: defaultAlign === "right" ? (useAlign ? 0 : undefined): undefined, -// // left: rect.right > maxWidth ? undefined : -rect.left, -// // }); - -// // // setPositionClass( -// // // `${showBelow ? "top-full" : "bottom-full"} ${align === "right" ? "right-0" : align === "left" ? "left-0" : "left-1/2 -translate-x-1/2"} `, -// // // ); -// // }, [containerRef.current, popoverRef.current, defaultHorizontalAlign, defaultVerticalAlign]); - -// // useEffect(() => { -// // calculatePosition(); - -// // if(!containerRef.current || popoverRef.current) { -// // return; -// // } - -// // const handleResize = () => calculatePosition(); -// // window.addEventListener("resize", handleResize); - -// // if(containerRef) -// // const containerObserver = new ResizeObserver((entries) => { -// // calculatePosition(); -// // }); -// // containerObserver.observe(containerRef.current); - -// // return () => { -// // observer.disconnect(); -// // }; - -// // const resizeObserver = new ResizeObserver() -// // containerRef.current?.addEventListener("resize") - -// // return () => window.removeEventListener("resize", handleResize); - -// // }, [calculatePosition, popoverRef.current,containerRef.current ]); - -// // const reCalculate = useCallback(() => { -// // calculatePosition(); -// // }, [calculatePosition]); - -// // return { styles, reCalculate }; -// // }; - -// import { RefObject, useEffect, useState } from "react"; - -// export const usePopoverPosition = ( -// containerRef: RefObject, -// popoverRef: RefObject, -// defaultHorizontalAlign: "left" | "right", -// defaultVerticalAlign: "bottom" | "top", -// ) => { -// const [styles, setStyles] = useState<{ [key: string]: number | string }>({}); - -// useEffect(() => { -// console.log(containerRef, popoverRef); -// const calculatePosition = () => { -// if (!containerRef.current || !popoverRef.current) return; - -// const containerRect = containerRef.current.getBoundingClientRect(); -// const popoverRect = popoverRef.current.getBoundingClientRect(); -// const windowWidth = window.innerWidth; -// const windowHeight = window.innerHeight; - -// // Calculate horizontal position -// let left: number | undefined; -// let right: number | undefined; - -// if (defaultHorizontalAlign === "left") { -// if (containerRect.left + popoverRect.width <= windowWidth) { -// left = containerRect.left; -// } else { -// right = windowWidth - containerRect.right; -// } -// } else { -// if (containerRect.right - popoverRect.width >= 0) { -// right = windowWidth - containerRect.right; -// } else { -// left = 0; -// } -// } - -// // Calculate vertical position -// let top: number | string | undefined; -// let bottom: number | string | undefined; - -// if (defaultVerticalAlign === "bottom") { -// if (containerRect.bottom + popoverRect.height <= windowHeight) { -// top = "100%"; -// } else { -// bottom = "100%"; -// } -// } else { -// if (containerRect.top - popoverRect.height >= 0) { -// bottom = "100%"; -// } else { -// top = "100%"; -// } -// } - -// setStyles({ -// ...(left !== undefined && { left }), -// ...(right !== undefined && { right }), -// ...(top !== undefined && { top }), -// ...(bottom !== undefined && { bottom }), -// // position: "fixed", -// }); -// }; - -// calculatePosition(); -// window.addEventListener("resize", calculatePosition); -// return () => window.removeEventListener("resize", calculatePosition); -// }, [containerRef, popoverRef, defaultHorizontalAlign, defaultVerticalAlign]); - -// return styles; -// }; From a9d0d9723aad9c132e366426f88cefa4080cdc4e Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 24 Mar 2025 08:57:56 -0700 Subject: [PATCH 14/40] configyaml link provider --- extensions/vscode/package-lock.json | 6 +-- .../ConfigYamlDocumentLinkProvider.ts | 43 +++++++++++++++ .../vscode/src/extension/VsCodeExtension.ts | 7 +++ .../mainInput/Lump/EditBlockButton.tsx | 52 +++++++++++++++++++ .../Lump/sections/docs/DocsIndexingStatus.tsx | 32 +----------- packages/config-yaml/src/load/unroll.ts | 6 +++ 6 files changed, 113 insertions(+), 33 deletions(-) create mode 100644 extensions/vscode/src/extension/ConfigYamlDocumentLinkProvider.ts create mode 100644 gui/src/components/mainInput/Lump/EditBlockButton.tsx diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index e8f7b966b..22dd475e8 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.13", + "version": "1.1.15", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.13", + "version": "1.1.15", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", @@ -106,7 +106,7 @@ "@aws-sdk/client-sagemaker-runtime": "^3.758.0", "@aws-sdk/credential-providers": "^3.758.0", "@continuedev/config-types": "^1.0.13", - "@continuedev/config-yaml": "^1.0.63", + "@continuedev/config-yaml": "^1.0.67", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.18", diff --git a/extensions/vscode/src/extension/ConfigYamlDocumentLinkProvider.ts b/extensions/vscode/src/extension/ConfigYamlDocumentLinkProvider.ts new file mode 100644 index 000000000..1c0a76251 --- /dev/null +++ b/extensions/vscode/src/extension/ConfigYamlDocumentLinkProvider.ts @@ -0,0 +1,43 @@ +import * as vscode from "vscode"; + +export class ConfigYamlDocumentLinkProvider + implements vscode.DocumentLinkProvider +{ + private usesPattern = /^\s*#?\s*-\s*uses:\s*(.+)$/; + provideDocumentLinks( + document: vscode.TextDocument, + token: vscode.CancellationToken, + ): vscode.ProviderResult { + const links: vscode.DocumentLink[] = []; + + for (let lineIndex = 0; lineIndex < document.lineCount; lineIndex++) { + const line = document.lineAt(lineIndex); + const match = this.usesPattern.exec(line.text); + + if (match) { + const slug = match[1].trim(); + const startPos = line.text.indexOf(slug); + const range = new vscode.Range( + lineIndex, + startPos, + lineIndex, + startPos + slug.length, + ); + + const link = new vscode.DocumentLink( + range, + vscode.Uri.parse(`https://hub.continue.dev/${slug}`), + ); + links.push(link); + } + } + + return links; + } + resolveDocumentLink( + link: vscode.DocumentLink, + token: vscode.CancellationToken, + ): vscode.ProviderResult { + return link; + } +} diff --git a/extensions/vscode/src/extension/VsCodeExtension.ts b/extensions/vscode/src/extension/VsCodeExtension.ts index a4a90afd3..9441d70cd 100644 --- a/extensions/vscode/src/extension/VsCodeExtension.ts +++ b/extensions/vscode/src/extension/VsCodeExtension.ts @@ -37,6 +37,7 @@ import { Battery } from "../util/battery"; import { FileSearch } from "../util/FileSearch"; import { VsCodeIde } from "../VsCodeIde"; +import { ConfigYamlDocumentLinkProvider } from "./ConfigYamlDocumentLinkProvider"; import { VsCodeMessenger } from "./VsCodeMessenger"; import type { VsCodeWebviewProtocol } from "../webviewProtocol"; @@ -401,6 +402,12 @@ export class VsCodeExtension { ), ); + const linkProvider = vscode.languages.registerDocumentLinkProvider( + { language: "yaml" }, + new ConfigYamlDocumentLinkProvider(), + ); + context.subscriptions.push(linkProvider); + this.ide.onDidChangeActiveTextEditor((filepath) => { void this.core.invoke("didChangeActiveTextEditor", { filepath }); }); diff --git a/gui/src/components/mainInput/Lump/EditBlockButton.tsx b/gui/src/components/mainInput/Lump/EditBlockButton.tsx new file mode 100644 index 000000000..53cd82cfb --- /dev/null +++ b/gui/src/components/mainInput/Lump/EditBlockButton.tsx @@ -0,0 +1,52 @@ +import { ConfigYaml } from "@continuedev/config-yaml"; +import { PencilIcon } from "@heroicons/react/24/outline"; +import { useContext } from "react"; +import { useAuth } from "../../../context/Auth"; +import { IdeMessengerContext } from "../../../context/IdeMessenger"; + +type SectionKey = Exclude; + +interface EditBlockButtonProps { + blockType: T; + block?: NonNullable[number]; + className?: string; +} + +function isUsesBlock(block: any): block is { uses: string } { + return typeof block !== "string" && "uses" in block; +} + +export default function EditBlockButton({ + block, + blockType, + className = "", +}: EditBlockButtonProps) { + const ideMessenger = useContext(IdeMessengerContext); + const { selectedProfile } = useAuth(); + + const openUrl = (path: string) => + ideMessenger.request("controlPlane/openUrl", { + path, + orgSlug: undefined, + }); + + const handleEdit = () => { + if (selectedProfile?.profileType === "local") { + ideMessenger.post("config/openProfile", { + profileId: undefined, + }); + } else if (block && isUsesBlock(block)) { + openUrl(`${block.uses}/new-version`); + } else if (selectedProfile?.fullSlug) { + const slug = `${selectedProfile.fullSlug.ownerSlug}/${selectedProfile.fullSlug.packageSlug}`; + openUrl(`${slug}/new-version`); + } + }; + + return ( + + ); +} diff --git a/gui/src/components/mainInput/Lump/sections/docs/DocsIndexingStatus.tsx b/gui/src/components/mainInput/Lump/sections/docs/DocsIndexingStatus.tsx index 28e764360..7badfbc2d 100644 --- a/gui/src/components/mainInput/Lump/sections/docs/DocsIndexingStatus.tsx +++ b/gui/src/components/mainInput/Lump/sections/docs/DocsIndexingStatus.tsx @@ -2,12 +2,10 @@ import { ConfigYaml } from "@continuedev/config-yaml"; import { ArrowPathIcon, ArrowTopRightOnSquareIcon, - PencilIcon, StopIcon, } from "@heroicons/react/24/outline"; import { SiteIndexingConfig } from "core"; import { useContext, useMemo, useState } from "react"; -import { useAuth } from "../../../../../context/Auth"; import { IdeMessengerContext } from "../../../../../context/IdeMessenger"; import { useAppDispatch, useAppSelector } from "../../../../../redux/hooks"; import { updateIndexingStatus } from "../../../../../redux/slices/indexingSlice"; @@ -17,22 +15,18 @@ import { } from "../../../../../redux/slices/uiSlice"; import { fontSize } from "../../../../../util"; import ConfirmationDialog from "../../../../dialogs/ConfirmationDialog"; +import EditBlockButton from "../../EditBlockButton"; import { StatusIndicator } from "./StatusIndicator"; interface IndexingStatusViewerProps { docConfig: SiteIndexingConfig; docFromYaml?: NonNullable[number]; } -function isUsesBlock(block: any): block is { uses: string } { - return typeof block !== "string" && "uses" in block; -} - function DocsIndexingStatus({ docConfig, docFromYaml, }: IndexingStatusViewerProps) { const ideMessenger = useContext(IdeMessengerContext); - const { selectedProfile } = useAuth(); const dispatch = useAppDispatch(); const status = useAppSelector( @@ -78,25 +72,6 @@ function DocsIndexingStatus({ dispatch(setShowDialog(true)); }; - const openUrl = (path: string) => - ideMessenger.request("controlPlane/openUrl", { - path, - orgSlug: undefined, - }); - - const handleEdit = () => { - console.log("edit", docFromYaml); - if (selectedProfile?.profileType === "local") { - ideMessenger.post("config/openProfile", { - profileId: undefined, - }); - } else if (docFromYaml && isUsesBlock(docFromYaml)) { - openUrl(`${docFromYaml.uses}/new-version`); - } else if (selectedProfile?.fullSlug) { - const slug = `${selectedProfile.fullSlug.ownerSlug}/${selectedProfile.fullSlug.packageSlug}`; - openUrl(`${slug}/new-version`); - } - }; const progressPercentage = useMemo(() => { if (!status) { return 0; @@ -172,10 +147,7 @@ function DocsIndexingStatus({ /> )} - + {/* Removed StatusIndicator from here */}
diff --git a/packages/config-yaml/src/load/unroll.ts b/packages/config-yaml/src/load/unroll.ts index 5baa3deb9..f376fbc84 100644 --- a/packages/config-yaml/src/load/unroll.ts +++ b/packages/config-yaml/src/load/unroll.ts @@ -346,6 +346,12 @@ export async function resolveBlock( // Retrieve block raw yaml const rawYaml = await registry.getContent(fullSlug); + if (rawYaml === undefined) { + throw new Error( + `Block ${fullSlug.ownerSlug}/${fullSlug.packageSlug} not found`, + ); + } + // Convert any input secrets to FQSNs (they get FQSNs as if they are in the block. This is so that we know when to use models add-on / free trial secrets) const renderedInputs = inputsToFQSNs(inputs || {}, fullSlug); From 266047453f923a3eb77deec075ed089d7d59fc7c Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 24 Mar 2025 09:19:28 -0700 Subject: [PATCH 15/40] add the remaining edit / add buttons --- .../mainInput/Lump/sections/ModelsSection.tsx | 110 +++++++++--------- .../Lump/sections/docs/DocsIndexingStatus.tsx | 4 +- gui/src/pages/config/MCPServersPreview.tsx | 29 ++++- 3 files changed, 83 insertions(+), 60 deletions(-) diff --git a/gui/src/components/mainInput/Lump/sections/ModelsSection.tsx b/gui/src/components/mainInput/Lump/sections/ModelsSection.tsx index cd16e8453..b04804964 100644 --- a/gui/src/components/mainInput/Lump/sections/ModelsSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/ModelsSection.tsx @@ -11,6 +11,7 @@ import { updateConfig, } from "../../../../redux/slices/configSlice"; import { isJetBrains } from "../../../../util"; +import { AddBlockButton } from "./AddBlockButton"; export function ModelsSection() { const { selectedProfile } = useAuth(); @@ -51,60 +52,63 @@ export function ModelsSection() { } return ( -
- handleChatModelSelection(model)} - /> - handleRoleUpdate("autocomplete", model)} - /> - {/* Jetbrains has a model selector inline */} - {!jetbrains && ( + <> +
handleRoleUpdate("edit", model)} + displayName="Chat" + description="Used in the chat interface" + models={config.modelsByRole.chat} + selectedModel={ + selectedChatModel + ? { + title: selectedChatModel.title, + provider: selectedChatModel.provider, + model: selectedChatModel.model, + } + : null + } + onSelect={(model) => handleChatModelSelection(model)} /> - )} - handleRoleUpdate("apply", model)} - /> - handleRoleUpdate("embed", model)} - /> - handleRoleUpdate("rerank", model)} - /> -
+ handleRoleUpdate("autocomplete", model)} + /> + {/* Jetbrains has a model selector inline */} + {!jetbrains && ( + handleRoleUpdate("edit", model)} + /> + )} + handleRoleUpdate("apply", model)} + /> + handleRoleUpdate("embed", model)} + /> + handleRoleUpdate("rerank", model)} + /> +
+ + ); } diff --git a/gui/src/components/mainInput/Lump/sections/docs/DocsIndexingStatus.tsx b/gui/src/components/mainInput/Lump/sections/docs/DocsIndexingStatus.tsx index 7badfbc2d..f2d79035c 100644 --- a/gui/src/components/mainInput/Lump/sections/docs/DocsIndexingStatus.tsx +++ b/gui/src/components/mainInput/Lump/sections/docs/DocsIndexingStatus.tsx @@ -138,6 +138,8 @@ function DocsIndexingStatus({ /> )} + + {["aborted", "complete", "failed"].includes( status?.status ?? "", ) && ( @@ -147,8 +149,6 @@ function DocsIndexingStatus({ /> )} - - {/* Removed StatusIndicator from here */}
diff --git a/gui/src/pages/config/MCPServersPreview.tsx b/gui/src/pages/config/MCPServersPreview.tsx index 9404107d9..66ce07470 100644 --- a/gui/src/pages/config/MCPServersPreview.tsx +++ b/gui/src/pages/config/MCPServersPreview.tsx @@ -1,3 +1,4 @@ +import { ConfigYaml, parseConfigYaml } from "@continuedev/config-yaml"; import { ArrowPathIcon, CircleStackIcon, @@ -6,9 +7,11 @@ import { WrenchScrewdriverIcon, } from "@heroicons/react/24/outline"; import { MCPServerStatus } from "core"; -import { useContext } from "react"; +import { useContext, useMemo } from "react"; import { ToolTip } from "../../components/gui/Tooltip"; +import EditBlockButton from "../../components/mainInput/Lump/EditBlockButton"; import { AddBlockButton } from "../../components/mainInput/Lump/sections/AddBlockButton"; +import { useAuth } from "../../context/Auth"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; import { updateConfig } from "../../redux/slices/configSlice"; @@ -16,8 +19,9 @@ import { fontSize } from "../../util"; interface MCPServerStatusProps { server: MCPServerStatus; + serverFromYaml?: NonNullable[number]; } -function MCPServerPreview({ server }: MCPServerStatusProps) { +function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) { const ideMessenger = useContext(IdeMessengerContext); const config = useAppSelector((store) => store.config.config); const dispatch = useAppDispatch(); @@ -124,6 +128,7 @@ function MCPServerPreview({ server }: MCPServerStatusProps) { {/* Refresh button */}
+
store.config.config.mcpServerStatuses, ); - const ideMessenger = useContext(IdeMessengerContext); + const { selectedProfile } = useAuth(); + + const mergedBlocks = useMemo(() => { + const parsed = selectedProfile?.rawYaml + ? parseConfigYaml(selectedProfile?.rawYaml ?? "") + : undefined; + return (servers ?? []).map((doc, index) => ({ + block: doc, + blockFromYaml: parsed?.mcpServers?.[index], + })); + }, [servers, selectedProfile]); return (
- {servers.map((server, idx) => ( - + {mergedBlocks.map(({ block, blockFromYaml }, idx) => ( + ))}
From ef7ccedd695d7d228bdf7860798be52bfca917e7 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 24 Mar 2025 09:19:55 -0700 Subject: [PATCH 16/40] bump --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index c96eee528..b855a8248 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "1.1.14", + "version": "1.1.15", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From 4a3dbb47e16d30fe0f618738e9ac6f22a011f9f6 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 24 Mar 2025 12:56:52 -0700 Subject: [PATCH 17/40] headless update --- gui/package-lock.json | 177 ++++++++++++++++-- gui/package.json | 4 +- .../CodeToEditCard/AddFileButton.tsx | 23 ++- .../CodeToEditCard/AddFileCombobox.tsx | 20 +- gui/src/components/mainInput/InputToolbar.tsx | 3 + .../components/modelSelection/ModeSelect.tsx | 13 +- .../modelSelection/ModelSelectionListbox.tsx | 14 +- .../platform/AssistantSelect.tsx | 10 +- gui/src/components/ui/Listbox.tsx | 106 +++++++++++ gui/src/components/ui/Listbox2.tsx | 169 +++++++++++++++++ gui/src/pages/config/AccountButton.tsx | 15 +- gui/src/pages/config/ScopeSelect.tsx | 23 ++- gui/src/pages/gui/index.tsx | 2 +- gui/src/util/cn.ts | 6 + 14 files changed, 524 insertions(+), 61 deletions(-) create mode 100644 gui/src/components/ui/Listbox.tsx create mode 100644 gui/src/components/ui/Listbox2.tsx create mode 100644 gui/src/util/cn.ts diff --git a/gui/package-lock.json b/gui/package-lock.json index b0918360d..16c04c5d1 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -8,7 +8,7 @@ "license": "Apache-2.0", "dependencies": { "@continuedev/config-yaml": "^1.0.63", - "@headlessui/react": "^1.7.17", + "@headlessui/react": "^2.2.0", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", "@tiptap/core": "^2.3.2", @@ -26,6 +26,7 @@ "@tiptap/suggestion": "^2.1.13", "@types/uuid": "^10.0.0", "@types/vscode-webview": "^1.57.1", + "clsx": "^2.1.1", "core": "file:../core", "dompurify": "^3.0.6", "downshift": "^7.6.0", @@ -59,6 +60,7 @@ "socket.io-client": "^4.7.2", "styled-components": "^5.3.6", "table": "^6.8.1", + "tailwind-merge": "^3.0.2", "tippy.js": "^6.3.7", "unist-util-visit": "^5.0.0", "uuid": "^9.0.1", @@ -1098,25 +1100,53 @@ "@floating-ui/utils": "^0.2.8" } }, + "node_modules/@floating-ui/react": { + "version": "0.26.28", + "resolved": "https://registry.npmjs.org/@floating-ui/react/-/react-0.26.28.tgz", + "integrity": "sha512-yORQuuAtVpiRjpMhdc0wJj06b9JFjrYF4qp96j++v2NBpbi6SEGF7donUJ3TMieerQ6qVkAv1tgr7L4r5roTqw==", + "dependencies": { + "@floating-ui/react-dom": "^2.1.2", + "@floating-ui/utils": "^0.2.8", + "tabbable": "^6.0.0" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0" + } + }, + "node_modules/@floating-ui/react-dom": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.2.tgz", + "integrity": "sha512-06okr5cgPzMNBy+Ycse2A6udMi4bqwW/zgBF/rwjcNqWkyr82Mcg8b0vjX8OJpZFy/FKjJmw6wV7t44kK6kW7A==", + "dependencies": { + "@floating-ui/dom": "^1.0.0" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0" + } + }, "node_modules/@floating-ui/utils": { "version": "0.2.8", "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.8.tgz", "integrity": "sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig==" }, "node_modules/@headlessui/react": { - "version": "1.7.19", - "resolved": "https://registry.npmjs.org/@headlessui/react/-/react-1.7.19.tgz", - "integrity": "sha512-Ll+8q3OlMJfJbAKM/+/Y2q6PPYbryqNTXDbryx7SXLIDamkF6iQFbriYHga0dY44PvDhvvBWCx1Xj4U5+G4hOw==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@headlessui/react/-/react-2.2.0.tgz", + "integrity": "sha512-RzCEg+LXsuI7mHiSomsu/gBJSjpupm6A1qIZ5sWjd7JhARNlMiSA4kKfJpCKwU9tE+zMRterhhrP74PvfJrpXQ==", "dependencies": { - "@tanstack/react-virtual": "^3.0.0-beta.60", - "client-only": "^0.0.1" + "@floating-ui/react": "^0.26.16", + "@react-aria/focus": "^3.17.1", + "@react-aria/interactions": "^3.21.3", + "@tanstack/react-virtual": "^3.8.1" }, "engines": { "node": ">=10" }, "peerDependencies": { - "react": "^16 || ^17 || ^18", - "react-dom": "^16 || ^17 || ^18" + "react": "^18 || ^19 || ^19.0.0-rc", + "react-dom": "^18 || ^19 || ^19.0.0-rc" } }, "node_modules/@heroicons/react": { @@ -1702,6 +1732,96 @@ "url": "https://opencollective.com/popperjs" } }, + "node_modules/@react-aria/focus": { + "version": "3.20.1", + "resolved": "https://registry.npmjs.org/@react-aria/focus/-/focus-3.20.1.tgz", + "integrity": "sha512-lgYs+sQ1TtBrAXnAdRBQrBo0/7o5H6IrfDxec1j+VRpcXL0xyk0xPq+m3lZp8typzIghqDgpnKkJ5Jf4OrzPIw==", + "dependencies": { + "@react-aria/interactions": "^3.24.1", + "@react-aria/utils": "^3.28.1", + "@react-types/shared": "^3.28.0", + "@swc/helpers": "^0.5.0", + "clsx": "^2.0.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/interactions": { + "version": "3.24.1", + "resolved": "https://registry.npmjs.org/@react-aria/interactions/-/interactions-3.24.1.tgz", + "integrity": "sha512-OWEcIC6UQfWq4Td5Ptuh4PZQ4LHLJr/JL2jGYvuNL6EgL3bWvzPrRYIF/R64YbfVxIC7FeZpPSkS07sZ93/NoA==", + "dependencies": { + "@react-aria/ssr": "^3.9.7", + "@react-aria/utils": "^3.28.1", + "@react-stately/flags": "^3.1.0", + "@react-types/shared": "^3.28.0", + "@swc/helpers": "^0.5.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/ssr": { + "version": "3.9.7", + "resolved": "https://registry.npmjs.org/@react-aria/ssr/-/ssr-3.9.7.tgz", + "integrity": "sha512-GQygZaGlmYjmYM+tiNBA5C6acmiDWF52Nqd40bBp0Znk4M4hP+LTmI0lpI1BuKMw45T8RIhrAsICIfKwZvi2Gg==", + "dependencies": { + "@swc/helpers": "^0.5.0" + }, + "engines": { + "node": ">= 12" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/utils": { + "version": "3.28.1", + "resolved": "https://registry.npmjs.org/@react-aria/utils/-/utils-3.28.1.tgz", + "integrity": "sha512-mnHFF4YOVu9BRFQ1SZSKfPhg3z+lBRYoW5mLcYTQihbKhz48+I1sqRkP7ahMITr8ANH3nb34YaMME4XWmK2Mgg==", + "dependencies": { + "@react-aria/ssr": "^3.9.7", + "@react-stately/flags": "^3.1.0", + "@react-stately/utils": "^3.10.5", + "@react-types/shared": "^3.28.0", + "@swc/helpers": "^0.5.0", + "clsx": "^2.0.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-stately/flags": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@react-stately/flags/-/flags-3.1.0.tgz", + "integrity": "sha512-KSHOCxTFpBtxhIRcKwsD1YDTaNxFtCYuAUb0KEihc16QwqZViq4hasgPBs2gYm7fHRbw7WYzWKf6ZSo/+YsFlg==", + "dependencies": { + "@swc/helpers": "^0.5.0" + } + }, + "node_modules/@react-stately/utils": { + "version": "3.10.5", + "resolved": "https://registry.npmjs.org/@react-stately/utils/-/utils-3.10.5.tgz", + "integrity": "sha512-iMQSGcpaecghDIh3mZEpZfoFH3ExBwTtuBEcvZ2XnGzCgQjeYXcMdIUwAfVQLXFTdHUHGF6Gu6/dFrYsCzySBQ==", + "dependencies": { + "@swc/helpers": "^0.5.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-types/shared": { + "version": "3.28.0", + "resolved": "https://registry.npmjs.org/@react-types/shared/-/shared-3.28.0.tgz", + "integrity": "sha512-9oMEYIDc3sk0G5rysnYvdNrkSg7B04yTKl50HHSZVbokeHpnU0yRmsDaWb9B/5RprcKj8XszEk5guBO8Sa/Q+Q==", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, "node_modules/@reduxjs/toolkit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.3.0.tgz", @@ -2201,6 +2321,14 @@ "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==", "dev": true }, + "node_modules/@swc/helpers": { + "version": "0.5.15", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz", + "integrity": "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==", + "dependencies": { + "tslib": "^2.8.0" + } + }, "node_modules/@swc/types": { "version": "0.1.12", "resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.12.tgz", @@ -4265,11 +4393,6 @@ "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz", "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==" }, - "node_modules/client-only": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", - "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" - }, "node_modules/clone-response": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", @@ -4282,6 +4405,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "engines": { + "node": ">=6" + } + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -11398,6 +11529,11 @@ "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", "dev": true }, + "node_modules/tabbable": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz", + "integrity": "sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==" + }, "node_modules/table": { "version": "6.8.2", "resolved": "https://registry.npmjs.org/table/-/table-6.8.2.tgz", @@ -11413,6 +11549,15 @@ "node": ">=10.0.0" } }, + "node_modules/tailwind-merge": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.0.2.tgz", + "integrity": "sha512-l7z+OYZ7mu3DTqrL88RiKrKIqO3NcpEO8V/Od04bNpvk0kiIFndGEoqfuzvj4yuhRkHKjRkII2z+KS2HfPcSxw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/dcastil" + } + }, "node_modules/tailwindcss": { "version": "3.4.12", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.12.tgz", @@ -11730,9 +11875,9 @@ "dev": true }, "node_modules/tslib": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", - "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" }, "node_modules/type-check": { "version": "0.4.0", diff --git a/gui/package.json b/gui/package.json index 6724bd757..6efdffbf7 100644 --- a/gui/package.json +++ b/gui/package.json @@ -16,7 +16,7 @@ }, "dependencies": { "@continuedev/config-yaml": "^1.0.63", - "@headlessui/react": "^1.7.17", + "@headlessui/react": "^2.2.0", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", "@tiptap/core": "^2.3.2", @@ -34,6 +34,7 @@ "@tiptap/suggestion": "^2.1.13", "@types/uuid": "^10.0.0", "@types/vscode-webview": "^1.57.1", + "clsx": "^2.1.1", "core": "file:../core", "dompurify": "^3.0.6", "downshift": "^7.6.0", @@ -67,6 +68,7 @@ "socket.io-client": "^4.7.2", "styled-components": "^5.3.6", "table": "^6.8.1", + "tailwind-merge": "^3.0.2", "tippy.js": "^6.3.7", "unist-util-visit": "^5.0.0", "uuid": "^9.0.1", diff --git a/gui/src/components/CodeToEditCard/AddFileButton.tsx b/gui/src/components/CodeToEditCard/AddFileButton.tsx index b1e1966fe..a8c70d3c1 100644 --- a/gui/src/components/CodeToEditCard/AddFileButton.tsx +++ b/gui/src/components/CodeToEditCard/AddFileButton.tsx @@ -1,9 +1,14 @@ +import { + Listbox, + ListboxButton, + ListboxOption, + ListboxOptions, +} from "@headlessui/react"; +import { ChevronDownIcon, PlusIcon } from "@heroicons/react/24/outline"; import { useContext, useRef } from "react"; import { IdeMessengerContext } from "../../context/IdeMessenger"; -import { ChevronDownIcon, PlusIcon } from "@heroicons/react/24/outline"; -import { Listbox } from "@headlessui/react"; -import { addCodeToEdit } from "../../redux/slices/sessionSlice"; import { useAppDispatch } from "../../redux/hooks"; +import { addCodeToEdit } from "../../redux/slices/sessionSlice"; export interface AddFileButtonProps { onClick: () => void; @@ -29,7 +34,7 @@ export default function AddFileButton({ onClick }: AddFileButtonProps) { return (
- @@ -50,16 +55,16 @@ export default function AddFileButton({ onClick }: AddFileButtonProps) {
- + - - + Add all open files - - + +
); diff --git a/gui/src/components/CodeToEditCard/AddFileCombobox.tsx b/gui/src/components/CodeToEditCard/AddFileCombobox.tsx index 9450ba480..af19fbf80 100644 --- a/gui/src/components/CodeToEditCard/AddFileCombobox.tsx +++ b/gui/src/components/CodeToEditCard/AddFileCombobox.tsx @@ -1,4 +1,10 @@ -import { Combobox } from "@headlessui/react"; +import { + Combobox, + ComboboxButton, + ComboboxInput, + ComboboxOption, + ComboboxOptions, +} from "@headlessui/react"; import { ContextSubmenuItemWithProvider } from "core"; import { useEffect, useRef, useState } from "react"; import { useSubmenuContextProviders } from "../../context/SubmenuContextProviders"; @@ -54,8 +60,8 @@ export default function AddFileCombobox({ > {({ open }) => (
- - + { if (!open) { @@ -75,10 +81,10 @@ export default function AddFileCombobox({ }} /> - + {filteredFiles.length > 0 ? ( filteredFiles.map((file) => ( - @@ -109,14 +115,14 @@ export default function AddFileCombobox({
)} - + )) ) : (
No results
)} - +
)} diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index f3a8b975f..9e3c7238a 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -30,6 +30,8 @@ import { import { ToolTip } from "../gui/Tooltip"; import ModelSelect from "../modelSelection/ModelSelect"; import ModeSelect from "../modelSelection/ModeSelect"; +// import { ExampleListbox } from "../ui/Listbox2"; +import { ExampleListbox } from "../ui/Listbox"; import HoverItem from "./InputToolbar/bottom/HoverItem"; const StyledDiv = styled.div<{ isHidden?: boolean }>` @@ -116,6 +118,7 @@ function InputToolbar(props: InputToolbarProps) { >
+
{props.toolbarOptions?.hideImageUpload || diff --git a/gui/src/components/modelSelection/ModeSelect.tsx b/gui/src/components/modelSelection/ModeSelect.tsx index afc0588fa..29f30e212 100644 --- a/gui/src/components/modelSelection/ModeSelect.tsx +++ b/gui/src/components/modelSelection/ModeSelect.tsx @@ -1,5 +1,10 @@ // A dropdown menu for selecting between Chat, Edit, and Agent modes with keyboard shortcuts -import { Listbox } from "@headlessui/react"; +import { + Listbox, + ListboxButton, + ListboxOption, + ListboxOptions, +} from "@headlessui/react"; import { ChatBubbleLeftIcon, CheckIcon, @@ -26,7 +31,7 @@ import { isJetBrains, } from "../../util"; -const StyledListboxButton = styled(Listbox.Button)` +const StyledListboxButton = styled(ListboxButton)` font-family: inherit; display: flex; align-items: center; @@ -41,7 +46,7 @@ const StyledListboxButton = styled(Listbox.Button)` } `; -const StyledListboxOptions = styled(Listbox.Options)` +const StyledListboxOptions = styled(ListboxOptions)` margin-top: 4px; position: absolute; list-style: none; @@ -55,7 +60,7 @@ const StyledListboxOptions = styled(Listbox.Options)` background-color: ${vscInputBackground}; `; -const StyledListboxOption = styled(Listbox.Option)` +const StyledListboxOption = styled(ListboxOption)` border-radius: ${defaultBorderRadius}; padding: 6px 12px; cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")}; diff --git a/gui/src/components/modelSelection/ModelSelectionListbox.tsx b/gui/src/components/modelSelection/ModelSelectionListbox.tsx index 596cddb9b..bf8f5b1fc 100644 --- a/gui/src/components/modelSelection/ModelSelectionListbox.tsx +++ b/gui/src/components/modelSelection/ModelSelectionListbox.tsx @@ -1,4 +1,10 @@ -import { Listbox, Transition } from "@headlessui/react"; +import { + Listbox, + ListboxButton, + ListboxOption, + ListboxOptions, + Transition, +} from "@headlessui/react"; import { CheckIcon, ChevronUpDownIcon, @@ -21,7 +27,7 @@ export const StyledListbox = styled(Listbox)` background-color: ${vscBackground}; `; -export const StyledListboxButton = styled(Listbox.Button)` +export const StyledListboxButton = styled(ListboxButton)` cursor: pointer; background-color: ${vscBackground}; text-align: left; @@ -55,7 +61,7 @@ export const StyledListboxButton = styled(Listbox.Button)` } `; -export const StyledListboxOptions = styled(Listbox.Options)` +export const StyledListboxOptions = styled(ListboxOptions)` background-color: ${vscInputBackground}; padding: 0; @@ -78,7 +84,7 @@ export const StyledListboxOptions = styled(Listbox.Options)` } `; -export const StyledListboxOption = styled(Listbox.Option)<{ +export const StyledListboxOption = styled(ListboxOption)<{ selected: boolean; }>` background-color: ${({ selected }) => diff --git a/gui/src/components/modelSelection/platform/AssistantSelect.tsx b/gui/src/components/modelSelection/platform/AssistantSelect.tsx index 43caa02a9..a842069e0 100644 --- a/gui/src/components/modelSelection/platform/AssistantSelect.tsx +++ b/gui/src/components/modelSelection/platform/AssistantSelect.tsx @@ -1,4 +1,4 @@ -import { Popover } from "@headlessui/react"; +import { Popover, PopoverButton, PopoverPanel } from "@headlessui/react"; import { ChevronDownIcon, PlusIcon } from "@heroicons/react/24/outline"; import { ProfileDescription } from "core/config/ConfigHandler"; import { useContext, useEffect, useRef } from "react"; @@ -79,17 +79,17 @@ export default function AssistantSelect() { return (
- - + - + { if (buttonRef.current) { @@ -97,7 +97,7 @@ export default function AssistantSelect() { } }} /> - +
diff --git a/gui/src/components/ui/Listbox.tsx b/gui/src/components/ui/Listbox.tsx new file mode 100644 index 000000000..91d22551b --- /dev/null +++ b/gui/src/components/ui/Listbox.tsx @@ -0,0 +1,106 @@ +import { + ListboxButton as HLButton, + ListboxOption as HLOption, + ListboxOptions as HLOptions, + Listbox, + Transition, +} from "@headlessui/react"; +import * as React from "react"; +import { useState } from "react"; +import { cn } from "../../util/cn"; + +type ListboxButtonProps = React.ComponentProps; +const ListboxButton = React.forwardRef( + ({ className, ...props }, ref) => ( + + ), +); + +type ListboxOptionsProps = React.ComponentProps; +const ListboxOptions = React.forwardRef( + ({ className, ...props }, ref) => ( + + ), +); + +type ListboxOptionProps = React.ComponentProps; +const ListboxOption = React.forwardRef( + ({ className, ...props }, ref) => ( + + ), +); + +type ListboxTransitionProps = React.ComponentProps; +function ListboxTransition(props: ListboxTransitionProps) { + return ( + + ); +} + +const people = [ + { id: 1, name: "Durward Reynolds" }, + { id: 2, name: "Kenton Towne" }, + { id: 3, name: "Therese Wunsch" }, + { id: 4, name: "Benedict Kessler" }, + { id: 5, name: "Katelyn Rohan" }, +]; + +function ExampleListbox() { + const [selectedPerson, setSelectedPerson] = useState(people[0]); + + return ( + + {selectedPerson.name} + + + {people.map((person) => ( + + {person.name} + + ))} + + + + ); +} + +export { + ExampleListbox, + Listbox, + ListboxButton, + ListboxOption, + ListboxOptions, +}; diff --git a/gui/src/components/ui/Listbox2.tsx b/gui/src/components/ui/Listbox2.tsx new file mode 100644 index 000000000..2267fe61a --- /dev/null +++ b/gui/src/components/ui/Listbox2.tsx @@ -0,0 +1,169 @@ +// import { ChevronDownIcon } from "@heroicons/react/24/outline"; +// import React, { +// ButtonHTMLAttributes, +// LiHTMLAttributes, +// useEffect, +// useRef, +// useState, +// } from "react"; + +// import { cn } from "../../util/cn"; + +// import { createContext, useContext } from 'react'; + +// interface ListboxContextType { + +// }; + +// const defaultListboxContext: ListboxContextType = { + +// } + +// export const ListboxContext = createContext(defaultListboxContext); + +// const useListbox = () => { +// const context = useContext(ThemeContext); +// if (context === undefined) { +// throw new Error('useTheme must be used within a ThemeProvider'); +// } +// return context; +// }; + +// interface ListboxItemProps extends LiHTMLAttributes { +// isOpen: boolean; +// // selected: boolean +// } + +// export const ListboxItem: React.FC = (props) => { +// return
  • ; +// }; + +// interface ListboxButtonProps extends ButtonHTMLAttributes { +// isOpen: boolean; +// showChevron: boolean; +// } + +// export const ListboxButton: React.FC = (props) => { +// return ( +// +// ); +// }; + +// export const ContinueListbox: React.FC = ({ +// options, +// value, +// onChange, +// placeholder, +// }) => { +// const containerRef = useRef(null); +// const listRef = useRef(null); + +// return ( +//
    +//
      +// {options.map((option) => ( +//
    • { +// onChange?.(option); +// setIsOpen(false); +// }} +// className={`cursor-pointer list-none px-3 py-2 hover:bg-gray-100 ${option === value ? "bg-gray-200" : ""}`} +// > +// {option} +//
    • +// ))} +//
    +//
    +// ); +// }; + +// // interface UseListboxProps +// function useListbox() { +// const listRef = useRef(null); +// const containerRef = useRef(null); +// const buttonRef = useRef(null); + +// const [isOpen, setIsOpen] = useState(false); +// const [popupDirection, setPopupDirection] = useState<"down" | "up">("down"); + +// useEffect(() => { +// if (isOpen && containerRef.current && listRef.current) { +// const rect = containerRef.current.getBoundingClientRect(); +// const listHeight = listRef.current.offsetHeight; +// const viewportHeight = window.innerHeight; +// const spaceBelow = viewportHeight - rect.bottom; +// const spaceAbove = rect.top; +// setPopupDirection( +// spaceBelow >= listHeight || spaceBelow >= spaceAbove ? "down" : "up", +// ); +// } +// }, [isOpen]); + +// // Handle blurring/clicking outside the list + +// useEffect(() => { +// if (!listRef.current) return; +// const ref = listRef.current; +// const handleBlur = () => setIsOpen(false); +// ref.addEventListener("blur", handleBlur); +// return () => ref.removeEventListener("blur", handleBlur); +// }, [listRef]); + +// function closeList() { +// setIsOpen(false); +// } + +// function openList() { +// setIsOpen(true); +// listRef.current?.focus(); +// } + +// function toggleList() { +// if (isOpen) { +// closeList(); +// } else { +// openList(); +// } +// } + +// return { +// listRef, +// containerRef, +// buttonRef, +// isOpen, +// closeList, +// openList, +// toggleList, +// }; +// } + +// const options = ["Apple", "Banana", "Orange", "Mango", "Pineapple"]; +// export const ExampleListbox = () => { +// return ( +// console.log("Selected:", value)} +// /> +// ); +// }; diff --git a/gui/src/pages/config/AccountButton.tsx b/gui/src/pages/config/AccountButton.tsx index 0eaf4e471..ce09c1621 100644 --- a/gui/src/pages/config/AccountButton.tsx +++ b/gui/src/pages/config/AccountButton.tsx @@ -1,4 +1,9 @@ -import { Popover, Transition } from "@headlessui/react"; +import { + Popover, + PopoverButton, + PopoverPanel, + Transition, +} from "@headlessui/react"; import { UserCircleIcon } from "@heroicons/react/24/outline"; import { Fragment } from "react"; @@ -17,9 +22,9 @@ export function AccountButton() { return ( - + - + - +
    {session.account.label} @@ -50,7 +55,7 @@ export function AccountButton() { Sign out
    - + ); diff --git a/gui/src/pages/config/ScopeSelect.tsx b/gui/src/pages/config/ScopeSelect.tsx index 51538d784..7658ee8bd 100644 --- a/gui/src/pages/config/ScopeSelect.tsx +++ b/gui/src/pages/config/ScopeSelect.tsx @@ -1,4 +1,9 @@ -import { Listbox } from "@headlessui/react"; +import { + Listbox, + ListboxButton, + ListboxOption, + ListboxOptions, +} from "@headlessui/react"; import { BuildingOfficeIcon, ChevronUpDownIcon, @@ -36,7 +41,7 @@ export function ScopeSelect() { return (
    - +
    {selectedDisplay?.iconUrl ? ( @@ -50,16 +55,16 @@ export function ScopeSelect() {
    -
    + - + {organizations.length > 0 && ( <>
    Organizations
    {organizations.map((org) => ( - {org.name}
    - + ))}
    )} - @@ -87,8 +92,8 @@ export function ScopeSelect() { Personal
    - - + +
    ); diff --git a/gui/src/pages/gui/index.tsx b/gui/src/pages/gui/index.tsx index 31784a358..788d88b23 100644 --- a/gui/src/pages/gui/index.tsx +++ b/gui/src/pages/gui/index.tsx @@ -3,7 +3,7 @@ import { Chat } from "./Chat"; export default function GUI() { return ( -
    +
    diff --git a/gui/src/util/cn.ts b/gui/src/util/cn.ts new file mode 100644 index 000000000..a5ef19350 --- /dev/null +++ b/gui/src/util/cn.ts @@ -0,0 +1,6 @@ +import { clsx, type ClassValue } from "clsx"; +import { twMerge } from "tailwind-merge"; + +export function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)); +} From da2109152414c08aa4847066ee8fecce88c5a049 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 24 Mar 2025 15:34:30 -0700 Subject: [PATCH 18/40] unified listbox p1 --- .../CodeToEditCard/AddFileButton.tsx | 12 +- .../CodeToEditCard/AddFileCombobox.tsx | 7 +- gui/src/components/Layout.tsx | 83 +++++---- gui/src/components/mainInput/InputToolbar.tsx | 3 - .../InputToolbar/bottom/PopoverTransition.tsx | 26 --- gui/src/components/mainInput/Lump/index.tsx | 6 +- .../components/modelSelection/ModeSelect.tsx | 101 ++++------- .../components/modelSelection/ModelSelect.tsx | 99 ++++------ .../modelSelection/ModelSelectionListbox.tsx | 15 +- .../platform/AssistantSelect.tsx | 8 +- gui/src/components/ui/Combobox.tsx | 15 ++ gui/src/components/ui/Listbox.tsx | 171 ++++++++---------- gui/src/components/ui/Listbox2.tsx | 169 ----------------- gui/src/components/ui/Popover.tsx | 3 + gui/src/components/ui/Transition.tsx | 20 ++ gui/src/components/ui/font.ts | 15 ++ gui/src/components/ui/index.tsx | 4 + gui/src/context/LocalStorage.tsx | 41 +++++ gui/src/pages/config/AccountButton.tsx | 21 +-- gui/src/pages/config/ModelRoleSelector.tsx | 40 ++-- gui/src/pages/config/ScopeSelect.tsx | 12 +- gui/tsconfig.json | 6 +- 22 files changed, 344 insertions(+), 533 deletions(-) delete mode 100644 gui/src/components/mainInput/InputToolbar/bottom/PopoverTransition.tsx create mode 100644 gui/src/components/ui/Combobox.tsx delete mode 100644 gui/src/components/ui/Listbox2.tsx create mode 100644 gui/src/components/ui/Popover.tsx create mode 100644 gui/src/components/ui/Transition.tsx create mode 100644 gui/src/components/ui/font.ts create mode 100644 gui/src/components/ui/index.tsx create mode 100644 gui/src/context/LocalStorage.tsx diff --git a/gui/src/components/CodeToEditCard/AddFileButton.tsx b/gui/src/components/CodeToEditCard/AddFileButton.tsx index a8c70d3c1..a5b9364b7 100644 --- a/gui/src/components/CodeToEditCard/AddFileButton.tsx +++ b/gui/src/components/CodeToEditCard/AddFileButton.tsx @@ -1,14 +1,14 @@ -import { - Listbox, - ListboxButton, - ListboxOption, - ListboxOptions, -} from "@headlessui/react"; import { ChevronDownIcon, PlusIcon } from "@heroicons/react/24/outline"; import { useContext, useRef } from "react"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { useAppDispatch } from "../../redux/hooks"; import { addCodeToEdit } from "../../redux/slices/sessionSlice"; +import { + Listbox, + ListboxButton, + ListboxOption, + ListboxOptions, +} from "../ui/Listbox"; export interface AddFileButtonProps { onClick: () => void; diff --git a/gui/src/components/CodeToEditCard/AddFileCombobox.tsx b/gui/src/components/CodeToEditCard/AddFileCombobox.tsx index af19fbf80..5d8f92559 100644 --- a/gui/src/components/CodeToEditCard/AddFileCombobox.tsx +++ b/gui/src/components/CodeToEditCard/AddFileCombobox.tsx @@ -1,16 +1,15 @@ +import { ContextSubmenuItemWithProvider } from "core"; +import { useEffect, useRef, useState } from "react"; import { Combobox, ComboboxButton, ComboboxInput, ComboboxOption, ComboboxOptions, -} from "@headlessui/react"; -import { ContextSubmenuItemWithProvider } from "core"; -import { useEffect, useRef, useState } from "react"; +} from "../../components/ui/Combobox"; import { useSubmenuContextProviders } from "../../context/SubmenuContextProviders"; import { useAppSelector } from "../../redux/hooks"; import FileIcon from "../FileIcon"; - export interface AddFileComboboxProps { onSelect: (filepaths: string[]) => void | Promise; onEscape: () => void | Promise; diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index 20ecc7761..d2d91f1ea 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -3,6 +3,7 @@ import { Outlet, useLocation, useNavigate } from "react-router-dom"; import styled from "styled-components"; import { CustomScrollbarDiv, defaultBorderRadius } from "."; import { AuthProvider } from "../context/Auth"; +import { LocalStorageProvider } from "../context/LocalStorage"; import { useWebviewListener } from "../hooks/useWebviewListener"; import { useAppDispatch, useAppSelector } from "../redux/hooks"; import { selectUseHub } from "../redux/selectors"; @@ -265,49 +266,51 @@ const Layout = () => { // }, [onboardingCard.show, useHub]); return ( - - - -
    - { - dispatch(setShowDialog(false)); + + + + +
    { - dispatch(setShowDialog(false)); - }} - message={dialogMessage} - /> + > + { + dispatch(setShowDialog(false)); + }} + onClose={() => { + dispatch(setShowDialog(false)); + }} + message={dialogMessage} + /> - - - + + + - {hasFatalErrors && pathname !== ROUTES.CONFIG_ERROR && ( -
    navigate(ROUTES.CONFIG_ERROR)} - > - Error!{" "} - Could not load config -
    Learn More
    -
    - )} -
    - -
    -
    - - + {hasFatalErrors && pathname !== ROUTES.CONFIG_ERROR && ( +
    navigate(ROUTES.CONFIG_ERROR)} + > + Error!{" "} + Could not load config +
    Learn More
    +
    + )} +
    + +
    +
    + + + ); }; diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index 9e3c7238a..f3a8b975f 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -30,8 +30,6 @@ import { import { ToolTip } from "../gui/Tooltip"; import ModelSelect from "../modelSelection/ModelSelect"; import ModeSelect from "../modelSelection/ModeSelect"; -// import { ExampleListbox } from "../ui/Listbox2"; -import { ExampleListbox } from "../ui/Listbox"; import HoverItem from "./InputToolbar/bottom/HoverItem"; const StyledDiv = styled.div<{ isHidden?: boolean }>` @@ -118,7 +116,6 @@ function InputToolbar(props: InputToolbarProps) { >
    -
    {props.toolbarOptions?.hideImageUpload || diff --git a/gui/src/components/mainInput/InputToolbar/bottom/PopoverTransition.tsx b/gui/src/components/mainInput/InputToolbar/bottom/PopoverTransition.tsx deleted file mode 100644 index 24b64c27b..000000000 --- a/gui/src/components/mainInput/InputToolbar/bottom/PopoverTransition.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { Transition } from "@headlessui/react"; - -export default function PopoverTransition({ - children, - show, - afterLeave, -}: { - children: React.ReactNode; - show?: boolean; - afterLeave?: () => void; -}) { - return ( - - {children} - - ); -} diff --git a/gui/src/components/mainInput/Lump/index.tsx b/gui/src/components/mainInput/Lump/index.tsx index f46f432d0..f12e35c4d 100644 --- a/gui/src/components/mainInput/Lump/index.tsx +++ b/gui/src/components/mainInput/Lump/index.tsx @@ -66,7 +66,11 @@ export function Lump(props: LumpProps) { setSelectedSection={setSelectedSection} /> - +
    diff --git a/gui/src/components/modelSelection/ModeSelect.tsx b/gui/src/components/modelSelection/ModeSelect.tsx index 29f30e212..b2bb16410 100644 --- a/gui/src/components/modelSelection/ModeSelect.tsx +++ b/gui/src/components/modelSelection/ModeSelect.tsx @@ -1,10 +1,4 @@ // A dropdown menu for selecting between Chat, Edit, and Agent modes with keyboard shortcuts -import { - Listbox, - ListboxButton, - ListboxOption, - ListboxOptions, -} from "@headlessui/react"; import { ChatBubbleLeftIcon, CheckIcon, @@ -24,12 +18,13 @@ import { selectCurrentMode, setMode, } from "../../redux/slices/sessionSlice"; +import { getFontSize, getMetaKeyLabel, isJetBrains } from "../../util"; import { - fontSize, - getFontSize, - getMetaKeyLabel, - isJetBrains, -} from "../../util"; + Listbox, + ListboxButton, + ListboxOption, + ListboxOptions, +} from "../ui/Listbox"; const StyledListboxButton = styled(ListboxButton)` font-family: inherit; @@ -60,21 +55,6 @@ const StyledListboxOptions = styled(ListboxOptions)` background-color: ${vscInputBackground}; `; -const StyledListboxOption = styled(ListboxOption)` - border-radius: ${defaultBorderRadius}; - padding: 6px 12px; - cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")}; - display: flex; - align-items: center; - gap: 8px; - opacity: ${(props) => (props.disabled ? 0.5 : 1)}; - - &:hover { - background: ${(props) => - props.disabled ? "transparent" : `${lightGray}33`}; - } -`; - const ShortcutText = styled.span` color: ${lightGray}; font-size: ${getFontSize() - 3}px; @@ -126,60 +106,55 @@ function ModeSelect() { }} >
    - -
    - {getModeIcon(mode)} - {mode.charAt(0).toUpperCase() + mode.slice(1)} -
    -
    - - - - Agent - {/* */} + {getModeIcon(mode)} + {mode.charAt(0).toUpperCase() + mode.slice(1)} + + - - - Chat - {getMetaKeyLabel()}L + +
    + + Chat + {getMetaKeyLabel()}L +
    {mode === "chat" && } -
    + {!jetbrains && ( - - - Edit - {getMetaKeyLabel()}I + +
    + + Edit + {getMetaKeyLabel()}I +
    {mode === "edit" && } -
    + )}
    {getMetaKeyLabel()} . for next mode
    -
    +
    ); diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index 437e2304f..f3edc6937 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -1,4 +1,3 @@ -import { Listbox } from "@headlessui/react"; import { CheckIcon, ChevronDownIcon, @@ -21,6 +20,7 @@ import { import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; import { fontSize, isMetaEquivalentKeyPressed } from "../../util"; import Shortcut from "../gui/Shortcut"; +import { Listbox, ListboxButton, ListboxOption, ListboxOptions } from "../ui"; import { Divider } from "./platform/shared"; interface ModelOptionProps { @@ -36,8 +36,6 @@ interface Option { apiKey?: string; } -const MAX_HEIGHT_PX = 300; - const StyledListboxButton = styled(Listbox.Button)` font-family: inherit; display: flex; @@ -68,35 +66,28 @@ const StyledListboxOptions = styled(Listbox.Options)<{ $showabove: boolean }>` border-radius: ${defaultBorderRadius}; border: 0.5px solid ${lightGray}; background-color: ${vscInputBackground}; - - max-height: ${MAX_HEIGHT_PX}px; - overflow-y: scroll; - - scrollbar-width: none; - - ${(props) => (props.$showabove ? "bottom: 100%;" : "top: 100%;")} `; -const StyledListboxOption = styled(Listbox.Option)<{ isDisabled?: boolean }>` - border-radius: ${defaultBorderRadius}; - padding: 4px 12px; +// const StyledListboxOption = styled(Listbox.Option)<{ isDisabled?: boolean }>` +// border-radius: ${defaultBorderRadius}; +// padding: 4px 12px; - ${({ isDisabled }) => - !isDisabled && - ` - cursor: pointer; +// ${({ isDisabled }) => +// !isDisabled && +// ` +// cursor: pointer; - &:hover { - background: ${lightGray}33; - } - `} +// &:hover { +// background: ${lightGray}33; +// } +// `} - ${({ isDisabled }) => - isDisabled && - ` - opacity: 0.5; - `} -`; +// ${({ isDisabled }) => +// isDisabled && +// ` +// opacity: 0.5; +// `} +// `; const IconBase = styled.div<{ $hovered: boolean }>` width: 1.2em; @@ -151,16 +142,16 @@ function ModelOption({ } return ( - setHovered(true)} onMouseLeave={() => setHovered(false)} onClick={handleOptionClick} > -
    -
    +
    +
    @@ -178,7 +169,7 @@ function ModelOption({
    - + ); } @@ -186,7 +177,6 @@ function ModelSelect() { const dispatch = useDispatch(); const defaultModel = useAppSelector(selectDefaultModel); const allModels = useAppSelector((state) => state.config.config.models); - const [showAbove, setShowAbove] = useState(false); const buttonRef = useRef(null); const [options, setOptions] = useState([]); const [sortedOptions, setSortedOptions] = useState([]); @@ -216,12 +206,6 @@ function ModelSelect() { ); }, [allModels]); - useEffect(() => { - const handleResize = () => calculatePosition(); - window.addEventListener("resize", handleResize); - return () => window.removeEventListener("resize", handleResize); - }, []); - useEffect(() => { const handleKeyDown = (event: KeyboardEvent) => { if (event.key === "'" && isMetaEquivalentKeyPressed(event as any)) { @@ -242,18 +226,6 @@ function ModelSelect() { }; }, [options, defaultModel]); - function calculatePosition() { - if (!buttonRef.current) { - return; - } - const rect = buttonRef.current.getBoundingClientRect(); - const spaceBelow = window.innerHeight - rect.bottom; - const spaceAbove = rect.top; - const dropdownHeight = MAX_HEIGHT_PX; - - setShowAbove(spaceBelow < dropdownHeight && spaceAbove > spaceBelow); - } - function onClickAddModel(e: MouseEvent) { e.stopPropagation(); e.preventDefault(); @@ -282,30 +254,23 @@ function ModelSelect() { }} >
    - -
    +
    {modelSelectTitle(defaultModel) || "Select model"}{" "}
    - - -
    + + +
    {sortedOptions.map((option, idx) => ( - Add Chat model
    - + )} @@ -341,7 +306,7 @@ function ModelSelect() { meta ' to toggle model
    -
    +
    ); diff --git a/gui/src/components/modelSelection/ModelSelectionListbox.tsx b/gui/src/components/modelSelection/ModelSelectionListbox.tsx index bf8f5b1fc..5111a1bcc 100644 --- a/gui/src/components/modelSelection/ModelSelectionListbox.tsx +++ b/gui/src/components/modelSelection/ModelSelectionListbox.tsx @@ -1,10 +1,3 @@ -import { - Listbox, - ListboxButton, - ListboxOption, - ListboxOptions, - Transition, -} from "@headlessui/react"; import { CheckIcon, ChevronUpDownIcon, @@ -21,8 +14,14 @@ import { vscListActiveBackground, vscListActiveForeground, } from ".."; +import { + Listbox, + ListboxButton, + ListboxOption, + ListboxOptions, + Transition, +} from "../../components/ui"; import { DisplayInfo } from "../../pages/AddNewModel/configs/models"; - export const StyledListbox = styled(Listbox)` background-color: ${vscBackground}; `; diff --git a/gui/src/components/modelSelection/platform/AssistantSelect.tsx b/gui/src/components/modelSelection/platform/AssistantSelect.tsx index a842069e0..26b19e0d4 100644 --- a/gui/src/components/modelSelection/platform/AssistantSelect.tsx +++ b/gui/src/components/modelSelection/platform/AssistantSelect.tsx @@ -1,4 +1,3 @@ -import { Popover, PopoverButton, PopoverPanel } from "@headlessui/react"; import { ChevronDownIcon, PlusIcon } from "@heroicons/react/24/outline"; import { ProfileDescription } from "core/config/ConfigHandler"; import { useContext, useEffect, useRef } from "react"; @@ -7,7 +6,8 @@ import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { cycleProfile } from "../../../redux"; import { useAppDispatch } from "../../../redux/hooks"; import { fontSize, isMetaEquivalentKeyPressed } from "../../../util"; -import PopoverTransition from "../../mainInput/InputToolbar/bottom/PopoverTransition"; +import { Popover, PopoverButton, PopoverPanel, Transition } from "../../ui"; + import AssistantIcon from "./AssistantIcon"; import { AssistantSelectOptions } from "./AssistantSelectOptions"; @@ -88,7 +88,7 @@ export default function AssistantSelect() { - + { @@ -98,7 +98,7 @@ export default function AssistantSelect() { }} /> - +
    ); diff --git a/gui/src/components/ui/Combobox.tsx b/gui/src/components/ui/Combobox.tsx new file mode 100644 index 000000000..8ba9e51ff --- /dev/null +++ b/gui/src/components/ui/Combobox.tsx @@ -0,0 +1,15 @@ +import { + Combobox, + ComboboxButton, + ComboboxInput, + ComboboxOption, + ComboboxOptions, +} from "@headlessui/react"; + +export { + Combobox, + ComboboxButton, + ComboboxInput, + ComboboxOption, + ComboboxOptions, +}; diff --git a/gui/src/components/ui/Listbox.tsx b/gui/src/components/ui/Listbox.tsx index 91d22551b..a63f5eef0 100644 --- a/gui/src/components/ui/Listbox.tsx +++ b/gui/src/components/ui/Listbox.tsx @@ -3,104 +3,83 @@ import { ListboxOption as HLOption, ListboxOptions as HLOptions, Listbox, - Transition, } from "@headlessui/react"; import * as React from "react"; -import { useState } from "react"; import { cn } from "../../util/cn"; +import { FontSizeModifier, useFontSize } from "./font"; -type ListboxButtonProps = React.ComponentProps; -const ListboxButton = React.forwardRef( - ({ className, ...props }, ref) => ( - - ), -); - -type ListboxOptionsProps = React.ComponentProps; -const ListboxOptions = React.forwardRef( - ({ className, ...props }, ref) => ( - - ), -); - -type ListboxOptionProps = React.ComponentProps; -const ListboxOption = React.forwardRef( - ({ className, ...props }, ref) => ( - - ), -); - -type ListboxTransitionProps = React.ComponentProps; -function ListboxTransition(props: ListboxTransitionProps) { - return ( - - ); -} - -const people = [ - { id: 1, name: "Durward Reynolds" }, - { id: 2, name: "Kenton Towne" }, - { id: 3, name: "Therese Wunsch" }, - { id: 4, name: "Benedict Kessler" }, - { id: 5, name: "Katelyn Rohan" }, -]; - -function ExampleListbox() { - const [selectedPerson, setSelectedPerson] = useState(people[0]); - - return ( - - {selectedPerson.name} - - - {people.map((person) => ( - - {person.name} - - ))} - - - - ); -} - -export { - ExampleListbox, - Listbox, - ListboxButton, - ListboxOption, - ListboxOptions, +type ListboxButtonProps = React.ComponentProps & { + fontSizeModifier?: FontSizeModifier; }; + +const ListboxButton = React.forwardRef( + ({ fontSizeModifier = -3, ...props }, ref) => { + const fontSize = useFontSize(fontSizeModifier); + return ( + + ); + }, +); + +type ListboxOptionsProps = React.ComponentProps & { + fontSizeModifier?: FontSizeModifier; +}; +const ListboxOptions = React.forwardRef( + ({ fontSizeModifier = -3, ...props }, ref) => { + const fontSize = useFontSize(fontSizeModifier); + return ( + + ); + }, +); + +type ListboxOptionProps = React.ComponentProps & { + fontSizeModifier?: FontSizeModifier; +}; +const ListboxOption = React.forwardRef( + ({ fontSizeModifier = -3, ...props }, ref) => { + const fontSize = useFontSize(fontSizeModifier); + return ( + + ); + }, +); + +export { Listbox, ListboxButton, ListboxOption, ListboxOptions }; diff --git a/gui/src/components/ui/Listbox2.tsx b/gui/src/components/ui/Listbox2.tsx deleted file mode 100644 index 2267fe61a..000000000 --- a/gui/src/components/ui/Listbox2.tsx +++ /dev/null @@ -1,169 +0,0 @@ -// import { ChevronDownIcon } from "@heroicons/react/24/outline"; -// import React, { -// ButtonHTMLAttributes, -// LiHTMLAttributes, -// useEffect, -// useRef, -// useState, -// } from "react"; - -// import { cn } from "../../util/cn"; - -// import { createContext, useContext } from 'react'; - -// interface ListboxContextType { - -// }; - -// const defaultListboxContext: ListboxContextType = { - -// } - -// export const ListboxContext = createContext(defaultListboxContext); - -// const useListbox = () => { -// const context = useContext(ThemeContext); -// if (context === undefined) { -// throw new Error('useTheme must be used within a ThemeProvider'); -// } -// return context; -// }; - -// interface ListboxItemProps extends LiHTMLAttributes { -// isOpen: boolean; -// // selected: boolean -// } - -// export const ListboxItem: React.FC = (props) => { -// return
  • ; -// }; - -// interface ListboxButtonProps extends ButtonHTMLAttributes { -// isOpen: boolean; -// showChevron: boolean; -// } - -// export const ListboxButton: React.FC = (props) => { -// return ( -// -// ); -// }; - -// export const ContinueListbox: React.FC = ({ -// options, -// value, -// onChange, -// placeholder, -// }) => { -// const containerRef = useRef(null); -// const listRef = useRef(null); - -// return ( -//
    -//
      -// {options.map((option) => ( -//
    • { -// onChange?.(option); -// setIsOpen(false); -// }} -// className={`cursor-pointer list-none px-3 py-2 hover:bg-gray-100 ${option === value ? "bg-gray-200" : ""}`} -// > -// {option} -//
    • -// ))} -//
    -//
    -// ); -// }; - -// // interface UseListboxProps -// function useListbox() { -// const listRef = useRef(null); -// const containerRef = useRef(null); -// const buttonRef = useRef(null); - -// const [isOpen, setIsOpen] = useState(false); -// const [popupDirection, setPopupDirection] = useState<"down" | "up">("down"); - -// useEffect(() => { -// if (isOpen && containerRef.current && listRef.current) { -// const rect = containerRef.current.getBoundingClientRect(); -// const listHeight = listRef.current.offsetHeight; -// const viewportHeight = window.innerHeight; -// const spaceBelow = viewportHeight - rect.bottom; -// const spaceAbove = rect.top; -// setPopupDirection( -// spaceBelow >= listHeight || spaceBelow >= spaceAbove ? "down" : "up", -// ); -// } -// }, [isOpen]); - -// // Handle blurring/clicking outside the list - -// useEffect(() => { -// if (!listRef.current) return; -// const ref = listRef.current; -// const handleBlur = () => setIsOpen(false); -// ref.addEventListener("blur", handleBlur); -// return () => ref.removeEventListener("blur", handleBlur); -// }, [listRef]); - -// function closeList() { -// setIsOpen(false); -// } - -// function openList() { -// setIsOpen(true); -// listRef.current?.focus(); -// } - -// function toggleList() { -// if (isOpen) { -// closeList(); -// } else { -// openList(); -// } -// } - -// return { -// listRef, -// containerRef, -// buttonRef, -// isOpen, -// closeList, -// openList, -// toggleList, -// }; -// } - -// const options = ["Apple", "Banana", "Orange", "Mango", "Pineapple"]; -// export const ExampleListbox = () => { -// return ( -// console.log("Selected:", value)} -// /> -// ); -// }; diff --git a/gui/src/components/ui/Popover.tsx b/gui/src/components/ui/Popover.tsx new file mode 100644 index 000000000..4d6c03f89 --- /dev/null +++ b/gui/src/components/ui/Popover.tsx @@ -0,0 +1,3 @@ +import { Popover, PopoverButton, PopoverPanel } from "@headlessui/react"; + +export { Popover, PopoverButton, PopoverPanel }; diff --git a/gui/src/components/ui/Transition.tsx b/gui/src/components/ui/Transition.tsx new file mode 100644 index 000000000..34cc7e706 --- /dev/null +++ b/gui/src/components/ui/Transition.tsx @@ -0,0 +1,20 @@ +import { Transition as HLTransition } from "@headlessui/react"; +import { cn } from "../../util/cn"; + +type TransitionProps = React.ComponentProps; +function Transition(props: TransitionProps) { + return ( + + ); +} + +export { Transition }; diff --git a/gui/src/components/ui/font.ts b/gui/src/components/ui/font.ts new file mode 100644 index 000000000..67f44b03b --- /dev/null +++ b/gui/src/components/ui/font.ts @@ -0,0 +1,15 @@ +import { useMemo } from "react"; +import { useLocalStorage } from "../../context/LocalStorage"; + +export type FontSizeModifier = number | ((fontSize: number) => number); + +export const useFontSize = (modifier?: FontSizeModifier) => { + const { fontSize } = useLocalStorage(); + return useMemo(() => { + return !modifier + ? fontSize + : typeof modifier === "number" + ? fontSize + modifier + : modifier(fontSize); + }, [fontSize]); +}; diff --git a/gui/src/components/ui/index.tsx b/gui/src/components/ui/index.tsx new file mode 100644 index 000000000..e8f087bb1 --- /dev/null +++ b/gui/src/components/ui/index.tsx @@ -0,0 +1,4 @@ +export * from "./Combobox"; +export * from "./Listbox"; +export * from "./Popover"; +export * from "./Transition"; diff --git a/gui/src/context/LocalStorage.tsx b/gui/src/context/LocalStorage.tsx new file mode 100644 index 000000000..8c6d56b3a --- /dev/null +++ b/gui/src/context/LocalStorage.tsx @@ -0,0 +1,41 @@ +import React, { createContext, useContext, useEffect, useState } from "react"; +import { getLocalStorage } from "../util/localStorage"; + +interface LocalStorageType { + fontSize: number; +} + +const DEFAULT_LOCAL_STORAGE: LocalStorageType = { + fontSize: 14, +}; + +const LocalStorageContext = createContext( + DEFAULT_LOCAL_STORAGE, +); + +export const LocalStorageProvider: React.FC<{ children: React.ReactNode }> = ({ + children, +}) => { + const [values, setValues] = useState(DEFAULT_LOCAL_STORAGE); + + // TODO setvalue + + useEffect(() => { + const isJetbrains = getLocalStorage("ide") === "jetbrains"; + let fontSize = getLocalStorage("fontSize") ?? (isJetbrains ? 15 : 14); + setValues({ + fontSize, + }); + }, []); + + return ( + + {children} + + ); +}; + +export const useLocalStorage = () => { + const context = useContext(LocalStorageContext); + return context; +}; diff --git a/gui/src/pages/config/AccountButton.tsx b/gui/src/pages/config/AccountButton.tsx index ce09c1621..f09965dfe 100644 --- a/gui/src/pages/config/AccountButton.tsx +++ b/gui/src/pages/config/AccountButton.tsx @@ -1,13 +1,12 @@ +import { UserCircleIcon } from "@heroicons/react/24/outline"; + +import { SecondaryButton } from "../../components"; import { Popover, PopoverButton, PopoverPanel, Transition, -} from "@headlessui/react"; -import { UserCircleIcon } from "@heroicons/react/24/outline"; -import { Fragment } from "react"; - -import { SecondaryButton } from "../../components"; +} from "../../components/ui"; import { useAuth } from "../../context/Auth"; import { ScopeSelect } from "./ScopeSelect"; @@ -26,16 +25,8 @@ export function AccountButton() { - - + +
    {session.account.label} diff --git a/gui/src/pages/config/ModelRoleSelector.tsx b/gui/src/pages/config/ModelRoleSelector.tsx index bd777c44b..e8461a060 100644 --- a/gui/src/pages/config/ModelRoleSelector.tsx +++ b/gui/src/pages/config/ModelRoleSelector.tsx @@ -1,10 +1,15 @@ -import { Listbox, Transition } from "@headlessui/react"; import { CheckIcon, ChevronUpDownIcon } from "@heroicons/react/24/outline"; import { type ModelDescription } from "core"; -import { Fragment } from "react"; import { defaultBorderRadius } from "../../components"; import { ToolTip } from "../../components/gui/Tooltip"; import InfoHover from "../../components/InfoHover"; +import { + Listbox, + ListboxButton, + ListboxOption, + ListboxOptions, + Transition, +} from "../../components/ui"; import { fontSize } from "../../util"; interface ModelRoleSelectorProps { @@ -44,9 +49,9 @@ const ModelRoleSelector = ({ {({ open }) => (
    - 0 ? "hover:bg-vsc-input-background cursor-pointer" : "cursor-not-allowed opacity-50"} text-vsc-foreground relative m-0 flex w-full items-center justify-between rounded-md border border-solid px-1.5 py-0.5 text-left text-sm`} + className={`${models.length === 0 ? "cursor-not-allowed opacity-50" : ""} `} > {models.length === 0 ? (
    ) : null} - + - - + {models.map((option, idx) => ( - + + ))} - +
    )} diff --git a/gui/src/pages/config/ScopeSelect.tsx b/gui/src/pages/config/ScopeSelect.tsx index 7658ee8bd..8b0949fdb 100644 --- a/gui/src/pages/config/ScopeSelect.tsx +++ b/gui/src/pages/config/ScopeSelect.tsx @@ -1,14 +1,14 @@ -import { - Listbox, - ListboxButton, - ListboxOption, - ListboxOptions, -} from "@headlessui/react"; import { BuildingOfficeIcon, ChevronUpDownIcon, UserCircleIcon, } from "@heroicons/react/24/outline"; +import { + Listbox, + ListboxButton, + ListboxOption, + ListboxOptions, +} from "../../components/ui/Listbox"; import { useAuth } from "../../context/Auth"; import { useWebviewListener } from "../../hooks/useWebviewListener"; import { selectOrgThunk } from "../../redux"; diff --git a/gui/tsconfig.json b/gui/tsconfig.json index d41a6b9c3..d4f020465 100644 --- a/gui/tsconfig.json +++ b/gui/tsconfig.json @@ -19,6 +19,10 @@ "types": ["vitest/globals"] // Disabled for now since it's causing too many errors }, - "include": ["src", "../src/util/messenger.ts"], + "include": [ + "src", + "../src/util/messenger.ts", + "src/components/ui/DELETE_ME/.tsx" + ], "references": [{ "path": "./tsconfig.node.json" }] } From 0909ef938b6d2928fa650c0e0613c1e106a0315d Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Mon, 24 Mar 2025 15:58:27 -0700 Subject: [PATCH 19/40] feat: bookmark first 5 prompts by default --- extensions/vscode/package-lock.json | 4 +- .../ConversationStarterCard.tsx | 18 ++--- .../ConversationStarterCards.tsx | 53 ++++++++++---- .../useBookmarkedSlashCommands.ts | 69 ------------------ .../Lump/sections/PromptsSection.tsx | 21 ++++-- gui/src/hooks/useBookmarkedSlashCommands.ts | 45 ++++++++++++ gui/src/hooks/useSetup.ts | 9 ++- gui/src/pages/gui/Chat.tsx | 2 +- gui/src/redux/slices/profiles/slice.ts | 70 +++++++++++++------ gui/src/redux/slices/profiles/thunks.ts | 31 +++++++- gui/src/redux/slices/profiles/utils.ts | 12 ---- gui/src/redux/store.ts | 8 +-- 12 files changed, 199 insertions(+), 143 deletions(-) delete mode 100644 gui/src/components/ConversationStarters/useBookmarkedSlashCommands.ts create mode 100644 gui/src/hooks/useBookmarkedSlashCommands.ts delete mode 100644 gui/src/redux/slices/profiles/utils.ts diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index e8f7b966b..f1b847bfa 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.13", + "version": "1.1.14", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.13", + "version": "1.1.14", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", diff --git a/gui/src/components/ConversationStarters/ConversationStarterCard.tsx b/gui/src/components/ConversationStarters/ConversationStarterCard.tsx index f0428a723..29ff81833 100644 --- a/gui/src/components/ConversationStarters/ConversationStarterCard.tsx +++ b/gui/src/components/ConversationStarters/ConversationStarterCard.tsx @@ -1,7 +1,5 @@ import { ChatBubbleLeftIcon } from "@heroicons/react/24/outline"; import { SlashCommandDescription } from "core"; -import { useState } from "react"; -import { defaultBorderRadius, vscInputBackground } from ".."; interface ConversationStarterCardProps { command: SlashCommandDescription; @@ -12,26 +10,20 @@ export function ConversationStarterCard({ command, onClick, }: ConversationStarterCardProps) { - const [isHovered, setIsHovered] = useState(false); - return (
    setIsHovered(true)} - onMouseLeave={() => setIsHovered(false)} + className="bg-vsc-input-background mb-2 w-full rounded-md shadow-md hover:cursor-pointer hover:brightness-110" onClick={() => onClick(command)} >
    -
    +
    {command.name}
    -
    {command.description}
    + {command.description && ( +
    {command.description}
    + )}
    diff --git a/gui/src/components/ConversationStarters/ConversationStarterCards.tsx b/gui/src/components/ConversationStarters/ConversationStarterCards.tsx index 2a29d0749..beed0d35d 100644 --- a/gui/src/components/ConversationStarters/ConversationStarterCards.tsx +++ b/gui/src/components/ConversationStarters/ConversationStarterCards.tsx @@ -1,17 +1,28 @@ import { SlashCommandDescription } from "core"; -import { useAppDispatch } from "../../redux/hooks"; +import { useState } from "react"; +import { useBookmarkedSlashCommands } from "../../hooks/useBookmarkedSlashCommands"; +import { useAppDispatch, useAppSelector } from "../../redux/hooks"; import { setMainEditorContentTrigger } from "../../redux/slices/sessionSlice"; import { getParagraphNodeFromString } from "../mainInput/utils"; import { ConversationStarterCard } from "./ConversationStarterCard"; -import { useBookmarkedSlashCommands } from "./useBookmarkedSlashCommands"; -const NUM_CARDS_TO_RENDER = 3; +const NUM_CARDS_TO_RENDER = 5; export function ConversationStarterCards() { const dispatch = useAppDispatch(); - const { cmdsSortedByBookmark } = useBookmarkedSlashCommands(); + const [showAll, setShowAll] = useState(false); + const { isCommandBookmarked } = useBookmarkedSlashCommands(); + const slashCommands = useAppSelector( + (state) => state.config.config.slashCommands ?? [], + ); + + const bookmarkedSlashCommands = slashCommands.filter((command) => + isCommandBookmarked(command.name), + ); function onClick(command: SlashCommandDescription) { + debugger; + if (command.prompt) { dispatch( setMainEditorContentTrigger(getParagraphNodeFromString(command.prompt)), @@ -19,19 +30,35 @@ export function ConversationStarterCards() { } } - if (!cmdsSortedByBookmark || cmdsSortedByBookmark.length === 0) { + if (bookmarkedSlashCommands.length === 0) { return null; } + const visibleCommands = showAll + ? bookmarkedSlashCommands + : bookmarkedSlashCommands.slice(0, NUM_CARDS_TO_RENDER); + + const remainingCount = bookmarkedSlashCommands.length - NUM_CARDS_TO_RENDER; + return ( -
    - {cmdsSortedByBookmark.slice(0, NUM_CARDS_TO_RENDER).map((command, i) => ( - - ))} +
    +
    + {visibleCommands.map((command, i) => ( + + ))} +
    + {bookmarkedSlashCommands.length > NUM_CARDS_TO_RENDER && ( + setShowAll(!showAll)} + > + {showAll ? "Show less" : `Show ${remainingCount} more...`} + + )}
    ); } diff --git a/gui/src/components/ConversationStarters/useBookmarkedSlashCommands.ts b/gui/src/components/ConversationStarters/useBookmarkedSlashCommands.ts deleted file mode 100644 index 786ae379a..000000000 --- a/gui/src/components/ConversationStarters/useBookmarkedSlashCommands.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { SlashCommandDescription } from "core"; -import { usePostHog } from "posthog-js/react"; -import { useMemo } from "react"; -import { - bookmarkSlashCommand, - selectBookmarkedSlashCommands, - selectSelectedProfileId, - unbookmarkSlashCommand, -} from "../../redux"; -import { useAppDispatch, useAppSelector } from "../../redux/hooks"; -import { isDeprecatedCommandName, sortCommandsByBookmarkStatus } from "./utils"; - -export function useBookmarkedSlashCommands() { - const dispatch = useAppDispatch(); - const posthog = usePostHog(); - - const slashCommands = - useAppSelector((state) => state.config.config.slashCommands) ?? []; - const selectedProfileId = useAppSelector(selectSelectedProfileId); - const bookmarkedCommands = useAppSelector(selectBookmarkedSlashCommands); - - const filteredSlashCommands = slashCommands.filter(isDeprecatedCommandName); - - // Create a map of command names to bookmark status - const bookmarkStatuses = useMemo(() => { - const statuses: Record = {}; - if (selectedProfileId) { - filteredSlashCommands.forEach((command) => { - statuses[command.name] = bookmarkedCommands.includes(command.name); - }); - } - return statuses; - }, [filteredSlashCommands, bookmarkedCommands, selectedProfileId]); - - // Sort commands by bookmark status - const cmdsSortedByBookmark = useMemo( - () => - sortCommandsByBookmarkStatus(filteredSlashCommands, bookmarkedCommands), - [filteredSlashCommands, bookmarkedCommands], - ); - - const toggleBookmark = (command: SlashCommandDescription) => { - const isBookmarked = bookmarkStatuses[command.name]; - - posthog.capture("toggle_bookmarked_slash_command", { - isBookmarked, - }); - - if (isBookmarked) { - dispatch( - unbookmarkSlashCommand({ - commandName: command.name, - }), - ); - } else { - dispatch( - bookmarkSlashCommand({ - commandName: command.name, - }), - ); - } - }; - - return { - cmdsSortedByBookmark, - bookmarkStatuses, - toggleBookmark, - }; -} diff --git a/gui/src/components/mainInput/Lump/sections/PromptsSection.tsx b/gui/src/components/mainInput/Lump/sections/PromptsSection.tsx index 38ce05209..138449413 100644 --- a/gui/src/components/mainInput/Lump/sections/PromptsSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/PromptsSection.tsx @@ -3,8 +3,9 @@ import { PencilIcon, } from "@heroicons/react/24/outline"; import { BookmarkIcon as BookmarkSolid } from "@heroicons/react/24/solid"; +import { useBookmarkedSlashCommands } from "../../../../hooks/useBookmarkedSlashCommands"; +import { useAppSelector } from "../../../../redux/hooks"; import { fontSize } from "../../../../util"; -import { useBookmarkedSlashCommands } from "../../../ConversationStarters/useBookmarkedSlashCommands"; import { AddBlockButton } from "./AddBlockButton"; interface PromptRowProps { @@ -54,22 +55,32 @@ function PromptRow({ } export function PromptsSection() { - const { cmdsSortedByBookmark, bookmarkStatuses, toggleBookmark } = - useBookmarkedSlashCommands(); + const { isCommandBookmarked, toggleBookmark } = useBookmarkedSlashCommands(); + const slashCommands = useAppSelector( + (state) => state.config.config.slashCommands ?? [], + ); const handleEdit = (prompt: any) => { // Handle edit action here console.log("Editing prompt:", prompt); }; + const sortedCommands = [...slashCommands].sort((a, b) => { + const aBookmarked = isCommandBookmarked(a.name); + const bBookmarked = isCommandBookmarked(b.name); + if (aBookmarked && !bBookmarked) return -1; + if (!aBookmarked && bBookmarked) return 1; + return 0; + }); + return (
    - {cmdsSortedByBookmark?.map((prompt, i) => ( + {sortedCommands.map((prompt) => ( toggleBookmark(prompt)} onEdit={() => handleEdit(prompt)} /> diff --git a/gui/src/hooks/useBookmarkedSlashCommands.ts b/gui/src/hooks/useBookmarkedSlashCommands.ts new file mode 100644 index 000000000..d00c60934 --- /dev/null +++ b/gui/src/hooks/useBookmarkedSlashCommands.ts @@ -0,0 +1,45 @@ +import { SlashCommandDescription } from "core"; +import { usePostHog } from "posthog-js/react"; +import { + bookmarkSlashCommand, + selectBookmarkedSlashCommands, + unbookmarkSlashCommand, +} from "../redux"; +import { useAppDispatch, useAppSelector } from "../redux/hooks"; + +export function useBookmarkedSlashCommands() { + const dispatch = useAppDispatch(); + const posthog = usePostHog(); + const bookmarkedCommands = useAppSelector(selectBookmarkedSlashCommands); + + const isCommandBookmarked = (commandName: string): boolean => { + return bookmarkedCommands.includes(commandName); + }; + + const toggleBookmark = (command: SlashCommandDescription) => { + const isBookmarked = isCommandBookmarked(command.name); + + posthog.capture("toggle_bookmarked_slash_command", { + isBookmarked, + }); + + if (isBookmarked) { + dispatch( + unbookmarkSlashCommand({ + commandName: command.name, + }), + ); + } else { + dispatch( + bookmarkSlashCommand({ + commandName: command.name, + }), + ); + } + }; + + return { + isCommandBookmarked, + toggleBookmark, + }; +} diff --git a/gui/src/hooks/useSetup.ts b/gui/src/hooks/useSetup.ts index 974787f50..ca7705a6f 100644 --- a/gui/src/hooks/useSetup.ts +++ b/gui/src/hooks/useSetup.ts @@ -4,7 +4,10 @@ import { IdeMessengerContext } from "../context/IdeMessenger"; import { ConfigResult } from "@continuedev/config-yaml"; import { BrowserSerializedContinueConfig } from "core"; -import { selectProfileThunk } from "../redux"; +import { + initializeProfilePreferencesThunk, + selectProfileThunk, +} from "../redux"; import { useAppDispatch, useAppSelector } from "../redux/hooks"; import { selectDefaultModel, @@ -47,6 +50,10 @@ function useSetup() { dispatch(setConfigResult(configResult)); dispatch(selectProfileThunk(profileId)); + if (profileId) { + dispatch(initializeProfilePreferencesThunk({ profileId })); + } + // Perform any actions needed with the config if (configResult.config?.ui?.fontSize) { setLocalStorage("fontSize", configResult.config.ui.fontSize); diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index c75256813..9fcdccd9b 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -427,7 +427,7 @@ export function Chat() { className="flex items-center gap-2" > - Last Session + Last Session
    )} diff --git a/gui/src/redux/slices/profiles/slice.ts b/gui/src/redux/slices/profiles/slice.ts index 2d3386a5f..c8eabf168 100644 --- a/gui/src/redux/slices/profiles/slice.ts +++ b/gui/src/redux/slices/profiles/slice.ts @@ -1,9 +1,15 @@ import { createSlice, PayloadAction } from "@reduxjs/toolkit"; +import { SlashCommandDescription } from "core"; import { ProfileDescription } from "core/config/ConfigHandler"; -import { ensureProfilePreferences } from "./utils"; + +const DEFAULT_SLASH_COMMANDS_BOOKMARKS_COUNT = 5; + +const INITIAL_PREFERENCES_STATE: PreferencesState = { + bookmarkedSlashCommands: [], +}; export interface PreferencesState { - bookmarksByName: string[]; + bookmarkedSlashCommands: string[]; } export interface ProfilesState { @@ -24,21 +30,42 @@ export const profilesSlice = createSlice({ reducers: { setSelectedProfile: (state, { payload }: PayloadAction) => { state.selectedProfileId = payload; - - if (payload) { - ensureProfilePreferences(state, payload); - } }, setAvailableProfiles: ( state, { payload }: PayloadAction, ) => { state.availableProfiles = payload; + }, + initializeProfilePreferences: ( + state, + action: PayloadAction<{ + profileId: string; + defaultSlashCommands?: SlashCommandDescription[]; + }>, + ) => { + const { profileId, defaultSlashCommands = [] } = action.payload; + const defaultSlashCommandNames = defaultSlashCommands.map( + (cmd) => cmd.name, + ); - if (payload) { - for (const profile of payload) { - ensureProfilePreferences(state, profile.id); - } + // First ensure all profile preferences are complete to handle + // the case where a new preference has been added since last load + Object.keys(state.preferencesByProfileId).forEach((pid) => { + state.preferencesByProfileId[pid] = { + ...INITIAL_PREFERENCES_STATE, + ...state.preferencesByProfileId[pid], + }; + }); + + // Then initialize preferences for the new profile if needed + if (!state.preferencesByProfileId[profileId]) { + state.preferencesByProfileId[profileId] = { + bookmarkedSlashCommands: defaultSlashCommandNames.slice( + 0, + DEFAULT_SLASH_COMMANDS_BOOKMARKS_COUNT, + ), + }; } }, bookmarkSlashCommand: ( @@ -46,16 +73,15 @@ export const profilesSlice = createSlice({ action: PayloadAction<{ commandName: string }>, ) => { const { commandName } = action.payload; - const profileId = state.selectedProfileId; + const preferences = + state.preferencesByProfileId[state.selectedProfileId ?? ""]; - if (!profileId) return; + if (!preferences) return; - const bookmarks = state.preferencesByProfileId[profileId].bookmarksByName; - if (!bookmarks.includes(commandName)) { - bookmarks.push(commandName); + if (!preferences.bookmarkedSlashCommands.includes(commandName)) { + preferences.bookmarkedSlashCommands.push(commandName); } }, - unbookmarkSlashCommand: ( state, action: PayloadAction<{ commandName: string }>, @@ -66,9 +92,12 @@ export const profilesSlice = createSlice({ if (!profileId) return; const preferences = state.preferencesByProfileId[profileId]; - preferences.bookmarksByName = preferences.bookmarksByName.filter( - (cmd) => cmd !== commandName, - ); + if (!preferences) return; + + preferences.bookmarkedSlashCommands = + preferences.bookmarkedSlashCommands.filter( + (cmd) => cmd !== commandName, + ); }, }, selectors: { @@ -85,7 +114,7 @@ export const profilesSlice = createSlice({ selectBookmarkedSlashCommands: (state) => { if (!state.selectedProfileId) return []; const preferences = state.preferencesByProfileId[state.selectedProfileId]; - return preferences?.bookmarksByName || []; + return preferences?.bookmarkedSlashCommands || []; }, selectPreferencesByProfileId: (state) => state.preferencesByProfileId, @@ -97,6 +126,7 @@ export const { setSelectedProfile, bookmarkSlashCommand, unbookmarkSlashCommand, + initializeProfilePreferences, } = profilesSlice.actions; export const { diff --git a/gui/src/redux/slices/profiles/thunks.ts b/gui/src/redux/slices/profiles/thunks.ts index 7ca109490..585e7cd2b 100644 --- a/gui/src/redux/slices/profiles/thunks.ts +++ b/gui/src/redux/slices/profiles/thunks.ts @@ -1,7 +1,12 @@ import { createAsyncThunk } from "@reduxjs/toolkit"; import { ProfileDescription } from "core/config/ConfigHandler"; +import { isDeprecatedCommandName } from "../../../components/ConversationStarters/utils"; import { ThunkApiType } from "../../store"; -import { setAvailableProfiles, setSelectedProfile } from "./slice"; +import { + initializeProfilePreferences, + setAvailableProfiles, + setSelectedProfile, +} from "./slice"; export const selectProfileThunk = createAsyncThunk< void, @@ -39,6 +44,7 @@ export const selectProfileThunk = createAsyncThunk< // Only update if there's a change if ((newId ?? null) !== (initialId ?? null)) { dispatch(setSelectedProfile(newId)); + extra.ideMessenger.post("didChangeSelectedProfile", { id: newId, }); @@ -83,3 +89,26 @@ export const updateProfilesThunk = createAsyncThunk< // This will trigger reselection if needed dispatch(selectProfileThunk(selectedProfileId)); }); + +export const initializeProfilePreferencesThunk = createAsyncThunk< + void, + { profileId: string }, + ThunkApiType +>( + "profiles/initializeProfilePreferences", + async (data, { getState, dispatch }) => { + const { profileId } = data; + const state = getState(); + + // Get slash commands from config + const defaultSlashCommands = + state.config.config.slashCommands.filter(isDeprecatedCommandName) ?? []; + + dispatch( + initializeProfilePreferences({ + defaultSlashCommands, + profileId, + }), + ); + }, +); diff --git a/gui/src/redux/slices/profiles/utils.ts b/gui/src/redux/slices/profiles/utils.ts deleted file mode 100644 index 58da69942..000000000 --- a/gui/src/redux/slices/profiles/utils.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ProfilesState } from "./slice"; - -export function ensureProfilePreferences( - state: ProfilesState, - profileId: string, -) { - if (!state.preferencesByProfileId[profileId]) { - state.preferencesByProfileId[profileId] = { - bookmarksByName: [], - }; - } -} diff --git a/gui/src/redux/store.ts b/gui/src/redux/store.ts index 6d6c11b2b..8aff8e1de 100644 --- a/gui/src/redux/store.ts +++ b/gui/src/redux/store.ts @@ -62,12 +62,8 @@ const saveSubsetFilters = [ createFilter("ui", ["toolSettings", "toolGroupSettings"]), createFilter("indexing", []), createFilter("tabs", ["tabs"]), - // Add this new filter for the profiles slice - createFilter("profiles", [ - "preferencesByProfileId", - "selectedOrganizationId", - "selectedProfileId", - ]), + createFilter("organizations", ["selectedOrganizationId"]), + createFilter("profiles", ["preferencesByProfileId", "selectedProfileId"]), ]; const migrations: MigrationManifest = { From 85ebbe151015a609131de341a48a7248b13914b2 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Mon, 24 Mar 2025 16:08:54 -0700 Subject: [PATCH 20/40] remove debugger --- .../ConversationStarters/ConversationStarterCards.tsx | 2 -- gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gui/src/components/ConversationStarters/ConversationStarterCards.tsx b/gui/src/components/ConversationStarters/ConversationStarterCards.tsx index beed0d35d..7e0e2e183 100644 --- a/gui/src/components/ConversationStarters/ConversationStarterCards.tsx +++ b/gui/src/components/ConversationStarters/ConversationStarterCards.tsx @@ -21,8 +21,6 @@ export function ConversationStarterCards() { ); function onClick(command: SlashCommandDescription) { - debugger; - if (command.prompt) { dispatch( setMainEditorContentTrigger(getParagraphNodeFromString(command.prompt)), diff --git a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx index f6abe9e85..5a6a27ae2 100644 --- a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx +++ b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx @@ -21,6 +21,7 @@ interface BlockSettingsToolbarIcon { itemCount?: number; onClick: () => void; isSelected?: boolean; + className?: string; } interface Section { @@ -53,7 +54,7 @@ function BlockSettingsToolbarIcon(props: BlockSettingsToolbarIcon) { style={{ backgroundColor: props.isSelected ? vscBadgeBackground : undefined, }} - className={`relative flex select-none items-center rounded-full px-1 transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/50`} + className={`relative flex select-none items-center rounded-full px-1 transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/50 ${props.className || ""}`} >
    Date: Mon, 24 Mar 2025 16:09:57 -0700 Subject: [PATCH 21/40] Update BlockSettingsTopToolbar.tsx --- gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx index 493959dc1..433770b3d 100644 --- a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx +++ b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx @@ -102,6 +102,7 @@ export function BlockSettingsTopToolbar(props: BlockSettingsTopToolbarProps) {
    Date: Mon, 24 Mar 2025 16:40:37 -0700 Subject: [PATCH 22/40] Update useSetup.ts --- gui/src/hooks/useSetup.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gui/src/hooks/useSetup.ts b/gui/src/hooks/useSetup.ts index ca7705a6f..d90259a9b 100644 --- a/gui/src/hooks/useSetup.ts +++ b/gui/src/hooks/useSetup.ts @@ -7,6 +7,7 @@ import { BrowserSerializedContinueConfig } from "core"; import { initializeProfilePreferencesThunk, selectProfileThunk, + selectSelectedProfileId, } from "../redux"; import { useAppDispatch, useAppSelector } from "../redux/hooks"; import { @@ -31,6 +32,7 @@ function useSetup() { const ideMessenger = useContext(IdeMessengerContext); const history = useAppSelector((store) => store.session.history); const defaultModel = useAppSelector(selectDefaultModel); + const selectedProfileId = useAppSelector(selectSelectedProfileId); const hasLoadedConfig = useRef(false); @@ -50,7 +52,9 @@ function useSetup() { dispatch(setConfigResult(configResult)); dispatch(selectProfileThunk(profileId)); - if (profileId) { + const isNewProfileId = profileId && profileId !== selectedProfileId; + + if (isNewProfileId) { dispatch(initializeProfilePreferencesThunk({ profileId })); } From 3bf2d301d9da910f5462bfcb4ab1b7e5962f32bd Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 24 Mar 2025 17:51:27 -0700 Subject: [PATCH 23/40] styling tweaks --- extensions/vscode/package-lock.json | 4 +- .../components/OllamaStatus.tsx | 8 +- gui/src/components/dialogs/AddDocsDialog.tsx | 2 +- .../InputToolbar/bottom/ToolDropdownItem.tsx | 2 +- .../Lump/sections/docs/DocsDetailsDialog.tsx | 2 +- .../Lump/sections/docs/DocsIndexingStatus.tsx | 2 +- .../components/modelSelection/ModeSelect.tsx | 41 +-- .../components/modelSelection/ModelSelect.tsx | 41 +-- .../platform/AssistantSelect.tsx | 262 +++++++++++++++--- .../platform/AssistantSelectOptions.tsx | 202 -------------- gui/src/components/ui/Listbox.tsx | 8 +- gui/src/components/ui/Transition.tsx | 2 +- gui/src/index.css | 20 -- gui/src/pages/config/ModelRoleSelector.tsx | 12 +- gui/src/pages/config/UserSettingsForm.tsx | 4 +- gui/src/pages/gui/ToolCallDiv/ToolCall.tsx | 2 +- 16 files changed, 273 insertions(+), 341 deletions(-) delete mode 100644 gui/src/components/modelSelection/platform/AssistantSelectOptions.tsx diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index e8f7b966b..f1b847bfa 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.13", + "version": "1.1.14", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.13", + "version": "1.1.14", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", diff --git a/gui/src/components/OnboardingCard/components/OllamaStatus.tsx b/gui/src/components/OnboardingCard/components/OllamaStatus.tsx index 515958503..3839ba6ad 100644 --- a/gui/src/components/OnboardingCard/components/OllamaStatus.tsx +++ b/gui/src/components/OnboardingCard/components/OllamaStatus.tsx @@ -2,12 +2,12 @@ import { ArrowPathIcon, ArrowTopRightOnSquareIcon, } from "@heroicons/react/24/outline"; -import { useState, useContext, useEffect } from "react"; +import { useContext, useEffect, useState } from "react"; +import { StyledActionButton } from "../.."; import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { providers } from "../../../pages/AddNewModel/configs/providers"; -import { StyledActionButton } from "../.."; -import OllamaCompletedStep from "./OllamaCompletedStep"; import { OllamaConnectionStatuses } from "../utils"; +import OllamaCompletedStep from "./OllamaCompletedStep"; interface OllamaStatusProps { isOllamaConnected: boolean; @@ -38,7 +38,7 @@ export function OllamaStatus({ isOllamaConnected }: OllamaStatusProps) { case OllamaConnectionStatuses.WaitingToDownload: return ( -

    {downloadUrl}

    +

    {downloadUrl}

    ); diff --git a/gui/src/components/dialogs/AddDocsDialog.tsx b/gui/src/components/dialogs/AddDocsDialog.tsx index f8006cee7..0221d112c 100644 --- a/gui/src/components/dialogs/AddDocsDialog.tsx +++ b/gui/src/components/dialogs/AddDocsDialog.tsx @@ -116,7 +116,7 @@ function AddDocsDialog() {