Merge branch 'main' into nate/edit-button
This commit is contained in:
commit
d19872bc0f
23 changed files with 265 additions and 53 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ export default class ControlPlaneProfileLoader implements IProfileLoader {
|
|||
undefined,
|
||||
this.workspaceId,
|
||||
undefined,
|
||||
null,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ export default class LocalProfileLoader implements IProfileLoader {
|
|||
undefined,
|
||||
this.description.id,
|
||||
this.overrideAssistantFile?.path,
|
||||
null,
|
||||
);
|
||||
|
||||
this.description.errors = result.errors;
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
private readonly ide: IDE,
|
||||
private ideSettingsPromise: Promise<IdeSettings>,
|
||||
private writeLog: (message: string) => Promise<void>,
|
||||
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<IdeSettings>,
|
||||
writeLog: (message: string) => Promise<void>,
|
||||
onReload: () => void,
|
||||
rawYaml: string,
|
||||
orgScopeId: string | null,
|
||||
): Promise<PlatformProfileLoader> {
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ export default async function doLoadConfig(
|
|||
platformConfigMetadata: PlatformConfigMetadata | undefined,
|
||||
profileId: string,
|
||||
overrideConfigYamlByPath: string | undefined,
|
||||
orgScopeId: string | null,
|
||||
): Promise<ConfigResult<ContinueConfig>> {
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -41,22 +41,31 @@ 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 {
|
||||
constructor(
|
||||
private orgScopeId: string | null,
|
||||
private readonly client: ControlPlaneClient,
|
||||
) {}
|
||||
|
||||
async resolveFQSNs(fqsns: FQSN[]): Promise<(SecretResult | undefined)[]> {
|
||||
return fqsns.map((fqsn) => {
|
||||
return undefined;
|
||||
});
|
||||
if (fqsns.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
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,
|
||||
ideSettings: IdeSettings,
|
||||
): Promise<ConfigResult<AssistantUnrolled>> {
|
||||
let config =
|
||||
overrideConfigYaml ??
|
||||
|
|
@ -68,12 +77,18 @@ async function loadConfigYaml(
|
|||
versionSlug: "",
|
||||
},
|
||||
rawYaml,
|
||||
new RegistryClient(),
|
||||
new RegistryClient(
|
||||
await controlPlaneClient.getAccessToken(),
|
||||
getControlPlaneEnvSync(
|
||||
ideSettings.continueTestEnvironment,
|
||||
ideSettings.enableControlServerBeta,
|
||||
).CONTROL_PLANE_URL,
|
||||
),
|
||||
{
|
||||
currentUserSlug: "",
|
||||
onPremProxyUrl: null,
|
||||
orgScopeId: null,
|
||||
platformClient: new LocalPlatformClient(),
|
||||
orgScopeId,
|
||||
platformClient: new LocalPlatformClient(orgScopeId, controlPlaneClient),
|
||||
renderSecrets: true,
|
||||
},
|
||||
));
|
||||
|
|
@ -394,7 +409,6 @@ async function configYamlToContinueConfig(
|
|||
|
||||
export async function loadContinueConfigFromYaml(
|
||||
ide: IDE,
|
||||
workspaceConfigs: string[],
|
||||
ideSettings: IdeSettings,
|
||||
ideInfo: IdeInfo,
|
||||
uniqueId: string,
|
||||
|
|
@ -404,6 +418,7 @@ export async function loadContinueConfigFromYaml(
|
|||
platformConfigMetadata: PlatformConfigMetadata | undefined,
|
||||
controlPlaneClient: ControlPlaneClient,
|
||||
configYamlPath: string | undefined,
|
||||
orgScopeId: string | null,
|
||||
): Promise<ConfigResult<ContinueConfig>> {
|
||||
const rawYaml =
|
||||
overrideConfigYaml === undefined
|
||||
|
|
@ -414,11 +429,11 @@ export async function loadContinueConfigFromYaml(
|
|||
: "";
|
||||
|
||||
const configYamlResult = await loadConfigYaml(
|
||||
workspaceConfigs,
|
||||
rawYaml,
|
||||
overrideConfigYaml,
|
||||
ide,
|
||||
controlPlaneClient,
|
||||
orgScopeId,
|
||||
ideSettings,
|
||||
);
|
||||
|
||||
if (!configYamlResult.config || configYamlResult.configLoadInterrupted) {
|
||||
|
|
|
|||
|
|
@ -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", {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
8
core/package-lock.json
generated
8
core/package-lock.json
generated
|
|
@ -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",
|
||||
|
|
@ -2974,9 +2974,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",
|
||||
|
|
|
|||
|
|
@ -47,7 +47,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",
|
||||
|
|
|
|||
10
gui/package-lock.json
generated
10
gui/package-lock.json
generated
|
|
@ -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": "^2.2.0",
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@reduxjs/toolkit": "^2.3.0",
|
||||
|
|
@ -111,7 +111,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",
|
||||
|
|
@ -554,9 +554,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",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
"test:watch": "vitest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@continuedev/config-yaml": "^1.0.63",
|
||||
"@continuedev/config-yaml": "^1.0.67",
|
||||
"@headlessui/react": "^2.2.0",
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@reduxjs/toolkit": "^2.3.0",
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<PlusIcon className={props.className} height="1.2em" width="1.2em" />
|
||||
);
|
||||
return <PlusIcon className={props.className + " h-3 w-3"} />;
|
||||
}
|
||||
|
||||
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}
|
||||
</span>
|
||||
|
|
@ -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" &&
|
||||
|
|
|
|||
|
|
@ -132,7 +132,6 @@ export function BlockSettingsTopToolbar(props: BlockSettingsTopToolbarProps) {
|
|||
<div className="ml-auto">
|
||||
<AssistantSelect />
|
||||
</div>
|
||||
<AssistantSelect />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ export function ModelsSection() {
|
|||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<div className="text-[${getFontSize() - 1}px] grid grid-cols-1 gap-x-2 gap-y-1 pb-2 sm:grid-cols-[auto_1fr]">
|
||||
<ModelRoleSelector
|
||||
displayName="Chat"
|
||||
|
|
@ -108,7 +108,7 @@ export function ModelsSection() {
|
|||
onSelect={(model) => handleRoleUpdate("rerank", model)}
|
||||
/>
|
||||
</div>
|
||||
<ExploreBlocksButton blockType="models" />
|
||||
</>
|
||||
<ExploreBlocksButton blockType={"models"} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,9 +108,10 @@ function ModeSelect() {
|
|||
<div className="relative">
|
||||
<ListboxButton
|
||||
data-testid="mode-select-button"
|
||||
className="gap-1 rounded-full px-2 py-0.5 text-gray-400 transition-colors duration-200"
|
||||
className="gap-1 border-none px-2 py-0.5 text-gray-400 transition-colors duration-200"
|
||||
style={{
|
||||
backgroundColor: `${lightGray}33`,
|
||||
borderRadius: "9999px",
|
||||
}}
|
||||
>
|
||||
{getModeIcon(mode)}
|
||||
|
|
@ -134,7 +135,7 @@ function ModeSelect() {
|
|||
|
||||
<ListboxOption value="chat">
|
||||
<div className="flex flex-row items-center gap-1.5">
|
||||
<ChatBubbleLeftIcon className="h-2.5 w-2.5" />
|
||||
<ChatBubbleLeftIcon className="h-3 w-3" />
|
||||
<span className="">Chat</span>
|
||||
<ShortcutText>{getMetaKeyLabel()}L</ShortcutText>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ const AssistantSelectOption = ({
|
|||
{!profile.errors?.length ? (
|
||||
isLocalProfile(profile) ? (
|
||||
<Cog6ToothIcon
|
||||
className="h-4 w-4 flex-shrink-0 cursor-pointer"
|
||||
className="h-3 w-3 flex-shrink-0 cursor-pointer"
|
||||
style={{
|
||||
opacity: hovered ? 1 : 0,
|
||||
}}
|
||||
|
|
@ -106,7 +106,7 @@ const AssistantSelectOption = ({
|
|||
style={{
|
||||
opacity: hovered ? 1 : 0,
|
||||
}}
|
||||
className="h-4 w-4 flex-shrink-0 cursor-pointer"
|
||||
className="h-3 w-3 flex-shrink-0 cursor-pointer"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
|
@ -118,7 +118,7 @@ const AssistantSelectOption = ({
|
|||
<>
|
||||
<ExclamationTriangleIcon
|
||||
data-tooltip-id={`${profile.id}-errors-tooltip`}
|
||||
className="h-4 w-4 flex-shrink-0 cursor-pointer text-red-500"
|
||||
className="h-3 w-3 flex-shrink-0 cursor-pointer text-red-500"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
|
|
|||
163
gui/src/components/modelSelection/platform/shared.tsx
Normal file
163
gui/src/components/modelSelection/platform/shared.tsx
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
import { ConfigValidationError } from "@continuedev/config-yaml";
|
||||
import {
|
||||
ArrowTopRightOnSquareIcon,
|
||||
Cog6ToothIcon,
|
||||
ExclamationTriangleIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useState } from "react";
|
||||
import styled from "styled-components";
|
||||
import {
|
||||
defaultBorderRadius,
|
||||
lightGray,
|
||||
vscCommandCenterInactiveBorder,
|
||||
} from "../..";
|
||||
import { ToolTip } from "../../gui/Tooltip";
|
||||
|
||||
export const OptionDiv = styled.div<{
|
||||
isDisabled?: boolean;
|
||||
isSelected?: boolean;
|
||||
}>`
|
||||
padding: 6px 12px;
|
||||
|
||||
min-width: 0px;
|
||||
|
||||
${({ isDisabled, isSelected }) =>
|
||||
!isDisabled &&
|
||||
`
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: ${lightGray}33;
|
||||
}
|
||||
|
||||
${
|
||||
isSelected &&
|
||||
`
|
||||
background: ${lightGray}22;
|
||||
`
|
||||
}
|
||||
`}
|
||||
|
||||
${({ isDisabled }) =>
|
||||
isDisabled &&
|
||||
`
|
||||
opacity: 0.5;
|
||||
`}
|
||||
`;
|
||||
|
||||
export const MAX_HEIGHT_PX = 300;
|
||||
|
||||
export const Divider = styled.div`
|
||||
height: 0.5px;
|
||||
background-color: ${vscCommandCenterInactiveBorder};
|
||||
`;
|
||||
|
||||
interface ModelOptionProps {
|
||||
children: React.ReactNode;
|
||||
idx: number;
|
||||
disabled: boolean;
|
||||
selected: boolean;
|
||||
showConfigure: boolean;
|
||||
onOpenConfig: () => void;
|
||||
onClick: () => void;
|
||||
errors?: ConfigValidationError[];
|
||||
onClickError?: (e: any) => void;
|
||||
}
|
||||
|
||||
const IconBase = styled.div<{ $hovered: boolean }>`
|
||||
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;
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledCog6ToothIcon = styled(IconBase).attrs({ as: Cog6ToothIcon })``;
|
||||
const StyledArrowTopRightOnSquareIcon = styled(IconBase).attrs({
|
||||
as: ArrowTopRightOnSquareIcon,
|
||||
})``;
|
||||
const StyledExclamationTriangleIcon = styled(IconBase).attrs({
|
||||
as: ExclamationTriangleIcon,
|
||||
})``;
|
||||
|
||||
export function Option({
|
||||
children,
|
||||
idx,
|
||||
disabled,
|
||||
onClick,
|
||||
showConfigure,
|
||||
selected,
|
||||
errors,
|
||||
onClickError,
|
||||
onOpenConfig,
|
||||
}: ModelOptionProps) {
|
||||
const [hovered, setHovered] = useState(false);
|
||||
|
||||
function handleOptionClick(e: any) {
|
||||
if (disabled) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
onClick();
|
||||
}
|
||||
|
||||
return (
|
||||
<OptionDiv
|
||||
key={idx}
|
||||
isDisabled={disabled}
|
||||
onMouseEnter={() => setHovered(true)}
|
||||
onMouseLeave={() => setHovered(false)}
|
||||
isSelected={selected}
|
||||
onClick={!disabled ? handleOptionClick : undefined}
|
||||
>
|
||||
<div className="flex w-full flex-col gap-0.5">
|
||||
<div className="flex w-full items-center justify-between">
|
||||
{children}
|
||||
<div className="ml-2 flex items-center">
|
||||
{!errors?.length ? (
|
||||
showConfigure ? (
|
||||
<StyledCog6ToothIcon
|
||||
$hovered={hovered}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
onOpenConfig();
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<StyledArrowTopRightOnSquareIcon
|
||||
$hovered={hovered}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
onOpenConfig();
|
||||
}}
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
<>
|
||||
<StyledExclamationTriangleIcon
|
||||
data-tooltip-id={`${idx}-errors-tooltip`}
|
||||
$hovered={hovered}
|
||||
className="cursor-pointer text-red-500"
|
||||
onClick={onClickError}
|
||||
/>
|
||||
<ToolTip id={`${idx}-errors-tooltip`}>
|
||||
<div className="font-semibold">Errors</div>
|
||||
{JSON.stringify(errors, null, 2)}
|
||||
</ToolTip>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</OptionDiv>
|
||||
);
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ import {
|
|||
Listbox,
|
||||
} from "@headlessui/react";
|
||||
import * as React from "react";
|
||||
import { vscCommandCenterInactiveBorder } from "..";
|
||||
import { defaultBorderRadius, vscCommandCenterInactiveBorder } from "..";
|
||||
import { cn } from "../../util/cn";
|
||||
import { FontSizeModifier, useFontSize } from "./font";
|
||||
|
||||
|
|
@ -21,11 +21,12 @@ 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 gap-1 rounded-sm border border-solid px-1 py-0.5 text-left transition-colors duration-200",
|
||||
"border-vsc-input-border bg-vsc-input-background text-vsc-foreground m-0 flex flex-1 cursor-pointer flex-row items-center gap-1 border border-solid px-1 py-0.5 text-left transition-colors duration-200",
|
||||
props.className,
|
||||
)}
|
||||
style={{
|
||||
fontSize,
|
||||
borderRadius: defaultBorderRadius,
|
||||
...props.style,
|
||||
}}
|
||||
/>
|
||||
|
|
@ -45,12 +46,13 @@ const ListboxOptions = React.forwardRef<HTMLUListElement, ListboxOptionsProps>(
|
|||
anchor={"bottom start"}
|
||||
{...props}
|
||||
className={cn(
|
||||
"bg-vsc-input-background flex flex-col overflow-auto rounded-sm px-0 shadow-md",
|
||||
"bg-vsc-input-background flex flex-col overflow-auto px-0 shadow-md",
|
||||
props.className,
|
||||
)}
|
||||
style={{
|
||||
border: `1px solid ${vscCommandCenterInactiveBorder}`,
|
||||
fontSize,
|
||||
borderRadius: defaultBorderRadius,
|
||||
...props.style,
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,12 @@ export function AccountButton() {
|
|||
|
||||
if (!session) {
|
||||
return (
|
||||
<SecondaryButton onClick={() => login(false)}>Sign in</SecondaryButton>
|
||||
<SecondaryButton
|
||||
className="whitespace-nowrap"
|
||||
onClick={() => login(false)}
|
||||
>
|
||||
Sign in
|
||||
</SecondaryButton>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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<string> {
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue