styling tweaks
This commit is contained in:
parent
42c7dd0dc9
commit
3bf2d301d9
16 changed files with 273 additions and 341 deletions
4
extensions/vscode/package-lock.json
generated
4
extensions/vscode/package-lock.json
generated
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<StyledActionButton onClick={onClickDownload}>
|
||||
<p className="lines lines-1 mr-1 text-sm underline">{downloadUrl}</p>
|
||||
<p className="mr-1 line-clamp-1 text-sm underline">{downloadUrl}</p>
|
||||
<ArrowTopRightOnSquareIcon width={24} height={24} />
|
||||
</StyledActionButton>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ function AddDocsDialog() {
|
|||
|
||||
<label className="flex w-full flex-col gap-1">
|
||||
<div className="flex flex-row items-center gap-1">
|
||||
<span className="lines lines-1 whitespace-nowrap">
|
||||
<span className="line-clamp-1 whitespace-nowrap">
|
||||
Start URL
|
||||
</span>
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ function ToolDropdownItem(props: ToolDropdownItemProps) {
|
|||
</ToolTip>
|
||||
</>
|
||||
) : null}
|
||||
<span className="lines lines-1 flex items-center gap-1">
|
||||
<span className="line-clamp-1 flex items-center gap-1">
|
||||
{props.tool.faviconUrl && (
|
||||
<img
|
||||
src={props.tool.faviconUrl}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ function DocsDetailsDialog({ startUrl }: DocsDetailsDialogProps) {
|
|||
data-tooltip-id={contentToolTipId}
|
||||
data-tooltip-delay-show={500}
|
||||
>
|
||||
<span className="lines lines-1">
|
||||
<span className="line-clamp-1">
|
||||
{chunk.content}
|
||||
</span>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ function DocsIndexingStatus({
|
|||
style={{
|
||||
fontSize: fontSize(-3),
|
||||
}}
|
||||
className={`lines lines-1 m-0 p-0 text-left ${status?.url ? "cursor-pointer hover:underline" : ""}`}
|
||||
className={`m-0 line-clamp-1 p-0 text-left ${status?.url ? "cursor-pointer hover:underline" : ""}`}
|
||||
>
|
||||
{docConfig.title ?? docConfig.startUrl}
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { MessageModes } from "core";
|
|||
import { modelSupportsTools } from "core/llm/autodetect";
|
||||
import { useEffect, useMemo } from "react";
|
||||
import styled from "styled-components";
|
||||
import { defaultBorderRadius, lightGray, vscInputBackground } from "..";
|
||||
import { lightGray } from "..";
|
||||
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
|
||||
import { selectDefaultModel } from "../../redux/slices/configSlice";
|
||||
import {
|
||||
|
|
@ -19,7 +19,6 @@ import {
|
|||
setMode,
|
||||
} from "../../redux/slices/sessionSlice";
|
||||
import { getFontSize, getMetaKeyLabel, isJetBrains } from "../../util";
|
||||
import Shortcut from "../gui/Shortcut";
|
||||
import {
|
||||
Listbox,
|
||||
ListboxButton,
|
||||
|
|
@ -27,35 +26,6 @@ import {
|
|||
ListboxOptions,
|
||||
} from "../ui/Listbox";
|
||||
|
||||
const StyledListboxButton = styled(ListboxButton)`
|
||||
font-family: inherit;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: ${getFontSize() - 2}px;
|
||||
background: transparent;
|
||||
color: ${lightGray};
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledListboxOptions = styled(ListboxOptions)`
|
||||
margin-top: 4px;
|
||||
position: absolute;
|
||||
list-style: none;
|
||||
padding: 0px;
|
||||
min-width: 180px;
|
||||
cursor: default;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: ${defaultBorderRadius};
|
||||
border: 0.5px solid ${lightGray};
|
||||
background-color: ${vscInputBackground};
|
||||
`;
|
||||
|
||||
const ShortcutText = styled.span`
|
||||
color: ${lightGray};
|
||||
font-size: ${getFontSize() - 3}px;
|
||||
|
|
@ -131,7 +101,7 @@ function ModeSelect() {
|
|||
<ListboxOption value="agent" disabled={!agentModeSupported}>
|
||||
<div className="flex flex-row items-center gap-1.5">
|
||||
<SparklesIcon className="h-3 w-3" />
|
||||
<span className="font-semibold">Agent</span>
|
||||
<span className="">Agent</span>
|
||||
</div>
|
||||
{mode === "agent" && <CheckIcon className="ml-auto h-3 w-3" />}
|
||||
{!agentModeSupported && <span>(Not supported)</span>}
|
||||
|
|
@ -140,7 +110,7 @@ function ModeSelect() {
|
|||
<ListboxOption value="chat">
|
||||
<div className="flex flex-row items-center gap-1.5">
|
||||
<ChatBubbleLeftIcon className="h-3 w-3" />
|
||||
<span className="font-semibold">Chat</span>
|
||||
<span className="">Chat</span>
|
||||
<ShortcutText>{getMetaKeyLabel()}L</ShortcutText>
|
||||
</div>
|
||||
{mode === "chat" && <CheckIcon className="ml-auto h-3 w-3" />}
|
||||
|
|
@ -150,7 +120,7 @@ function ModeSelect() {
|
|||
<ListboxOption value="edit">
|
||||
<div className="flex flex-row items-center gap-1.5">
|
||||
<PencilIcon className="h-3 w-3" />
|
||||
<span className="font-semibold">Edit</span>
|
||||
<span className="">Edit</span>
|
||||
<ShortcutText>{getMetaKeyLabel()}I</ShortcutText>
|
||||
</div>
|
||||
{mode === "edit" && <CheckIcon className="ml-auto h-3 w-3" />}
|
||||
|
|
@ -158,8 +128,7 @@ function ModeSelect() {
|
|||
)}
|
||||
|
||||
<div className="text-lightgray px-2 py-1">
|
||||
<Shortcut>{metaKeyLabel}</Shortcut>
|
||||
<Shortcut>.</Shortcut> for next mode
|
||||
{metaKeyLabel}. or next mode
|
||||
</div>
|
||||
</ListboxOptions>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -18,8 +18,11 @@ import {
|
|||
setDefaultModel,
|
||||
} from "../../redux/slices/configSlice";
|
||||
import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
|
||||
import { fontSize, isMetaEquivalentKeyPressed } from "../../util";
|
||||
import Shortcut from "../gui/Shortcut";
|
||||
import {
|
||||
fontSize,
|
||||
getMetaKeyLabel,
|
||||
isMetaEquivalentKeyPressed,
|
||||
} from "../../util";
|
||||
import { Listbox, ListboxButton, ListboxOption, ListboxOptions } from "../ui";
|
||||
|
||||
interface ModelOptionProps {
|
||||
|
|
@ -150,10 +153,10 @@ function ModelOption({
|
|||
onClick={handleOptionClick}
|
||||
>
|
||||
<div className="flex flex-col gap-0.5">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex flex-grow items-center">
|
||||
<CubeIcon className="mr-2 h-3 w-3 flex-shrink-0" />
|
||||
<span className="flex-grow">
|
||||
<div className="flex flex-1 flex-row items-center justify-between gap-2">
|
||||
<div className="flex flex-1 flex-row items-center gap-2">
|
||||
<CubeIcon className="h-3 w-3 flex-shrink-0" />
|
||||
<span className="line-clamp-1 flex-1">
|
||||
{option.title}
|
||||
{showMissingApiKeyMsg && (
|
||||
<span className="ml-2 text-[10px] italic">
|
||||
|
|
@ -162,9 +165,9 @@ function ModelOption({
|
|||
)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="ml-5 flex items-center">
|
||||
<StyledCog6ToothIcon $hovered={hovered} onClick={onClickGear} />
|
||||
{isSelected && <CheckIcon className="ml-1 h-3 w-3" />}
|
||||
<div className="flex flex-shrink-0 flex-row items-center">
|
||||
{/* <StyledCog6ToothIcon $hovered={hovered} onClick={onClickGear} /> */}
|
||||
{isSelected && <CheckIcon className="h-3 w-3" />}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -252,14 +255,14 @@ function ModelSelect() {
|
|||
dispatch(setDefaultModel({ title: val }));
|
||||
}}
|
||||
>
|
||||
<div className="relative">
|
||||
<div className="relative flex">
|
||||
<ListboxButton
|
||||
data-testid="model-select-button"
|
||||
ref={buttonRef}
|
||||
className="h-[18px] overflow-hidden"
|
||||
className="h-[18px] border-none"
|
||||
>
|
||||
<div className="flex items-center gap-0.5 text-gray-400 transition-colors duration-200">
|
||||
<span className="truncate">
|
||||
<div className="flex items-center gap-1 text-gray-400 transition-colors duration-200">
|
||||
<span className="line-clamp-1">
|
||||
{modelSelectTitle(defaultModel) || "Select model"}{" "}
|
||||
</span>
|
||||
<ChevronDownIcon
|
||||
|
|
@ -268,8 +271,8 @@ function ModelSelect() {
|
|||
/>
|
||||
</div>
|
||||
</ListboxButton>
|
||||
<ListboxOptions>
|
||||
<div className={`no-scrollbar max-h-[300px] overflow-y-scroll`}>
|
||||
<ListboxOptions className={"min-w-[160px]"}>
|
||||
<div className={`no-scrollbar max-h-[300px] overflow-y-auto`}>
|
||||
{sortedOptions.map((option, idx) => (
|
||||
<ModelOption
|
||||
option={option}
|
||||
|
|
@ -281,8 +284,7 @@ function ModelSelect() {
|
|||
))}
|
||||
</div>
|
||||
|
||||
<div className="mt-auto">
|
||||
<div className="bg-lightgray my-0 h-[0.5px]" />
|
||||
<div className="">
|
||||
{selectedProfile?.profileType === "local" && (
|
||||
<>
|
||||
<ListboxOption
|
||||
|
|
@ -298,9 +300,8 @@ function ModelSelect() {
|
|||
</>
|
||||
)}
|
||||
|
||||
<div className="bg-lightgray my-0 h-[0.5px]" />
|
||||
<span className="block px-3 py-2" style={{ color: lightGray }}>
|
||||
<Shortcut>meta '</Shortcut> to toggle model
|
||||
<span className="block px-2 py-1" style={{ color: lightGray }}>
|
||||
{getMetaKeyLabel()}' to toggle model
|
||||
</span>
|
||||
</div>
|
||||
</ListboxOptions>
|
||||
|
|
|
|||
|
|
@ -1,43 +1,148 @@
|
|||
import { ChevronDownIcon, PlusIcon } from "@heroicons/react/24/outline";
|
||||
import { ProfileDescription } from "core/config/ConfigHandler";
|
||||
import {
|
||||
ArrowTopRightOnSquareIcon,
|
||||
BuildingOfficeIcon,
|
||||
ChevronDownIcon,
|
||||
Cog6ToothIcon,
|
||||
ExclamationTriangleIcon,
|
||||
PlusIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useContext, useEffect, useRef } from "react";
|
||||
import { useAuth } from "../../../context/Auth";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { cycleProfile } from "../../../redux";
|
||||
import { cycleProfile, selectProfileThunk } from "../../../redux";
|
||||
import { useAppDispatch, useAppSelector } from "../../../redux/hooks";
|
||||
import { fontSize, isMetaEquivalentKeyPressed } from "../../../util";
|
||||
import { Listbox, ListboxButton, ListboxOptions, Transition } from "../../ui";
|
||||
import {
|
||||
fontSize,
|
||||
getMetaKeyLabel,
|
||||
isLocalProfile,
|
||||
isMetaEquivalentKeyPressed,
|
||||
} from "../../../util";
|
||||
import {
|
||||
Listbox,
|
||||
ListboxButton,
|
||||
ListboxOption,
|
||||
ListboxOptions,
|
||||
Transition,
|
||||
} from "../../ui";
|
||||
|
||||
import { ProfileDescription } from "core/config/ConfigHandler";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { vscCommandCenterInactiveBorder } from "../..";
|
||||
import { ROUTES } from "../../../util/navigation";
|
||||
import { ToolTip } from "../../gui/Tooltip";
|
||||
import { useFontSize } from "../../ui/font";
|
||||
import AssistantIcon from "./AssistantIcon";
|
||||
import { AssistantSelectOptions } from "./AssistantSelectOptions";
|
||||
|
||||
function AssistantSelectButton(props: { selectedProfile: ProfileDescription }) {
|
||||
const isLumpToolbarExpanded = useAppSelector(
|
||||
(state) => state.ui.isBlockSettingsToolbarExpanded,
|
||||
);
|
||||
return (
|
||||
<div className="flex max-w-[50vw] items-center gap-0.5">
|
||||
<div className="mr-1 h-3 w-3 flex-shrink-0 select-none">
|
||||
<AssistantIcon assistant={props.selectedProfile} />
|
||||
</div>
|
||||
<span
|
||||
className={`select-none truncate ${isLumpToolbarExpanded ? "xs:hidden sm:block" : ""}`}
|
||||
>
|
||||
{props.selectedProfile.title}
|
||||
</span>
|
||||
<ChevronDownIcon
|
||||
className="h-2 w-2 flex-shrink-0 select-none"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
interface AssistantSelectOptionProps {
|
||||
profile: ProfileDescription;
|
||||
onClick: () => void;
|
||||
}
|
||||
const AssistantSelectOption = ({
|
||||
profile,
|
||||
onClick,
|
||||
}: AssistantSelectOptionProps) => {
|
||||
const disabled = !!profile.errors?.length;
|
||||
const dispatch = useAppDispatch();
|
||||
const showConfigure = isLocalProfile(profile);
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
function handleOptionClick(e: any) {
|
||||
if (disabled) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
dispatch(selectProfileThunk(profile.id));
|
||||
onClick();
|
||||
}
|
||||
|
||||
function handleConfigure() {
|
||||
ideMessenger.post("config/openProfile", { profileId: profile.id });
|
||||
close();
|
||||
}
|
||||
|
||||
function handleClickError() {
|
||||
ideMessenger.post("config/openProfile", { profileId: profile.id });
|
||||
close();
|
||||
}
|
||||
|
||||
return (
|
||||
<ListboxOption
|
||||
value={profile.id}
|
||||
disabled={disabled}
|
||||
onClick={!disabled ? handleOptionClick : undefined}
|
||||
fontSizeModifier={-2}
|
||||
>
|
||||
<div className="flex w-full flex-col gap-0.5">
|
||||
<div className="flex w-full items-center justify-between">
|
||||
<div className="flex w-full items-center">
|
||||
<div className="mr-2 h-4 w-4 flex-shrink-0">
|
||||
<AssistantIcon assistant={profile} />
|
||||
</div>
|
||||
<span className="line-clamp-1 flex-1">{profile.title}</span>
|
||||
</div>
|
||||
<div className="ml-2 flex items-center">
|
||||
{!profile.errors?.length ? (
|
||||
showConfigure ? (
|
||||
<Cog6ToothIcon
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleConfigure();
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<ArrowTopRightOnSquareIcon
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleConfigure();
|
||||
}}
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
<>
|
||||
<ExclamationTriangleIcon
|
||||
data-tooltip-id={`${profile.id}-errors-tooltip`}
|
||||
className="cursor-pointer text-red-500"
|
||||
onClick={() => handleClickError()}
|
||||
/>
|
||||
<ToolTip id={`${profile.id}-errors-tooltip`}>
|
||||
<div className="font-semibold">Errors</div>
|
||||
{JSON.stringify(profile.errors, null, 2)}
|
||||
</ToolTip>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListboxOption>
|
||||
);
|
||||
};
|
||||
|
||||
export default function AssistantSelect() {
|
||||
const dispatch = useAppDispatch();
|
||||
const buttonRef = useRef<HTMLButtonElement>(null);
|
||||
const { selectedProfile, selectedOrganization } = useAuth();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const isLumpToolbarExpanded = useAppSelector(
|
||||
(state) => state.ui.isBlockSettingsToolbarExpanded,
|
||||
);
|
||||
|
||||
const { profiles, session, login } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
|
||||
function close() {
|
||||
if (buttonRef.current) {
|
||||
buttonRef.current.click();
|
||||
}
|
||||
}
|
||||
function onNewAssistant() {
|
||||
ideMessenger.post("controlPlane/openUrl", {
|
||||
path: "new",
|
||||
orgSlug: selectedOrganization?.slug,
|
||||
});
|
||||
close();
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
let lastToggleTime = 0;
|
||||
|
|
@ -64,6 +169,9 @@ export default function AssistantSelect() {
|
|||
};
|
||||
}, []);
|
||||
|
||||
const tinyFont = useFontSize(-4);
|
||||
const smallFont = useFontSize(-3);
|
||||
|
||||
if (!selectedProfile) {
|
||||
return (
|
||||
<div
|
||||
|
|
@ -73,35 +181,109 @@ export default function AssistantSelect() {
|
|||
orgSlug: selectedOrganization?.slug,
|
||||
});
|
||||
}}
|
||||
className="flex cursor-pointer select-none items-center gap-1 whitespace-nowrap text-gray-400"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
className="flex cursor-pointer select-none items-center gap-1 text-gray-400"
|
||||
style={{ fontSize: smallFont }}
|
||||
>
|
||||
<PlusIcon className="h-3 w-3 select-none" /> Create your first assistant
|
||||
<PlusIcon className="h-3 w-3 flex-shrink-0 select-none" />
|
||||
<span
|
||||
className={`line-clamp-1 select-none ${isLumpToolbarExpanded ? "xs:hidden sm:line-clamp-1" : ""}`}
|
||||
>
|
||||
Create your first assistant
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Listbox>
|
||||
<div className="relative">
|
||||
<div className="relative flex">
|
||||
<ListboxButton
|
||||
data-testid="assistant-select-button"
|
||||
ref={buttonRef}
|
||||
className="mt-0.5 cursor-pointer border-none bg-transparent text-gray-400 hover:brightness-125"
|
||||
className="border-none bg-transparent text-gray-400 hover:brightness-125"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
<AssistantSelectButton selectedProfile={selectedProfile} />
|
||||
<div className="flex flex-row items-center gap-1.5">
|
||||
<div className="h-3 w-3 flex-shrink-0 select-none">
|
||||
<AssistantIcon assistant={selectedProfile} />
|
||||
</div>
|
||||
<span
|
||||
className={`line-clamp-1 select-none ${isLumpToolbarExpanded ? "xs:hidden sm:line-clamp-1" : ""}`}
|
||||
>
|
||||
{selectedProfile.title}
|
||||
</span>
|
||||
</div>
|
||||
<ChevronDownIcon
|
||||
className="h-2 w-2 flex-shrink-0 select-none"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</ListboxButton>
|
||||
|
||||
<Transition>
|
||||
<ListboxOptions className="bg-vsc-input-background absolute right-0 top-full z-[1000] mr-1 mt-1 flex min-w-[200px] max-w-[90vw] cursor-default flex-row overflow-hidden rounded-md border-2 border-zinc-600 p-0">
|
||||
<AssistantSelectOptions
|
||||
onClose={() => {
|
||||
if (buttonRef.current) {
|
||||
buttonRef.current.click();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<ListboxOptions className="pb-0">
|
||||
<div
|
||||
className={`thin-scrollbar flex max-h-[300px] flex-col gap-1 overflow-y-auto py-1`}
|
||||
>
|
||||
{profiles?.map((profile, idx) => {
|
||||
return (
|
||||
<AssistantSelectOption profile={profile} onClick={close} />
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col">
|
||||
<div
|
||||
className="my-0 h-[0.5px]"
|
||||
style={{
|
||||
backgroundColor: vscCommandCenterInactiveBorder,
|
||||
}}
|
||||
/>
|
||||
|
||||
<ListboxOption
|
||||
value={"new-assistant"}
|
||||
fontSizeModifier={-2}
|
||||
onClick={session ? onNewAssistant : () => login(false)}
|
||||
>
|
||||
<div className="flex flex-row items-center gap-2">
|
||||
<PlusIcon className="h-4 w-4 flex-shrink-0" />
|
||||
New Assistant
|
||||
</div>
|
||||
</ListboxOption>
|
||||
|
||||
<div
|
||||
className="my-0 h-[0.5px]"
|
||||
style={{
|
||||
backgroundColor: vscCommandCenterInactiveBorder,
|
||||
}}
|
||||
/>
|
||||
|
||||
<div
|
||||
className="text-lightgray flex items-center justify-between px-2 py-1"
|
||||
style={{
|
||||
fontSize: tinyFont,
|
||||
}}
|
||||
>
|
||||
<span className="block">
|
||||
<code>{getMetaKeyLabel()} ⇧ '</code> to toggle
|
||||
</span>
|
||||
<div
|
||||
className="flex items-center gap-1"
|
||||
onClick={() => navigate(ROUTES.CONFIG)}
|
||||
>
|
||||
{selectedOrganization?.iconUrl ? (
|
||||
<img
|
||||
src={selectedOrganization.iconUrl}
|
||||
className="h-4 w-4 rounded-full"
|
||||
/>
|
||||
) : (
|
||||
<BuildingOfficeIcon className="h-4 w-4" />
|
||||
)}
|
||||
<span className="hover:cursor-pointer hover:underline">
|
||||
{selectedOrganization?.name || "Personal"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListboxOptions>
|
||||
</Transition>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,202 +0,0 @@
|
|||
import { BuildingOfficeIcon, PlusIcon } from "@heroicons/react/24/outline";
|
||||
import { ProfileDescription } from "core/config/ConfigHandler";
|
||||
import { useContext } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { lightGray } from "../..";
|
||||
import { useAuth } from "../../../context/Auth";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { selectProfileThunk } from "../../../redux";
|
||||
import { useAppDispatch } from "../../../redux/hooks";
|
||||
import { getFontSize, getMetaKeyLabel, isLocalProfile } from "../../../util";
|
||||
import { ROUTES } from "../../../util/navigation";
|
||||
import { ToolTip } from "../../gui/Tooltip";
|
||||
import { ListboxOption } from "../../ui";
|
||||
import AssistantIcon from "./AssistantIcon";
|
||||
|
||||
import {
|
||||
ArrowTopRightOnSquareIcon,
|
||||
Cog6ToothIcon,
|
||||
ExclamationTriangleIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
|
||||
// const IconBase = styled.div<{ $hovered: boolean }>`
|
||||
|
||||
// `;
|
||||
|
||||
// const StyledCog6ToothIcon = styled(IconBase).attrs({ as: Cog6ToothIcon })``;
|
||||
// const StyledArrowTopRightOnSquareIcon = styled(IconBase).attrs({
|
||||
// as: ArrowTopRightOnSquareIcon,
|
||||
// })``;
|
||||
// const StyledExclamationTriangleIcon = styled(IconBase).attrs({
|
||||
// as: ExclamationTriangleIcon,
|
||||
// })``;
|
||||
|
||||
// width: 1.2em;
|
||||
// height: 1.2em;
|
||||
// cursor: pointer;
|
||||
// padding: 4px;
|
||||
// border-radius: ${defaultBorderRadius};
|
||||
// opacity: ${(props) => (props.$hovered ? 0.75 : 0)};
|
||||
// visibility: ${(props) => (props.$hovered ? "visible" : "hidden")};
|
||||
|
||||
// &:hover {
|
||||
// opacity: 1;
|
||||
// background-color: ${lightGray}33;
|
||||
// }
|
||||
|
||||
interface AssistantSelectOptionsProps {
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
export function AssistantSelectOptions({
|
||||
onClose,
|
||||
}: AssistantSelectOptionsProps) {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const { profiles, selectedProfile, selectedOrganization, session, login } =
|
||||
useAuth();
|
||||
const dispatch = useAppDispatch();
|
||||
const navigate = useNavigate();
|
||||
|
||||
function onNewAssistant() {
|
||||
ideMessenger.post("controlPlane/openUrl", {
|
||||
path: "new",
|
||||
orgSlug: selectedOrganization?.slug,
|
||||
});
|
||||
onClose();
|
||||
}
|
||||
|
||||
function handleConfigure(profile: ProfileDescription) {
|
||||
ideMessenger.post("config/openProfile", { profileId: profile.id });
|
||||
onClose();
|
||||
}
|
||||
|
||||
function handleClickError(profileId: string) {
|
||||
ideMessenger.post("config/openProfile", { profileId });
|
||||
onClose();
|
||||
}
|
||||
|
||||
if (!profiles) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="border-lightgray flex w-full flex-col overflow-x-hidden pt-0">
|
||||
<div className={`max-h-[300px] w-full`}>
|
||||
{profiles.map((profile, idx) => {
|
||||
const disabled = !!profile.errors?.length;
|
||||
const showConfigure = isLocalProfile(profile);
|
||||
// const [hovered, setHovered] = useState(false);
|
||||
|
||||
function handleOptionClick(e: any) {
|
||||
if (disabled) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
dispatch(selectProfileThunk(profile.id));
|
||||
onClose();
|
||||
}
|
||||
|
||||
return (
|
||||
<ListboxOption
|
||||
value={profile.id}
|
||||
key={idx}
|
||||
disabled={disabled}
|
||||
onClick={!disabled ? handleOptionClick : undefined}
|
||||
>
|
||||
<div className="flex w-full flex-col gap-0.5">
|
||||
<div className="flex w-full items-center justify-between">
|
||||
<div className="flex w-full items-center">
|
||||
<div className="mr-2 h-4 w-4 flex-shrink-0">
|
||||
<AssistantIcon assistant={profile} />
|
||||
</div>
|
||||
<span
|
||||
className="flex-1 truncate"
|
||||
style={{ fontSize: getFontSize() - 2 }}
|
||||
>
|
||||
{profile.title}
|
||||
</span>
|
||||
</div>
|
||||
<div className="ml-2 flex items-center">
|
||||
{!profile.errors?.length ? (
|
||||
showConfigure ? (
|
||||
<Cog6ToothIcon
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleConfigure(profile);
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<ArrowTopRightOnSquareIcon
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleConfigure(profile);
|
||||
}}
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
<>
|
||||
<ExclamationTriangleIcon
|
||||
data-tooltip-id={`${idx}-errors-tooltip`}
|
||||
className="cursor-pointer text-red-500"
|
||||
onClick={() => handleClickError(profile.id)}
|
||||
/>
|
||||
<ToolTip id={`${idx}-errors-tooltip`}>
|
||||
<div className="font-semibold">Errors</div>
|
||||
{JSON.stringify(profile.errors, null, 2)}
|
||||
</ToolTip>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListboxOption>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div className="mt-auto w-full">
|
||||
<ListboxOption
|
||||
value={"new-assistant"}
|
||||
onClick={session ? onNewAssistant : () => login(false)}
|
||||
>
|
||||
<div
|
||||
className="flex items-center py-0.5"
|
||||
style={{ fontSize: getFontSize() - 2 }}
|
||||
>
|
||||
<PlusIcon className="mr-2 h-4 w-4 flex-shrink-0" />
|
||||
New Assistant
|
||||
</div>
|
||||
</ListboxOption>
|
||||
|
||||
<div className="bg-lightgray my-0 h-[0.5px]" />
|
||||
|
||||
<div
|
||||
className="flex items-center justify-between p-2"
|
||||
style={{ color: lightGray, fontSize: getFontSize() - 4 }}
|
||||
>
|
||||
<span className="block">
|
||||
<code>{getMetaKeyLabel()} ⇧ '</code> to toggle
|
||||
</span>
|
||||
<div
|
||||
className="flex items-center gap-1"
|
||||
onClick={() => navigate(ROUTES.CONFIG)}
|
||||
>
|
||||
{selectedOrganization?.iconUrl ? (
|
||||
<img
|
||||
src={selectedOrganization.iconUrl}
|
||||
className="h-4 w-4 rounded-full"
|
||||
/>
|
||||
) : (
|
||||
<BuildingOfficeIcon className="h-4 w-4" />
|
||||
)}
|
||||
<span className="hover:cursor-pointer hover:underline">
|
||||
{selectedOrganization?.name || "Personal"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import {
|
|||
Listbox,
|
||||
} from "@headlessui/react";
|
||||
import * as React from "react";
|
||||
import { vscCommandCenterInactiveBorder } from "..";
|
||||
import { cn } from "../../util/cn";
|
||||
import { FontSizeModifier, useFontSize } from "./font";
|
||||
|
||||
|
|
@ -20,7 +21,7 @@ const ListboxButton = React.forwardRef<HTMLButtonElement, ListboxButtonProps>(
|
|||
ref={ref}
|
||||
{...props}
|
||||
className={cn(
|
||||
"border-vsc-input-border bg-vsc-input-background text-vsc-foreground m-0 flex flex-1 cursor-pointer flex-row items-center rounded-sm border border-solid px-1 py-0.5",
|
||||
"border-vsc-input-border bg-vsc-background text-vsc-foreground m-0 flex flex-1 cursor-pointer flex-row items-center gap-1 rounded-sm border border-solid px-1 py-0.5 text-left",
|
||||
props.className,
|
||||
)}
|
||||
style={{
|
||||
|
|
@ -41,13 +42,14 @@ const ListboxOptions = React.forwardRef<HTMLUListElement, ListboxOptionsProps>(
|
|||
return (
|
||||
<HLOptions
|
||||
ref={ref}
|
||||
anchor={"top start"}
|
||||
anchor={"bottom start"}
|
||||
{...props}
|
||||
className={cn(
|
||||
"bg-vsc-input-background border-vsc-input-border no-scrollbar max-h-[90vh] overflow-auto border border-solid p-0 shadow-lg",
|
||||
"bg-vsc-input-background flex flex-col overflow-auto rounded-sm px-0 shadow-md",
|
||||
props.className,
|
||||
)}
|
||||
style={{
|
||||
border: `1px solid ${vscCommandCenterInactiveBorder}`,
|
||||
fontSize,
|
||||
...props.style,
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ function Transition(props: TransitionProps) {
|
|||
leaveFrom="transform scale-100 opacity-100"
|
||||
leaveTo="transform scale-95 opacity-0"
|
||||
{...props}
|
||||
className={cn("", props.className)}
|
||||
className={cn("flex flex-col", props.className)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,26 +81,6 @@ body {
|
|||
scrollbar-width: none; /* Firefox */
|
||||
}
|
||||
|
||||
.lines {
|
||||
/* white-space: pre-wrap; */
|
||||
word-break: break-word;
|
||||
overflow: hidden;
|
||||
line-height: 1.375;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.lines-3 {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.lines-1 {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.truncate-start {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
|
|
|
|||
|
|
@ -50,17 +50,17 @@ const ModelRoleSelector = ({
|
|||
{({ open }) => (
|
||||
<div className="relative">
|
||||
<ListboxButton
|
||||
aria-disabled={models.length === 0}
|
||||
className={`${models.length === 0 ? "cursor-not-allowed opacity-50" : ""} `}
|
||||
disabled={models.length === 0}
|
||||
className={`bg-vsc-input-background`}
|
||||
>
|
||||
{models.length === 0 ? (
|
||||
<span
|
||||
className="text-lightgray lines lines-1 italic"
|
||||
className="text-lightgray line-clamp-1 italic"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>{`No ${displayName} models${["Chat", "Apply", "Edit"].includes(displayName) ? ". Using chat model" : ""}`}</span>
|
||||
) : (
|
||||
<span
|
||||
className="lines lines-1"
|
||||
className="line-clamp-1"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
{selectedModel?.title ?? `Select ${displayName} model`}
|
||||
|
|
@ -79,9 +79,9 @@ const ModelRoleSelector = ({
|
|||
className="min-w-40"
|
||||
>
|
||||
{models.map((option, idx) => (
|
||||
<ListboxOption key={idx} value={option.title}>
|
||||
<ListboxOption key={idx} value={option.title} className={""}>
|
||||
<span
|
||||
className="lines lines-1 relative flex h-4 items-center gap-2"
|
||||
className="line-clamp-1 flex h-4 items-center gap-2"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
{option.title}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ export function UserSettingsForm() {
|
|||
<div className="divide-x-0 divide-y-2 divide-solid divide-zinc-700">
|
||||
{!controlServerBetaEnabled || hubEnabled ? (
|
||||
<div className="flex flex-col">
|
||||
<div className="flex max-w-[400px] flex-col">
|
||||
<div className="flex flex-col">
|
||||
<div className="flex flex-col gap-4 py-6">
|
||||
<div>
|
||||
<h2 className="mb-2 mt-0">User settings</h2>
|
||||
|
|
@ -208,7 +208,7 @@ export function UserSettingsForm() {
|
|||
/> */}
|
||||
|
||||
<label className="flex items-center justify-between gap-3">
|
||||
<span className="lines lines-1 text-left">
|
||||
<span className="line-clamp-1 text-left">
|
||||
Multiline Autocompletions
|
||||
</span>
|
||||
<Select
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ export function ToolCallDisplay(props: ToolCallDisplayProps) {
|
|||
{args.map(([key, value]) => (
|
||||
<div key={key} className="flex gap-2 py-0.5">
|
||||
<span className="text-lightgray">{key}:</span>
|
||||
<code className="lines lines-1">{value}</code>
|
||||
<code className="line-clamp-1">{value}</code>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue