Merge branch 'main' into pe/global-docs-cache
This commit is contained in:
commit
849a5eaf91
89 changed files with 1772 additions and 1217 deletions
|
|
@ -243,7 +243,7 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
|
|||
fs.mkdirSync(targetDir, { recursive: true });
|
||||
console.log(`[info] Building ${target}...`);
|
||||
execCmdSync(
|
||||
`npx pkg --no-bytecode --public-packages "*" --public pkgJson/${target} --out-path ${targetDir}`,
|
||||
`npx pkg --no-bytecode --public-packages "*" --public --compress GZip pkgJson/${target} --out-path ${targetDir}`,
|
||||
);
|
||||
|
||||
// Download and unzip prebuilt sqlite3 binary for the target
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
));
|
||||
|
|
@ -206,7 +221,6 @@ async function configYamlToContinueConfig(
|
|||
continueConfig.systemMessage,
|
||||
);
|
||||
|
||||
//
|
||||
if (modelsArrayRoles.some((role) => model.roles?.includes(role))) {
|
||||
continueConfig.models.push(...llms);
|
||||
}
|
||||
|
|
@ -244,7 +258,10 @@ async function configYamlToContinueConfig(
|
|||
} else {
|
||||
continueConfig.modelsByRole.embed.push(
|
||||
new embeddingsProviderClass(
|
||||
options,
|
||||
{
|
||||
...options,
|
||||
title: options.name,
|
||||
},
|
||||
(url: string | URL, init: any) =>
|
||||
fetchwithRequestOptions(url, init, {
|
||||
...options.requestOptions,
|
||||
|
|
@ -265,10 +282,15 @@ async function configYamlToContinueConfig(
|
|||
const rerankerClass = AllRerankers[provider];
|
||||
if (rerankerClass) {
|
||||
continueConfig.modelsByRole.rerank.push(
|
||||
new rerankerClass(options, (url: string | URL, init: any) =>
|
||||
fetchwithRequestOptions(url, init, {
|
||||
...options.requestOptions,
|
||||
}),
|
||||
new rerankerClass(
|
||||
{
|
||||
...options,
|
||||
title: options.name,
|
||||
},
|
||||
(url: string | URL, init: any) =>
|
||||
fetchwithRequestOptions(url, init, {
|
||||
...options.requestOptions,
|
||||
}),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
|
|
@ -387,7 +409,6 @@ async function configYamlToContinueConfig(
|
|||
|
||||
export async function loadContinueConfigFromYaml(
|
||||
ide: IDE,
|
||||
workspaceConfigs: string[],
|
||||
ideSettings: IdeSettings,
|
||||
ideInfo: IdeInfo,
|
||||
uniqueId: string,
|
||||
|
|
@ -397,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
|
||||
|
|
@ -407,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", {
|
||||
|
|
|
|||
|
|
@ -43,14 +43,16 @@ export class TransformersJsEmbeddingsProvider extends BaseLLM {
|
|||
static maxGroupSize: number = 1;
|
||||
static model: string = "all-MiniLM-L6-v2";
|
||||
static mockVector: number[] = Array.from({ length: 384 }).fill(2) as number[];
|
||||
static title: string = "Transformers.js (Built-In)";
|
||||
|
||||
static defaultOptions: Partial<LLMOptions> | undefined = {
|
||||
model: TransformersJsEmbeddingsProvider.model,
|
||||
};
|
||||
|
||||
constructor() {
|
||||
super({ model: TransformersJsEmbeddingsProvider.model });
|
||||
super({
|
||||
model: TransformersJsEmbeddingsProvider.model,
|
||||
title: "Transformers.js (Built-In)",
|
||||
});
|
||||
}
|
||||
|
||||
async embed(chunks: string[]) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
12
core/package-lock.json
generated
12
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",
|
||||
|
|
@ -100,7 +100,8 @@
|
|||
"myers-diff": "^2.1.0",
|
||||
"onnxruntime-common": "1.14.0",
|
||||
"onnxruntime-web": "1.14.0",
|
||||
"ts-jest": "^29.1.1"
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.11.0"
|
||||
|
|
@ -2973,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",
|
||||
|
|
@ -15449,7 +15450,6 @@
|
|||
"version": "5.7.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz",
|
||||
"integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
|
|
|
|||
|
|
@ -39,14 +39,15 @@
|
|||
"myers-diff": "^2.1.0",
|
||||
"onnxruntime-common": "1.14.0",
|
||||
"onnxruntime-web": "1.14.0",
|
||||
"ts-jest": "^29.1.1"
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-bedrock-runtime": "^3.758.0",
|
||||
"@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",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ pluginGroup=com.github.continuedev.continueintellijextension
|
|||
pluginName=continue-intellij-extension
|
||||
pluginRepositoryUrl=https://github.com/continuedev/continue
|
||||
# SemVer format -> https://semver.org
|
||||
pluginVersion=1.0.5
|
||||
pluginVersion=1.0.6
|
||||
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
|
||||
pluginSinceBuild=223
|
||||
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
|
||||
|
|
|
|||
11
extensions/vscode/package-lock.json
generated
11
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "1.1.14",
|
||||
"version": "1.1.15",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "1.1.14",
|
||||
"version": "1.1.15",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/fetch": "^1.0.3",
|
||||
|
|
@ -87,7 +87,7 @@
|
|||
"mocha": "^10.4.0",
|
||||
"ovsx": "^0.8.3",
|
||||
"rimraf": "^5.0.5",
|
||||
"typescript": "^5.3.3",
|
||||
"typescript": "^5.6.3",
|
||||
"vite": "^4.3.9",
|
||||
"vsce": "^2.15.0",
|
||||
"vscode-extension-tester": "^8.10.0"
|
||||
|
|
@ -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",
|
||||
|
|
@ -193,7 +193,8 @@
|
|||
"myers-diff": "^2.1.0",
|
||||
"onnxruntime-common": "1.14.0",
|
||||
"onnxruntime-web": "1.14.0",
|
||||
"ts-jest": "^29.1.1"
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.11.0"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -624,7 +624,7 @@
|
|||
"mocha": "^10.4.0",
|
||||
"ovsx": "^0.8.3",
|
||||
"rimraf": "^5.0.5",
|
||||
"typescript": "^5.3.3",
|
||||
"typescript": "^5.6.3",
|
||||
"vite": "^4.3.9",
|
||||
"vsce": "^2.15.0",
|
||||
"vscode-extension-tester": "^8.10.0"
|
||||
|
|
|
|||
|
|
@ -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<vscode.DocumentLink[]> {
|
||||
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<vscode.DocumentLink> {
|
||||
return link;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 });
|
||||
});
|
||||
|
|
|
|||
200
gui/package-lock.json
generated
200
gui/package-lock.json
generated
|
|
@ -7,8 +7,8 @@
|
|||
"name": "gui",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-yaml": "^1.0.63",
|
||||
"@headlessui/react": "^1.7.17",
|
||||
"@continuedev/config-yaml": "^1.0.67",
|
||||
"@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",
|
||||
|
|
@ -91,7 +93,7 @@
|
|||
"jsdom": "^25.0.1",
|
||||
"postcss": "^8.4.21",
|
||||
"tailwindcss": "^3.2.7",
|
||||
"typescript": "^4.9.3",
|
||||
"typescript": "^5.6.3",
|
||||
"typescript-eslint": "^8.16.0",
|
||||
"vite": "^4.1.0",
|
||||
"vitest": "^2.1.3"
|
||||
|
|
@ -109,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",
|
||||
|
|
@ -196,7 +198,8 @@
|
|||
"myers-diff": "^2.1.0",
|
||||
"onnxruntime-common": "1.14.0",
|
||||
"onnxruntime-web": "1.14.0",
|
||||
"ts-jest": "^29.1.1"
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.11.0"
|
||||
|
|
@ -551,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",
|
||||
|
|
@ -1098,25 +1101,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 +1733,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 +2322,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 +4394,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 +4406,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 +11530,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 +11550,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 +11876,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",
|
||||
|
|
@ -11833,16 +11979,16 @@
|
|||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.9.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
||||
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
||||
"version": "5.8.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz",
|
||||
"integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript-eslint": {
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@
|
|||
"test:watch": "vitest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@continuedev/config-yaml": "^1.0.63",
|
||||
"@headlessui/react": "^1.7.17",
|
||||
"@continuedev/config-yaml": "^1.0.67",
|
||||
"@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",
|
||||
|
|
@ -99,7 +101,7 @@
|
|||
"jsdom": "^25.0.1",
|
||||
"postcss": "^8.4.21",
|
||||
"tailwindcss": "^3.2.7",
|
||||
"typescript": "^4.9.3",
|
||||
"typescript": "^5.6.3",
|
||||
"typescript-eslint": "^8.16.0",
|
||||
"vite": "^4.1.0",
|
||||
"vitest": "^2.1.3"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
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";
|
||||
import {
|
||||
Listbox,
|
||||
ListboxButton,
|
||||
ListboxOption,
|
||||
ListboxOptions,
|
||||
} from "../ui/Listbox";
|
||||
|
||||
export interface AddFileButtonProps {
|
||||
onClick: () => void;
|
||||
|
|
@ -29,9 +34,9 @@ export default function AddFileButton({ onClick }: AddFileButtonProps) {
|
|||
return (
|
||||
<Listbox onChange={handleAddAllOpenFiles}>
|
||||
<div className="relative">
|
||||
<Listbox.Button
|
||||
<ListboxButton
|
||||
ref={buttonRef}
|
||||
className="bg-vsc-editor-background border-lightgray/50 flex h-5 cursor-pointer items-center justify-between rounded-md border border-solid px-0 shadow-sm transition-colors"
|
||||
className="bg-vsc-editor-background m-0 rounded-md p-0"
|
||||
>
|
||||
<div
|
||||
className="flex h-5 w-14 items-center justify-center gap-1 hover:brightness-125"
|
||||
|
|
@ -50,16 +55,11 @@ export default function AddFileButton({ onClick }: AddFileButtonProps) {
|
|||
<div className="border-lightgray/50 h-4 w-[1px] border-y-0 border-l-0 border-r border-solid" />
|
||||
|
||||
<ChevronDownIcon className="text-vsc-foreground h-2.5 w-2.5 cursor-pointer px-1 brightness-75 hover:brightness-125" />
|
||||
</Listbox.Button>
|
||||
</ListboxButton>
|
||||
|
||||
<Listbox.Options className="bg-vsc-editor-background border-lightgray/50 absolute right-0 top-full z-50 mt-1 min-w-fit whitespace-nowrap rounded-md border border-solid px-1 py-0 shadow-lg">
|
||||
<Listbox.Option
|
||||
value="addAllFiles"
|
||||
className="text-vsc-foreground block w-full cursor-pointer px-2 py-1 text-left text-[10px] brightness-75 hover:brightness-125"
|
||||
>
|
||||
Add all open files
|
||||
</Listbox.Option>
|
||||
</Listbox.Options>
|
||||
<ListboxOptions className="bg-vsc-editor-background" anchor="top end">
|
||||
<ListboxOption value="addAllFiles">Add all open files</ListboxOption>
|
||||
</ListboxOptions>
|
||||
</div>
|
||||
</Listbox>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
import { Combobox } from "@headlessui/react";
|
||||
import { ContextSubmenuItemWithProvider } from "core";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
Combobox,
|
||||
ComboboxButton,
|
||||
ComboboxInput,
|
||||
ComboboxOption,
|
||||
ComboboxOptions,
|
||||
} 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<void>;
|
||||
onEscape: () => void | Promise<void>;
|
||||
|
|
@ -54,8 +59,8 @@ export default function AddFileCombobox({
|
|||
>
|
||||
{({ open }) => (
|
||||
<div className="relative">
|
||||
<Combobox.Button className="hidden" ref={buttonRef} />
|
||||
<Combobox.Input
|
||||
<ComboboxButton className="hidden" ref={buttonRef} />
|
||||
<ComboboxInput
|
||||
ref={inputRef}
|
||||
onClick={() => {
|
||||
if (!open) {
|
||||
|
|
@ -65,7 +70,7 @@ export default function AddFileCombobox({
|
|||
onFocus={() => {
|
||||
buttonRef.current?.click();
|
||||
}}
|
||||
className="bg-vsc-background border-lightgray text-vsc-foreground box-border w-full rounded border border-solid py-0.5 pl-2 focus:outline-none"
|
||||
className="bg-vsc-background border-lightgray text-vsc-foreground box-border w-full rounded border border-solid py-0.5 pl-2 text-xs focus:outline-none"
|
||||
onChange={(event) => setQuery(event.target.value)}
|
||||
placeholder="Type to search files..."
|
||||
onKeyDown={(e) => {
|
||||
|
|
@ -75,10 +80,10 @@ export default function AddFileCombobox({
|
|||
}}
|
||||
/>
|
||||
|
||||
<Combobox.Options className="no-scrollbar bg-vsc-editor-background border-lightgray/50 absolute left-0 right-0 z-50 mt-1 max-h-60 overflow-y-auto overflow-x-hidden rounded-md border border-solid px-1 py-0 pl-0 pr-5 shadow-lg focus:outline-none">
|
||||
<ComboboxOptions className="no-scrollbar bg-vsc-editor-background border-lightgray/50 absolute left-0 right-0 z-50 mt-1 max-h-60 overflow-y-auto overflow-x-hidden rounded-md border border-solid px-1 py-0 pl-0 pr-5 shadow-lg focus:outline-none">
|
||||
{filteredFiles.length > 0 ? (
|
||||
filteredFiles.map((file) => (
|
||||
<Combobox.Option
|
||||
<ComboboxOption
|
||||
key={file.id}
|
||||
value={file}
|
||||
className={({ active }) =>
|
||||
|
|
@ -109,14 +114,14 @@ export default function AddFileCombobox({
|
|||
</span>
|
||||
</div>
|
||||
)}
|
||||
</Combobox.Option>
|
||||
</ComboboxOption>
|
||||
))
|
||||
) : (
|
||||
<div className="text-list-active-foreground px-2 py-1 text-xs">
|
||||
No results
|
||||
</div>
|
||||
)}
|
||||
</Combobox.Options>
|
||||
</ComboboxOptions>
|
||||
</div>
|
||||
)}
|
||||
</Combobox>
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<div
|
||||
className="mb-2 w-full shadow-md hover:cursor-pointer hover:brightness-110"
|
||||
style={{
|
||||
borderRadius: defaultBorderRadius,
|
||||
backgroundColor: vscInputBackground,
|
||||
}}
|
||||
onMouseEnter={() => 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)}
|
||||
>
|
||||
<div className="flex px-3 py-1.5">
|
||||
<div className="mr-3 flex-shrink-0 self-start pt-0.5">
|
||||
<ChatBubbleLeftIcon className="text-lightgray h-5 w-5" />
|
||||
</div>
|
||||
<div className="flex flex-1 flex-col">
|
||||
<div className="flex flex-1 flex-col justify-center">
|
||||
<div className="text-xs font-medium">{command.name}</div>
|
||||
<div className="text-lightgray text-xs">{command.description}</div>
|
||||
{command.description && (
|
||||
<div className="text-lightgray text-xs">{command.description}</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,24 @@
|
|||
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) {
|
||||
if (command.prompt) {
|
||||
|
|
@ -19,19 +28,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 (
|
||||
<div className="flex w-full max-w-full flex-col lg:grid lg:grid-cols-3 lg:gap-4">
|
||||
{cmdsSortedByBookmark.slice(0, NUM_CARDS_TO_RENDER).map((command, i) => (
|
||||
<ConversationStarterCard
|
||||
key={command.name + i}
|
||||
command={command}
|
||||
onClick={onClick}
|
||||
/>
|
||||
))}
|
||||
<div className="flex w-full max-w-full flex-col">
|
||||
<div className="lg:grid lg:grid-cols-3 lg:gap-4">
|
||||
{visibleCommands.map((command, i) => (
|
||||
<ConversationStarterCard
|
||||
key={command.name + i}
|
||||
command={command}
|
||||
onClick={onClick}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
{bookmarkedSlashCommands.length > NUM_CARDS_TO_RENDER && (
|
||||
<span
|
||||
className="text-lightgray mt-1 cursor-pointer text-xs hover:underline"
|
||||
onClick={() => setShowAll(!showAll)}
|
||||
>
|
||||
{showAll ? "Show less" : `Show ${remainingCount} more...`}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<string, boolean> = {};
|
||||
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,
|
||||
};
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<AuthProvider>
|
||||
<LayoutTopDiv>
|
||||
<OSRContextMenu />
|
||||
<div
|
||||
style={{
|
||||
scrollbarGutter: "stable both-edges",
|
||||
minHeight: "100%",
|
||||
display: "grid",
|
||||
gridTemplateRows: "1fr auto",
|
||||
}}
|
||||
>
|
||||
<TextDialog
|
||||
showDialog={showDialog}
|
||||
onEnter={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
<LocalStorageProvider>
|
||||
<AuthProvider>
|
||||
<LayoutTopDiv>
|
||||
<OSRContextMenu />
|
||||
<div
|
||||
style={{
|
||||
scrollbarGutter: "stable both-edges",
|
||||
minHeight: "100%",
|
||||
display: "grid",
|
||||
gridTemplateRows: "1fr auto",
|
||||
}}
|
||||
onClose={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
message={dialogMessage}
|
||||
/>
|
||||
>
|
||||
<TextDialog
|
||||
showDialog={showDialog}
|
||||
onEnter={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
onClose={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
message={dialogMessage}
|
||||
/>
|
||||
|
||||
<GridDiv className="">
|
||||
<PostHogPageView />
|
||||
<Outlet />
|
||||
<GridDiv className="">
|
||||
<PostHogPageView />
|
||||
<Outlet />
|
||||
|
||||
{hasFatalErrors && pathname !== ROUTES.CONFIG_ERROR && (
|
||||
<div
|
||||
className="z-50 cursor-pointer bg-red-600 p-4 text-center text-white"
|
||||
role="alert"
|
||||
onClick={() => navigate(ROUTES.CONFIG_ERROR)}
|
||||
>
|
||||
<strong className="font-bold">Error!</strong>{" "}
|
||||
<span className="block sm:inline">Could not load config</span>
|
||||
<div className="mt-2 underline">Learn More</div>
|
||||
</div>
|
||||
)}
|
||||
<Footer />
|
||||
</GridDiv>
|
||||
</div>
|
||||
<div style={{ fontSize: fontSize(-4) }} id="tooltip-portal-div" />
|
||||
</LayoutTopDiv>
|
||||
</AuthProvider>
|
||||
{hasFatalErrors && pathname !== ROUTES.CONFIG_ERROR && (
|
||||
<div
|
||||
className="z-50 cursor-pointer bg-red-600 p-4 text-center text-white"
|
||||
role="alert"
|
||||
onClick={() => navigate(ROUTES.CONFIG_ERROR)}
|
||||
>
|
||||
<strong className="font-bold">Error!</strong>{" "}
|
||||
<span className="block sm:inline">Could not load config</span>
|
||||
<div className="mt-2 underline">Learn More</div>
|
||||
</div>
|
||||
)}
|
||||
<Footer />
|
||||
</GridDiv>
|
||||
</div>
|
||||
<div style={{ fontSize: fontSize(-4) }} id="tooltip-portal-div" />
|
||||
</LayoutTopDiv>
|
||||
</AuthProvider>
|
||||
</LocalStorageProvider>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ export interface PageHeaderProps {
|
|||
showBorder?: boolean;
|
||||
}
|
||||
|
||||
export default function PageHeader({
|
||||
export function PageHeader({
|
||||
onTitleClick,
|
||||
title,
|
||||
rightContent,
|
||||
|
|
@ -22,27 +22,26 @@ export default function PageHeader({
|
|||
: ""
|
||||
}`}
|
||||
>
|
||||
<div className="flex w-full items-center justify-between pr-4">
|
||||
{title && (
|
||||
<>
|
||||
<div
|
||||
className="flex cursor-pointer items-center transition-colors duration-200 hover:text-zinc-100"
|
||||
onClick={onTitleClick}
|
||||
>
|
||||
<ArrowLeftIcon className="ml-3 inline-block h-3 w-3" />
|
||||
<span
|
||||
className="mx-2 inline-block text-base font-bold"
|
||||
style={{
|
||||
fontSize: fontSize(-2),
|
||||
}}
|
||||
>
|
||||
{title}
|
||||
</span>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className="ml-auto">{rightContent}</div>
|
||||
{title ? (
|
||||
<div
|
||||
className="flex cursor-pointer items-center transition-colors duration-200 hover:text-zinc-100"
|
||||
onClick={onTitleClick}
|
||||
>
|
||||
<ArrowLeftIcon className="ml-3 inline-block h-3 w-3" />
|
||||
<span
|
||||
className="mx-2 inline-block text-base font-bold"
|
||||
style={{
|
||||
fontSize: fontSize(-2),
|
||||
}}
|
||||
>
|
||||
{title}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
<div />
|
||||
)}
|
||||
|
||||
{rightContent && <div className="pr-2">{rightContent}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { ChatHistoryItem } from "core";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useAppSelector } from "../../redux/hooks";
|
||||
import { selectDefaultModel } from "../../redux/slices/configSlice";
|
||||
import { ChatHistoryItem } from "core";
|
||||
|
||||
interface ThinkingIndicatorProps {
|
||||
historyItem: ChatHistoryItem;
|
||||
|
|
@ -37,7 +37,7 @@ const ThinkingIndicator = ({ historyItem }: ThinkingIndicatorProps) => {
|
|||
|
||||
return (
|
||||
<div className="px-2 py-2">
|
||||
<span className="text-stone-500">{`Thinking.${".".repeat(animation)}`}</span>
|
||||
<span className="text-lightgray">{`Thinking.${".".repeat(animation)}`}</span>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
|
@ -153,13 +153,12 @@ export const SecondaryButton = styled.button`
|
|||
|
||||
export const GhostButton = styled.button`
|
||||
padding: 6px 8px;
|
||||
margin: 8px 0;
|
||||
margin: 6px 0;
|
||||
border-radius: ${defaultBorderRadius};
|
||||
|
||||
border: none;
|
||||
color: ${vscForeground};
|
||||
background-color: transparent;
|
||||
|
||||
background-color: rgba(255, 255, 255, 0.08);
|
||||
&:disabled {
|
||||
color: gray;
|
||||
pointer-events: none;
|
||||
|
|
@ -167,7 +166,7 @@ export const GhostButton = styled.button`
|
|||
|
||||
&:hover:enabled {
|
||||
cursor: pointer;
|
||||
background-color: rgba(255, 255, 255, 0.08); /* Subtle hover effect */
|
||||
filter: brightness(125%);
|
||||
}
|
||||
`;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ function ChatIndexingPeek({ state }: ChatIndexingPeekProps) {
|
|||
<div className="flex flex-row items-center border-0 border-t border-solid border-t-zinc-700 px-3 py-0.5">
|
||||
<div className="group flex flex-1 cursor-pointer flex-row items-center gap-2">
|
||||
<div className={`flex flex-row items-center gap-2`}>
|
||||
<p className="m-0 p-0 text-xs text-stone-500 group-hover:underline">
|
||||
<p className="text-lightgray m-0 p-0 text-xs group-hover:underline">
|
||||
{state.displayName}
|
||||
</p>
|
||||
</div>
|
||||
|
|
@ -47,17 +47,17 @@ function ChatIndexingPeek({ state }: ChatIndexingPeekProps) {
|
|||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="xs:flex hidden flex-row items-center gap-1 text-stone-500">
|
||||
<div className="xs:flex text-lightgray hidden flex-row items-center gap-1">
|
||||
<span className="text-xs no-underline">
|
||||
{state.progressPercentage.toFixed(0)}%
|
||||
</span>
|
||||
<ArrowPathIcon
|
||||
className={`animate-spin-slow inline-block h-4 w-4 text-stone-500`}
|
||||
className={`animate-spin-slow text-lightgray inline-block h-4 w-4`}
|
||||
></ArrowPathIcon>
|
||||
</div>
|
||||
</div>
|
||||
<EyeSlashIcon
|
||||
className="ml-6 h-4 w-4 cursor-pointer text-stone-500 hover:opacity-80"
|
||||
className="text-lightgray ml-6 h-4 w-4 cursor-pointer hover:opacity-80"
|
||||
onClick={(e) => {
|
||||
dispatch(
|
||||
setIndexingChatPeekHidden({ type: state.type, hidden: true }),
|
||||
|
|
|
|||
|
|
@ -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" &&
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
vscButtonBackground,
|
||||
vscButtonForeground,
|
||||
vscForeground,
|
||||
vscInputBackground,
|
||||
} from "..";
|
||||
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
|
||||
import { selectUseActiveFile } from "../../redux/selectors";
|
||||
|
|
@ -21,34 +20,16 @@ import {
|
|||
import { exitEditMode } from "../../redux/thunks";
|
||||
import { loadLastSession } from "../../redux/thunks/session";
|
||||
import {
|
||||
fontSize,
|
||||
getAltKeyLabel,
|
||||
getFontSize,
|
||||
getMetaKeyLabel,
|
||||
isMetaEquivalentKeyPressed,
|
||||
} from "../../util";
|
||||
import { ToolTip } from "../gui/Tooltip";
|
||||
import ModelSelect from "../modelSelection/ModelSelect";
|
||||
import ModeSelect from "../modelSelection/ModeSelect";
|
||||
import { useFontSize } from "../ui/font";
|
||||
import HoverItem from "./InputToolbar/bottom/HoverItem";
|
||||
|
||||
const StyledDiv = styled.div<{ isHidden?: boolean }>`
|
||||
padding-top: 4px;
|
||||
justify-content: space-between;
|
||||
gap: 1px;
|
||||
background-color: ${vscInputBackground};
|
||||
align-items: center;
|
||||
font-size: ${getFontSize() - 2}px;
|
||||
cursor: ${(props) => (props.isHidden ? "default" : "text")};
|
||||
opacity: ${(props) => (props.isHidden ? 0 : 1)};
|
||||
pointer-events: ${(props) => (props.isHidden ? "none" : "auto")};
|
||||
user-select: none;
|
||||
|
||||
& > * {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
`;
|
||||
|
||||
const EnterButton = styled.button<{ isPrimary?: boolean }>`
|
||||
all: unset;
|
||||
padding: 2px 4px;
|
||||
|
|
@ -107,14 +88,19 @@ function InputToolbar(props: InputToolbarProps) {
|
|||
defaultModel.capabilities,
|
||||
);
|
||||
|
||||
const smallFont = useFontSize(-2);
|
||||
const tinyFont = useFontSize(-3);
|
||||
|
||||
return (
|
||||
<>
|
||||
<StyledDiv
|
||||
isHidden={props.hidden}
|
||||
<div
|
||||
onClick={props.onClick}
|
||||
className="find-widget-skip flex"
|
||||
className={`find-widget-skip bg-vsc-input-background flex select-none flex-row items-center justify-between gap-1 pt-1 ${props.hidden ? "pointer-events-none cursor-default opacity-0" : "pointer-events-auto cursor-text opacity-100"}`}
|
||||
style={{
|
||||
fontSize: smallFont,
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center justify-start gap-2 whitespace-nowrap">
|
||||
<div className="xs:gap-1.5 flex flex-row items-center gap-1">
|
||||
<ModeSelect />
|
||||
<ModelSelect />
|
||||
<div className="xs:flex -mb-1 hidden items-center text-gray-400 transition-colors duration-200">
|
||||
|
|
@ -165,7 +151,7 @@ function InputToolbar(props: InputToolbarProps) {
|
|||
<div
|
||||
className="flex items-center gap-2 whitespace-nowrap text-gray-400"
|
||||
style={{
|
||||
fontSize: fontSize(-3),
|
||||
fontSize: tinyFont,
|
||||
}}
|
||||
>
|
||||
{!props.toolbarOptions?.hideUseCodebase && !isInEditMode && (
|
||||
|
|
@ -235,7 +221,7 @@ function InputToolbar(props: InputToolbarProps) {
|
|||
<span className="md:hidden">⏎</span>
|
||||
</EnterButton>
|
||||
</div>
|
||||
</StyledDiv>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
import { Transition } from "@headlessui/react";
|
||||
|
||||
export default function PopoverTransition({
|
||||
children,
|
||||
show,
|
||||
afterLeave,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
show?: boolean;
|
||||
afterLeave?: () => void;
|
||||
}) {
|
||||
return (
|
||||
<Transition
|
||||
show={show}
|
||||
enter="transition duration-100 ease-out"
|
||||
enterFrom="transform scale-95 opacity-0"
|
||||
enterTo="transform scale-100 opacity-100"
|
||||
leave="transition duration-75 ease-out"
|
||||
leaveFrom="transform scale-100 opacity-100"
|
||||
leaveTo="transform scale-95 opacity-0"
|
||||
afterLeave={afterLeave}
|
||||
>
|
||||
{children}
|
||||
</Transition>
|
||||
);
|
||||
}
|
||||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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 || ""}`}
|
||||
>
|
||||
<props.icon
|
||||
className="h-3 w-3 hover:brightness-125"
|
||||
|
|
@ -101,6 +102,7 @@ export function BlockSettingsTopToolbar(props: BlockSettingsTopToolbarProps) {
|
|||
<div className="flex w-full items-center justify-between">
|
||||
<div className="xs:flex hidden items-center justify-center text-gray-400">
|
||||
<BlockSettingsToolbarIcon
|
||||
className="-ml-1.5"
|
||||
icon={isExpanded ? ChevronLeftIcon : EllipsisHorizontalIcon}
|
||||
tooltip={isExpanded ? "Collapse sections" : "Expand sections"}
|
||||
isSelected={false}
|
||||
|
|
|
|||
52
gui/src/components/mainInput/Lump/EditBlockButton.tsx
Normal file
52
gui/src/components/mainInput/Lump/EditBlockButton.tsx
Normal file
|
|
@ -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<keyof ConfigYaml, "name" | "version" | "schema">;
|
||||
|
||||
interface EditBlockButtonProps<T extends SectionKey> {
|
||||
blockType: T;
|
||||
block?: NonNullable<ConfigYaml[T]>[number];
|
||||
className?: string;
|
||||
}
|
||||
|
||||
function isUsesBlock(block: any): block is { uses: string } {
|
||||
return typeof block !== "string" && "uses" in block;
|
||||
}
|
||||
|
||||
export default function EditBlockButton<T extends SectionKey>({
|
||||
block,
|
||||
blockType,
|
||||
className = "",
|
||||
}: EditBlockButtonProps<T>) {
|
||||
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 (
|
||||
<PencilIcon
|
||||
className={`h-3 w-3 cursor-pointer text-gray-400 hover:brightness-125 ${className}`}
|
||||
onClick={handleEdit}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import {
|
|||
vscCommandCenterInactiveBorder,
|
||||
vscInputBackground,
|
||||
} from "../..";
|
||||
import { useAppSelector } from "../../../redux/hooks";
|
||||
import { LumpToolbar } from "./LumpToolbar";
|
||||
import { SelectedSection } from "./sections/SelectedSection";
|
||||
|
||||
|
|
@ -39,6 +40,7 @@ export function Lump(props: LumpProps) {
|
|||
const [selectedSection, setSelectedSection] = useState<string | null>(null);
|
||||
const [displayedSection, setDisplayedSection] = useState<string | null>(null);
|
||||
const [isVisible, setIsVisible] = useState(false);
|
||||
const isStreaming = useAppSelector((state) => state.session.isStreaming);
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedSection) {
|
||||
|
|
@ -66,8 +68,14 @@ export function Lump(props: LumpProps) {
|
|||
setSelectedSection={setSelectedSection}
|
||||
/>
|
||||
|
||||
<ContentDiv hasSection={!!selectedSection} isVisible={isVisible}>
|
||||
<SelectedSection selectedSection={displayedSection} />
|
||||
<ContentDiv
|
||||
className="thin-scrollbar pr-0.5"
|
||||
hasSection={!!selectedSection}
|
||||
isVisible={isVisible}
|
||||
>
|
||||
{!isStreaming && (
|
||||
<SelectedSection selectedSection={displayedSection} />
|
||||
)}
|
||||
</ContentDiv>
|
||||
</div>
|
||||
</LumpDiv>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
import { PlusIcon } from "@heroicons/react/24/outline";
|
||||
import {
|
||||
ArrowTopRightOnSquareIcon,
|
||||
PlusIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useContext } from "react";
|
||||
import { GhostButton } from "../../..";
|
||||
import { useAuth } from "../../../../context/Auth";
|
||||
import { IdeMessengerContext } from "../../../../context/IdeMessenger";
|
||||
import { useAppDispatch } from "../../../../redux/hooks";
|
||||
|
|
@ -10,13 +14,22 @@ import {
|
|||
import { fontSize } from "../../../../util";
|
||||
import AddDocsDialog from "../../../dialogs/AddDocsDialog";
|
||||
|
||||
export function AddBlockButton(props: { blockType: string }) {
|
||||
export function ExploreBlocksButton(props: { blockType: string }) {
|
||||
const { selectedProfile } = useAuth();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const isLocal = selectedProfile?.profileType === "local";
|
||||
|
||||
const Icon = isLocal ? PlusIcon : ArrowTopRightOnSquareIcon;
|
||||
const text = `${isLocal ? "Add" : "Explore"} ${
|
||||
props.blockType === "mcpServers"
|
||||
? "MCP Servers"
|
||||
: props.blockType.charAt(0).toUpperCase() + props.blockType.slice(1)
|
||||
}`;
|
||||
|
||||
const handleClick = () => {
|
||||
if (selectedProfile?.profileType === "local") {
|
||||
if (isLocal) {
|
||||
switch (props.blockType) {
|
||||
case "docs":
|
||||
dispatch(setShowDialog(true));
|
||||
|
|
@ -36,8 +49,8 @@ export function AddBlockButton(props: { blockType: string }) {
|
|||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className="cursor-pointer rounded px-2 pb-1 text-center text-gray-400 hover:text-gray-300"
|
||||
<GhostButton
|
||||
className="w-full cursor-pointer rounded px-2 text-center text-gray-400 hover:text-gray-300"
|
||||
style={{
|
||||
fontSize: fontSize(-3),
|
||||
}}
|
||||
|
|
@ -47,8 +60,8 @@ export function AddBlockButton(props: { blockType: string }) {
|
|||
}}
|
||||
>
|
||||
<div className="flex items-center justify-center gap-1">
|
||||
<PlusIcon className="h-3 w-3" /> Add
|
||||
<Icon className="h-3 w-3" /> {text}
|
||||
</div>
|
||||
</div>
|
||||
</GhostButton>
|
||||
);
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ import {
|
|||
updateConfig,
|
||||
} from "../../../../redux/slices/configSlice";
|
||||
import { isJetBrains } from "../../../../util";
|
||||
import { ExploreBlocksButton } from "./ExploreBlocksButton";
|
||||
|
||||
export function ModelsSection() {
|
||||
const { selectedProfile } = useAuth();
|
||||
|
|
@ -51,60 +52,63 @@ export function ModelsSection() {
|
|||
}
|
||||
|
||||
return (
|
||||
<div className="text-[${getFontSize() - 1}px] grid grid-cols-1 gap-x-2 gap-y-1 sm:grid-cols-[auto_1fr]">
|
||||
<ModelRoleSelector
|
||||
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)}
|
||||
/>
|
||||
<ModelRoleSelector
|
||||
displayName="Autocomplete"
|
||||
description="Used to generate code completion suggestions"
|
||||
models={config.modelsByRole.autocomplete}
|
||||
selectedModel={config.selectedModelByRole.autocomplete}
|
||||
onSelect={(model) => handleRoleUpdate("autocomplete", model)}
|
||||
/>
|
||||
{/* Jetbrains has a model selector inline */}
|
||||
{!jetbrains && (
|
||||
<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="Edit"
|
||||
description="Used for inline edits"
|
||||
models={config.modelsByRole.edit}
|
||||
selectedModel={config.selectedModelByRole.edit}
|
||||
onSelect={(model) => 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)}
|
||||
/>
|
||||
)}
|
||||
<ModelRoleSelector
|
||||
displayName="Apply"
|
||||
description="Used to apply generated codeblocks to files"
|
||||
models={config.modelsByRole.apply}
|
||||
selectedModel={config.selectedModelByRole.apply}
|
||||
onSelect={(model) => handleRoleUpdate("apply", model)}
|
||||
/>
|
||||
<ModelRoleSelector
|
||||
displayName="Embed"
|
||||
description="Used to generate and query embeddings for the @codebase and @docs context providers"
|
||||
models={config.modelsByRole.embed}
|
||||
selectedModel={config.selectedModelByRole.embed}
|
||||
onSelect={(model) => handleRoleUpdate("embed", model)}
|
||||
/>
|
||||
<ModelRoleSelector
|
||||
displayName="Rerank"
|
||||
description="Used for reranking results from the @codebase and @docs context providers"
|
||||
models={config.modelsByRole.rerank}
|
||||
selectedModel={config.selectedModelByRole.rerank}
|
||||
onSelect={(model) => handleRoleUpdate("rerank", model)}
|
||||
/>
|
||||
<ModelRoleSelector
|
||||
displayName="Autocomplete"
|
||||
description="Used to generate code completion suggestions"
|
||||
models={config.modelsByRole.autocomplete}
|
||||
selectedModel={config.selectedModelByRole.autocomplete}
|
||||
onSelect={(model) => handleRoleUpdate("autocomplete", model)}
|
||||
/>
|
||||
{/* Jetbrains has a model selector inline */}
|
||||
{!jetbrains && (
|
||||
<ModelRoleSelector
|
||||
displayName="Edit"
|
||||
description="Used for inline edits"
|
||||
models={config.modelsByRole.edit}
|
||||
selectedModel={config.selectedModelByRole.edit}
|
||||
onSelect={(model) => handleRoleUpdate("edit", model)}
|
||||
/>
|
||||
)}
|
||||
<ModelRoleSelector
|
||||
displayName="Apply"
|
||||
description="Used to apply generated codeblocks to files"
|
||||
models={config.modelsByRole.apply}
|
||||
selectedModel={config.selectedModelByRole.apply}
|
||||
onSelect={(model) => handleRoleUpdate("apply", model)}
|
||||
/>
|
||||
<ModelRoleSelector
|
||||
displayName="Embed"
|
||||
description="Used to generate and query embeddings for the @codebase and @docs context providers"
|
||||
models={config.modelsByRole.embed}
|
||||
selectedModel={config.selectedModelByRole.embed}
|
||||
onSelect={(model) => handleRoleUpdate("embed", model)}
|
||||
/>
|
||||
<ModelRoleSelector
|
||||
displayName="Rerank"
|
||||
description="Used for reranking results from the @codebase and @docs context providers"
|
||||
models={config.modelsByRole.rerank}
|
||||
selectedModel={config.selectedModelByRole.rerank}
|
||||
onSelect={(model) => handleRoleUpdate("rerank", model)}
|
||||
/>
|
||||
</div>
|
||||
<ExploreBlocksButton blockType={"models"} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@ 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";
|
||||
import { ExploreBlocksButton } from "./ExploreBlocksButton";
|
||||
|
||||
interface PromptRowProps {
|
||||
command: string;
|
||||
|
|
@ -24,7 +25,7 @@ function PromptRow({
|
|||
}: PromptRowProps) {
|
||||
return (
|
||||
<div
|
||||
className="flex items-center justify-between"
|
||||
className="flex items-center justify-between gap-3"
|
||||
style={{
|
||||
fontSize: fontSize(-3),
|
||||
}}
|
||||
|
|
@ -40,7 +41,7 @@ function PromptRow({
|
|||
/>
|
||||
<div
|
||||
onClick={() => setIsBookmarked(!isBookmarked)}
|
||||
className="cursor-pointer pt-0.5 text-gray-400"
|
||||
className="cursor-pointer pt-0.5 text-gray-400 hover:brightness-125"
|
||||
>
|
||||
{isBookmarked ? (
|
||||
<BookmarkSolid className="h-3 w-3" />
|
||||
|
|
@ -54,27 +55,37 @@ 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 (
|
||||
<div className="flex flex-col gap-1">
|
||||
{cmdsSortedByBookmark?.map((prompt, i) => (
|
||||
{sortedCommands.map((prompt) => (
|
||||
<PromptRow
|
||||
key={prompt.name}
|
||||
command={prompt.name}
|
||||
description={prompt.description}
|
||||
isBookmarked={bookmarkStatuses[prompt.name]}
|
||||
isBookmarked={isCommandBookmarked(prompt.name)}
|
||||
setIsBookmarked={() => toggleBookmark(prompt)}
|
||||
onEdit={() => handleEdit(prompt)}
|
||||
/>
|
||||
))}
|
||||
<AddBlockButton blockType="prompts" />
|
||||
<ExploreBlocksButton blockType="prompts" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,19 @@
|
|||
import { parseConfigYaml } from "@continuedev/config-yaml";
|
||||
import { PencilIcon } from "@heroicons/react/24/outline";
|
||||
import { ArrowsPointingOutIcon, PencilIcon } from "@heroicons/react/24/outline";
|
||||
import { useContext, useMemo } from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
import { defaultBorderRadius, vscCommandCenterActiveBorder } from "../../..";
|
||||
import { useAuth } from "../../../../context/Auth";
|
||||
import { IdeMessengerContext } from "../../../../context/IdeMessenger";
|
||||
import { useAppDispatch } from "../../../../redux/hooks";
|
||||
import {
|
||||
setDialogMessage,
|
||||
setShowDialog,
|
||||
} from "../../../../redux/slices/uiSlice";
|
||||
import { RootState } from "../../../../redux/store";
|
||||
import { fontSize } from "../../../../util";
|
||||
import HeaderButtonWithToolTip from "../../../gui/HeaderButtonWithToolTip";
|
||||
import { AddBlockButton } from "./AddBlockButton";
|
||||
import { ExploreBlocksButton } from "./ExploreBlocksButton";
|
||||
|
||||
interface RuleCardProps {
|
||||
index: number;
|
||||
|
|
@ -18,12 +23,19 @@ interface RuleCardProps {
|
|||
}
|
||||
|
||||
const RuleCard: React.FC<RuleCardProps> = ({ index, rule, onClick, title }) => {
|
||||
const truncateRule = (rule: string) => {
|
||||
const maxLength = 75;
|
||||
return rule.length > maxLength
|
||||
? `${rule.substring(0, maxLength)}...`
|
||||
: rule;
|
||||
};
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
function onClickExpand() {
|
||||
dispatch(setShowDialog(true));
|
||||
dispatch(
|
||||
setDialogMessage(
|
||||
<div className="p-4 text-center">
|
||||
<h3>{title}</h3>
|
||||
<pre className="max-w-full overflow-x-scroll">{rule}</pre>
|
||||
</div>,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
|
|
@ -33,29 +45,35 @@ const RuleCard: React.FC<RuleCardProps> = ({ index, rule, onClick, title }) => {
|
|||
}}
|
||||
className="px-2 py-1 transition-colors"
|
||||
>
|
||||
<div className="flex items-start justify-between">
|
||||
<div className="flex-1">
|
||||
<div
|
||||
className="text-vsc-foreground mb-1"
|
||||
style={{
|
||||
fontSize: fontSize(-2),
|
||||
}}
|
||||
>
|
||||
{title}
|
||||
<div className="flex flex-col gap-2">
|
||||
<div className="flex items-start justify-between">
|
||||
<div className="flex-1">
|
||||
<div
|
||||
className="text-vsc-foreground mb-1"
|
||||
style={{
|
||||
fontSize: fontSize(-2),
|
||||
}}
|
||||
>
|
||||
{title}
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
fontSize: fontSize(-3),
|
||||
}}
|
||||
className="line-clamp-3 text-gray-400"
|
||||
>
|
||||
{rule}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
fontSize: fontSize(-3),
|
||||
whiteSpace: "pre-line",
|
||||
}}
|
||||
className="text-gray-400"
|
||||
>
|
||||
{truncateRule(rule)}
|
||||
<div className="flex items-center gap-2">
|
||||
<HeaderButtonWithToolTip onClick={onClickExpand} text="Expand">
|
||||
<ArrowsPointingOutIcon className="h-3 w-3 text-gray-400" />
|
||||
</HeaderButtonWithToolTip>{" "}
|
||||
<HeaderButtonWithToolTip onClick={onClick} text="Edit">
|
||||
<PencilIcon className="h-3 w-3 text-gray-400" />
|
||||
</HeaderButtonWithToolTip>
|
||||
</div>
|
||||
</div>
|
||||
<HeaderButtonWithToolTip onClick={onClick} text="Edit">
|
||||
<PencilIcon className="h-3 w-3 text-gray-400" />
|
||||
</HeaderButtonWithToolTip>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
@ -86,63 +104,60 @@ export function RulesSection() {
|
|||
});
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
{mergedRules.length === 0 ? (
|
||||
<div className="rounded-lg bg-[#1e1e1e] p-6">
|
||||
<p className="italic text-gray-400">No rules defined yet</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
{mergedRules.map((rule, index) => {
|
||||
if (!rule.ruleFromYaml) {
|
||||
return (
|
||||
<RuleCard
|
||||
key={index}
|
||||
index={index}
|
||||
rule={rule.unrolledRule}
|
||||
onClick={() =>
|
||||
ideMessenger.post("config/openProfile", {
|
||||
profileId: undefined,
|
||||
})
|
||||
}
|
||||
title="Locally Defined Rule"
|
||||
/>
|
||||
);
|
||||
}
|
||||
<div>
|
||||
<div className="space-y-3">
|
||||
{mergedRules.map((rule, index) => {
|
||||
if (!rule.ruleFromYaml) {
|
||||
return (
|
||||
<RuleCard
|
||||
key={index}
|
||||
index={index}
|
||||
rule={rule.unrolledRule}
|
||||
onClick={() =>
|
||||
ideMessenger.post("config/openProfile", {
|
||||
profileId: undefined,
|
||||
})
|
||||
}
|
||||
title="Locally Defined Rule"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof rule.ruleFromYaml === "string") {
|
||||
const slug = `${selectedProfile?.fullSlug.ownerSlug}/${selectedProfile?.fullSlug.packageSlug}`;
|
||||
|
||||
return (
|
||||
<RuleCard
|
||||
key={index}
|
||||
index={index}
|
||||
rule={rule.unrolledRule}
|
||||
onClick={() => 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 (
|
||||
<RuleCard
|
||||
key={index}
|
||||
index={index}
|
||||
rule={rule.unrolledRule}
|
||||
onClick={() => openUrl(`${ruleSlug}/new-version`)}
|
||||
title={ruleSlug}
|
||||
onClick={() => openUrl(`${slug}/new-version`)}
|
||||
title="Inline Rule"
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
<AddBlockButton blockType="rules" />
|
||||
}
|
||||
|
||||
if (!rule.ruleFromYaml?.uses) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const ruleSlug = rule.ruleFromYaml?.uses;
|
||||
|
||||
return (
|
||||
<RuleCard
|
||||
key={index}
|
||||
index={index}
|
||||
rule={rule.unrolledRule}
|
||||
onClick={() => openUrl(`${ruleSlug}/new-version`)}
|
||||
title={ruleSlug}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<ExploreBlocksButton blockType="rules" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
function useTypedDispatch() {
|
||||
throw new Error("Function not implemented.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,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>
|
||||
|
|
@ -144,7 +144,7 @@ function DocsDetailsDialog({ startUrl }: DocsDetailsDialogProps) {
|
|||
<div className="px-2 py-4 sm:px-4">
|
||||
<h3>Docs index</h3>
|
||||
<p
|
||||
className="m-0 mt-1 cursor-pointer p-0 text-stone-500 hover:underline"
|
||||
className="text-lightgray m-0 mt-1 cursor-pointer p-0 hover:underline"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
ideMessenger.post("openUrl", startUrl);
|
||||
|
|
|
|||
|
|
@ -21,14 +21,14 @@ function DocsIndexingPeek({ status }: DocsIndexingPeekProps) {
|
|||
|
||||
return (
|
||||
<div
|
||||
className="flex cursor-pointer flex-row items-center gap-2 rounded-md px-1 text-stone-500 hover:bg-gray-700/10"
|
||||
className="text-lightgray flex cursor-pointer flex-row items-center gap-2 rounded-md px-1 hover:bg-gray-700/10"
|
||||
onClick={() => {
|
||||
// navigate("/more"); TODO
|
||||
dispatch(setShowDialog(false));
|
||||
dispatch(setDialogMessage(undefined));
|
||||
}}
|
||||
>
|
||||
<p className="m-0 p-0 text-stone-500 group-hover:underline">
|
||||
<p className="text-lightgray m-0 p-0 group-hover:underline">
|
||||
{status.title}
|
||||
</p>
|
||||
<div className="my-2 h-1.5 flex-1 rounded-md border border-solid border-gray-400">
|
||||
|
|
@ -39,12 +39,12 @@ function DocsIndexingPeek({ status }: DocsIndexingPeekProps) {
|
|||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="xs:flex hidden flex-row items-center gap-1 text-stone-500">
|
||||
<div className="xs:flex text-lightgray hidden flex-row items-center gap-1">
|
||||
<span className="text-xs no-underline">
|
||||
{progressPercentage.toFixed(0)}%
|
||||
</span>
|
||||
{/* <ArrowPathIcon
|
||||
className={`animate-spin-slow inline-block h-4 w-4 text-stone-500`}
|
||||
className={`animate-spin-slow inline-block h-4 w-4 text-lightgray`}
|
||||
></ArrowPathIcon> */}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,7 @@
|
|||
import { ConfigYaml } from "@continuedev/config-yaml";
|
||||
import {
|
||||
ArrowPathIcon,
|
||||
ArrowTopRightOnSquareIcon,
|
||||
PencilIcon,
|
||||
StopIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { ArrowPathIcon, 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 +11,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<ConfigYaml["docs"]>[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 +68,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;
|
||||
|
|
@ -136,11 +107,10 @@ 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>
|
||||
<ArrowTopRightOnSquareIcon className="h-2 w-2 text-gray-400" />
|
||||
</div>
|
||||
|
||||
<div className="flex flex-row items-center gap-2">
|
||||
|
|
@ -163,6 +133,8 @@ function DocsIndexingStatus({
|
|||
/>
|
||||
)}
|
||||
|
||||
<EditBlockButton blockType="docs" block={docFromYaml} />
|
||||
|
||||
{["aborted", "complete", "failed"].includes(
|
||||
status?.status ?? "",
|
||||
) && (
|
||||
|
|
@ -172,11 +144,6 @@ function DocsIndexingStatus({
|
|||
/>
|
||||
)}
|
||||
|
||||
<PencilIcon
|
||||
className="h-3 w-3 cursor-pointer text-gray-400 hover:brightness-125"
|
||||
onClick={handleEdit}
|
||||
/>
|
||||
|
||||
{/* Removed StatusIndicator from here */}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { useMemo } from "react";
|
|||
import { useDispatch } from "react-redux";
|
||||
import { useAuth } from "../../../../../context/Auth";
|
||||
import { useAppSelector } from "../../../../../redux/hooks";
|
||||
import { AddBlockButton } from "../AddBlockButton";
|
||||
import { ExploreBlocksButton } from "../ExploreBlocksButton";
|
||||
import DocsIndexingStatus from "./DocsIndexingStatus";
|
||||
|
||||
function DocsIndexingStatuses() {
|
||||
|
|
@ -70,7 +70,7 @@ function DocsIndexingStatuses() {
|
|||
);
|
||||
})}
|
||||
</div>
|
||||
<AddBlockButton blockType="docs" />
|
||||
<ExploreBlocksButton blockType="docs" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,9 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
}, [editor, props.placeholder, historyLength]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isInEditMode) {
|
||||
setShouldHideToolbar(false);
|
||||
}
|
||||
if (props.isMainInput) {
|
||||
editor?.commands.clearContent(true);
|
||||
}
|
||||
|
|
@ -155,14 +158,19 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
|
||||
const handleBlur = (e: React.FocusEvent) => {
|
||||
// Check if the new focus target is within our InputBoxDiv
|
||||
const currentTarget = e.currentTarget;
|
||||
const relatedTarget = e.relatedTarget as Node | null;
|
||||
queueMicrotask(() => {
|
||||
if (isInEditMode) {
|
||||
return;
|
||||
}
|
||||
const currentTarget = e.currentTarget;
|
||||
const relatedTarget = e.relatedTarget as Node | null;
|
||||
|
||||
if (relatedTarget && currentTarget.contains(relatedTarget)) {
|
||||
return;
|
||||
}
|
||||
if (relatedTarget && currentTarget.contains(relatedTarget)) {
|
||||
return;
|
||||
}
|
||||
|
||||
setShouldHideToolbar(true);
|
||||
setShouldHideToolbar(true);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
// A dropdown menu for selecting between Chat, Edit, and Agent modes with keyboard shortcuts
|
||||
import { Listbox } from "@headlessui/react";
|
||||
import {
|
||||
ChatBubbleLeftIcon,
|
||||
CheckIcon,
|
||||
|
|
@ -9,9 +8,9 @@ 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 { lightGray } from "..";
|
||||
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
|
||||
import { selectDefaultModel } from "../../redux/slices/configSlice";
|
||||
import {
|
||||
|
|
@ -19,56 +18,18 @@ import {
|
|||
selectCurrentMode,
|
||||
setMode,
|
||||
} from "../../redux/slices/sessionSlice";
|
||||
import { exitEditMode } from "../../redux/thunks";
|
||||
import {
|
||||
fontSize,
|
||||
getFontSize,
|
||||
getMetaKeyLabel,
|
||||
isJetBrains,
|
||||
} from "../../util";
|
||||
|
||||
const StyledListboxButton = styled(Listbox.Button)`
|
||||
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(Listbox.Options)`
|
||||
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 StyledListboxOption = styled(Listbox.Option)`
|
||||
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`};
|
||||
}
|
||||
`;
|
||||
loadLastSession,
|
||||
saveCurrentSession,
|
||||
} from "../../redux/thunks/session";
|
||||
import { getFontSize, getMetaKeyLabel, isJetBrains } from "../../util";
|
||||
import {
|
||||
Listbox,
|
||||
ListboxButton,
|
||||
ListboxOption,
|
||||
ListboxOptions,
|
||||
} from "../ui/Listbox";
|
||||
|
||||
const ShortcutText = styled.span`
|
||||
color: ${lightGray};
|
||||
|
|
@ -81,16 +42,22 @@ 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) {
|
||||
case "agent":
|
||||
return <SparklesIcon className="h-3 w-3" />;
|
||||
return <SparklesIcon className="xs:h-3 xs:w-3 h-3 w-3" />;
|
||||
case "chat":
|
||||
return <ChatBubbleLeftIcon className="h-3 w-3" />;
|
||||
return <ChatBubbleLeftIcon className="xs:h-3 xs:w-3 h-3 w-3" />;
|
||||
case "edit":
|
||||
return <PencilIcon className="h-3 w-3" />;
|
||||
return <PencilIcon className="xs:h-3 xs:w-3 h-3 w-3" />;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -116,65 +83,80 @@ function ModeSelect() {
|
|||
return (
|
||||
<Listbox
|
||||
value={mode}
|
||||
onChange={(newMode) => {
|
||||
onChange={async (newMode) => {
|
||||
if (newMode === mode) {
|
||||
return;
|
||||
}
|
||||
dispatch(setMode(newMode));
|
||||
if (newMode === "edit") {
|
||||
await dispatch(
|
||||
saveCurrentSession({
|
||||
generateTitle: false,
|
||||
openNewSession: true,
|
||||
}),
|
||||
);
|
||||
} else if (mode === "edit") {
|
||||
await dispatch(
|
||||
loadLastSession({
|
||||
saveCurrentSession: false,
|
||||
}),
|
||||
);
|
||||
dispatch(exitEditMode());
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div className="relative">
|
||||
<StyledListboxButton
|
||||
<ListboxButton
|
||||
data-testid="mode-select-button"
|
||||
className="h-[18px] overflow-hidden"
|
||||
style={{ padding: 0, fontSize: fontSize(-3) }}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
backgroundColor: `${lightGray}33`,
|
||||
}}
|
||||
className="flex items-center gap-1 rounded-full px-2 py-0.5 text-gray-400 transition-colors duration-200"
|
||||
>
|
||||
{getModeIcon(mode)}
|
||||
<span>{mode.charAt(0).toUpperCase() + mode.slice(1)}</span>
|
||||
<ChevronDownIcon
|
||||
className="h-2 w-2 flex-shrink-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</div>
|
||||
</StyledListboxButton>
|
||||
<StyledListboxOptions
|
||||
className="z-50"
|
||||
className="gap-1 border-none px-2 py-0.5 text-gray-400 transition-colors duration-200"
|
||||
style={{
|
||||
fontSize: fontSize(-3),
|
||||
backgroundColor: `${lightGray}33`,
|
||||
borderRadius: "9999px",
|
||||
}}
|
||||
>
|
||||
<StyledListboxOption value="agent" disabled={!agentModeSupported}>
|
||||
<SparklesIcon className="h-3 w-3" />
|
||||
<span className="font-semibold">Agent</span>
|
||||
{/* <ShortcutText></ShortcutText> */}
|
||||
{getModeIcon(mode)}
|
||||
<span className="hidden sm:block">
|
||||
{mode.charAt(0).toUpperCase() + mode.slice(1)}
|
||||
</span>
|
||||
<ChevronDownIcon
|
||||
className="h-2 w-2 flex-shrink-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</ListboxButton>
|
||||
<ListboxOptions className="min-w-32 max-w-48">
|
||||
<ListboxOption value="agent" disabled={!agentModeSupported}>
|
||||
<div className="flex flex-row items-center gap-1.5">
|
||||
<SparklesIcon className="h-3 w-3" />
|
||||
<span className="">Agent</span>
|
||||
</div>
|
||||
{mode === "agent" && <CheckIcon className="ml-auto h-3 w-3" />}
|
||||
{!agentModeSupported && <span>(Not supported)</span>}
|
||||
</StyledListboxOption>
|
||||
</ListboxOption>
|
||||
|
||||
<StyledListboxOption value="chat">
|
||||
<ChatBubbleLeftIcon className="h-3 w-3" />
|
||||
<span className="font-semibold">Chat</span>
|
||||
<ShortcutText>{getMetaKeyLabel()}L</ShortcutText>
|
||||
<ListboxOption value="chat">
|
||||
<div className="flex flex-row items-center gap-1.5">
|
||||
<ChatBubbleLeftIcon className="h-3 w-3" />
|
||||
<span className="">Chat</span>
|
||||
<ShortcutText>{getMetaKeyLabel()}L</ShortcutText>
|
||||
</div>
|
||||
{mode === "chat" && <CheckIcon className="ml-auto h-3 w-3" />}
|
||||
</StyledListboxOption>
|
||||
</ListboxOption>
|
||||
|
||||
{!jetbrains && (
|
||||
<StyledListboxOption value="edit">
|
||||
<PencilIcon className="h-3 w-3" />
|
||||
<span className="font-semibold">Edit</span>
|
||||
<ShortcutText>{getMetaKeyLabel()}I</ShortcutText>
|
||||
<ListboxOption value="edit">
|
||||
<div className="flex flex-row items-center gap-1.5">
|
||||
<PencilIcon className="h-3 w-3" />
|
||||
<span className="">Edit</span>
|
||||
<ShortcutText>{getMetaKeyLabel()}I</ShortcutText>
|
||||
</div>
|
||||
{mode === "edit" && <CheckIcon className="ml-auto h-3 w-3" />}
|
||||
</StyledListboxOption>
|
||||
</ListboxOption>
|
||||
)}
|
||||
|
||||
<div className="text-lightgray px-2 py-1">
|
||||
{getMetaKeyLabel()}
|
||||
<span>.</span> for next mode
|
||||
{metaKeyLabel}. for next mode
|
||||
</div>
|
||||
</StyledListboxOptions>
|
||||
</ListboxOptions>
|
||||
</div>
|
||||
</Listbox>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { Listbox } from "@headlessui/react";
|
||||
import {
|
||||
CheckIcon,
|
||||
ChevronDownIcon,
|
||||
|
|
@ -9,7 +8,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";
|
||||
|
|
@ -19,9 +18,8 @@ import {
|
|||
setDefaultModel,
|
||||
} from "../../redux/slices/configSlice";
|
||||
import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
|
||||
import { fontSize, isMetaEquivalentKeyPressed } from "../../util";
|
||||
import Shortcut from "../gui/Shortcut";
|
||||
import { Divider } from "./platform/shared";
|
||||
import { getMetaKeyLabel, isMetaEquivalentKeyPressed } from "../../util";
|
||||
import { Listbox, ListboxButton, ListboxOption, ListboxOptions } from "../ui";
|
||||
|
||||
interface ModelOptionProps {
|
||||
option: Option;
|
||||
|
|
@ -36,68 +34,6 @@ interface Option {
|
|||
apiKey?: string;
|
||||
}
|
||||
|
||||
const MAX_HEIGHT_PX = 300;
|
||||
|
||||
const StyledListboxButton = styled(Listbox.Button)`
|
||||
font-family: inherit;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: ${fontSize(-3)};
|
||||
background: transparent;
|
||||
color: ${lightGray};
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
`;
|
||||
|
||||
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;
|
||||
|
||||
${({ isDisabled }) =>
|
||||
!isDisabled &&
|
||||
`
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: ${lightGray}33;
|
||||
}
|
||||
`}
|
||||
|
||||
${({ isDisabled }) =>
|
||||
isDisabled &&
|
||||
`
|
||||
opacity: 0.5;
|
||||
`}
|
||||
`;
|
||||
|
||||
const IconBase = styled.div<{ $hovered: boolean }>`
|
||||
width: 1.2em;
|
||||
height: 1.2em;
|
||||
|
|
@ -113,8 +49,6 @@ const IconBase = styled.div<{ $hovered: boolean }>`
|
|||
}
|
||||
`;
|
||||
|
||||
const StyledCog6ToothIcon = styled(IconBase).attrs({ as: Cog6ToothIcon })``;
|
||||
|
||||
function modelSelectTitle(model: any): string {
|
||||
if (model?.title) return model?.title;
|
||||
if (model?.model !== undefined && model?.model.trim() !== "") {
|
||||
|
|
@ -151,19 +85,19 @@ function ModelOption({
|
|||
}
|
||||
|
||||
return (
|
||||
<StyledListboxOption
|
||||
<ListboxOption
|
||||
key={idx}
|
||||
disabled={showMissingApiKeyMsg}
|
||||
value={option.value}
|
||||
isDisabled={showMissingApiKeyMsg}
|
||||
onMouseEnter={() => setHovered(true)}
|
||||
onMouseLeave={() => setHovered(false)}
|
||||
onClick={handleOptionClick}
|
||||
>
|
||||
<div className="flex w-full flex-col gap-0.5">
|
||||
<div className="flex w-full 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-col gap-0.5">
|
||||
<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">
|
||||
|
|
@ -172,13 +106,18 @@ 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 gap-1">
|
||||
{isSelected && <CheckIcon className="h-3 w-3 flex-shrink-0" />}
|
||||
{hovered && (
|
||||
<Cog6ToothIcon
|
||||
className="h-3 w-3 flex-shrink-0"
|
||||
onClick={onClickGear}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</StyledListboxOption>
|
||||
</ListboxOption>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -186,7 +125,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<HTMLButtonElement>(null);
|
||||
const [options, setOptions] = useState<Option[]>([]);
|
||||
const [sortedOptions, setSortedOptions] = useState<Option[]>([]);
|
||||
|
|
@ -216,12 +154,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 +174,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();
|
||||
|
|
@ -275,37 +195,29 @@ function ModelSelect() {
|
|||
}
|
||||
|
||||
return (
|
||||
// <span className="line-clamp-1">Hiad sfasdfasdf asdfasdf</span>
|
||||
<Listbox
|
||||
onChange={async (val: string) => {
|
||||
if (val === defaultModel?.title) return;
|
||||
dispatch(setDefaultModel({ title: val }));
|
||||
}}
|
||||
>
|
||||
<div className="relative">
|
||||
<StyledListboxButton
|
||||
<div className="relative flex">
|
||||
<ListboxButton
|
||||
data-testid="model-select-button"
|
||||
ref={buttonRef}
|
||||
className="h-[18px] overflow-hidden"
|
||||
style={{ padding: 0 }}
|
||||
onClick={calculatePosition}
|
||||
className="h-[18px] gap-1 border-none text-gray-400"
|
||||
>
|
||||
<div className="flex max-w-[33vw] items-center gap-0.5 text-gray-400 transition-colors duration-200">
|
||||
<span className="truncate">
|
||||
{modelSelectTitle(defaultModel) || "Select model"}{" "}
|
||||
</span>
|
||||
<ChevronDownIcon
|
||||
className="h-3 w-3 flex-shrink-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</div>
|
||||
</StyledListboxButton>
|
||||
<StyledListboxOptions
|
||||
$showabove={showAbove}
|
||||
className="z-50 max-w-[90vw]"
|
||||
>
|
||||
<div
|
||||
className={`max-h-[${MAX_HEIGHT_PX}px] no-scrollbar overflow-y-scroll`}
|
||||
>
|
||||
<span className="line-clamp-1 hover:brightness-110">
|
||||
{modelSelectTitle(defaultModel) || "Select model"}
|
||||
</span>
|
||||
<ChevronDownIcon
|
||||
className="h-2 w-2 flex-shrink-0 hover:brightness-110"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</ListboxButton>
|
||||
<ListboxOptions className={"min-w-[160px]"}>
|
||||
<div className={`no-scrollbar max-h-[300px] overflow-y-auto`}>
|
||||
{sortedOptions.map((option, idx) => (
|
||||
<ModelOption
|
||||
option={option}
|
||||
|
|
@ -317,12 +229,10 @@ function ModelSelect() {
|
|||
))}
|
||||
</div>
|
||||
|
||||
<div className="mt-auto">
|
||||
<Divider className="!my-0" />
|
||||
|
||||
<div className="">
|
||||
{selectedProfile?.profileType === "local" && (
|
||||
<>
|
||||
<StyledListboxOption
|
||||
<ListboxOption
|
||||
key={options.length}
|
||||
onClick={onClickAddModel}
|
||||
value={"addModel" as any}
|
||||
|
|
@ -331,17 +241,15 @@ function ModelSelect() {
|
|||
<PlusIcon className="mr-2 h-3 w-3" />
|
||||
Add Chat model
|
||||
</div>
|
||||
</StyledListboxOption>
|
||||
</ListboxOption>
|
||||
</>
|
||||
)}
|
||||
|
||||
<Divider className="!my-0" />
|
||||
|
||||
<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>
|
||||
</StyledListboxOptions>
|
||||
</ListboxOptions>
|
||||
</div>
|
||||
</Listbox>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { Listbox, Transition } from "@headlessui/react";
|
||||
import {
|
||||
CheckIcon,
|
||||
ChevronUpDownIcon,
|
||||
|
|
@ -15,13 +14,19 @@ 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};
|
||||
`;
|
||||
|
||||
export const StyledListboxButton = styled(Listbox.Button)`
|
||||
export const StyledListboxButton = styled(ListboxButton)`
|
||||
cursor: pointer;
|
||||
background-color: ${vscBackground};
|
||||
text-align: left;
|
||||
|
|
@ -55,7 +60,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 +83,7 @@ export const StyledListboxOptions = styled(Listbox.Options)`
|
|||
}
|
||||
`;
|
||||
|
||||
export const StyledListboxOption = styled(Listbox.Option)<{
|
||||
export const StyledListboxOption = styled(ListboxOption)<{
|
||||
selected: boolean;
|
||||
}>`
|
||||
background-color: ${({ selected }) =>
|
||||
|
|
|
|||
|
|
@ -1,38 +1,167 @@
|
|||
import { Popover } from "@headlessui/react";
|
||||
import { ChevronDownIcon, PlusIcon } from "@heroicons/react/24/outline";
|
||||
import { ProfileDescription } from "core/config/ConfigHandler";
|
||||
import { useContext, useEffect, useRef } from "react";
|
||||
import {
|
||||
ArrowTopRightOnSquareIcon,
|
||||
BuildingOfficeIcon,
|
||||
ChevronDownIcon,
|
||||
Cog6ToothIcon,
|
||||
ExclamationTriangleIcon,
|
||||
PlusIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useContext, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useAuth } from "../../../context/Auth";
|
||||
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 AssistantIcon from "./AssistantIcon";
|
||||
import { AssistantSelectOptions } from "./AssistantSelectOptions";
|
||||
import { cycleProfile, selectProfileThunk } from "../../../redux";
|
||||
import { useAppDispatch, useAppSelector } from "../../../redux/hooks";
|
||||
import {
|
||||
fontSize,
|
||||
getMetaKeyLabel,
|
||||
isLocalProfile,
|
||||
isMetaEquivalentKeyPressed,
|
||||
} from "../../../util";
|
||||
import {
|
||||
Listbox,
|
||||
ListboxButton,
|
||||
ListboxOption,
|
||||
ListboxOptions,
|
||||
Transition,
|
||||
} from "../../ui";
|
||||
|
||||
function AssistantSelectButton(props: { selectedProfile: ProfileDescription }) {
|
||||
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 size={3} assistant={props.selectedProfile} />
|
||||
</div>
|
||||
<span className="select-none truncate">
|
||||
{props.selectedProfile.title}
|
||||
</span>
|
||||
<ChevronDownIcon
|
||||
className="h-2 w-2 flex-shrink-0 select-none"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
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";
|
||||
|
||||
interface AssistantSelectOptionProps {
|
||||
profile: ProfileDescription;
|
||||
onClick: () => void;
|
||||
}
|
||||
const AssistantSelectOption = ({
|
||||
profile,
|
||||
onClick,
|
||||
}: AssistantSelectOptionProps) => {
|
||||
const navigate = useNavigate();
|
||||
const [hovered, setHovered] = useState(false);
|
||||
|
||||
const hasFatalErrors = useMemo(() => {
|
||||
return !!profile.errors?.find((error) => error.fatal);
|
||||
}, [profile.errors]);
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
function handleOptionClick() {
|
||||
dispatch(selectProfileThunk(profile.id));
|
||||
onClick();
|
||||
}
|
||||
|
||||
function handleConfigure() {
|
||||
ideMessenger.post("config/openProfile", { profileId: profile.id });
|
||||
onClick();
|
||||
}
|
||||
|
||||
function handleClickError() {
|
||||
if (profile.id === "local") {
|
||||
navigate(ROUTES.CONFIG_ERROR);
|
||||
} else {
|
||||
ideMessenger.post("config/openProfile", { profileId: profile.id });
|
||||
}
|
||||
onClick();
|
||||
}
|
||||
|
||||
return (
|
||||
<ListboxOption
|
||||
onMouseEnter={() => setHovered(true)}
|
||||
onMouseLeave={() => setHovered(false)}
|
||||
value={profile.id}
|
||||
disabled={hasFatalErrors}
|
||||
onClick={!hasFatalErrors ? 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 ? (
|
||||
isLocalProfile(profile) ? (
|
||||
<Cog6ToothIcon
|
||||
className="h-3 w-3 flex-shrink-0 cursor-pointer"
|
||||
style={{
|
||||
opacity: hovered ? 1 : 0,
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleConfigure();
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<ArrowTopRightOnSquareIcon
|
||||
style={{
|
||||
opacity: hovered ? 1 : 0,
|
||||
}}
|
||||
className="h-3 w-3 flex-shrink-0 cursor-pointer"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleConfigure();
|
||||
}}
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
<>
|
||||
<ExclamationTriangleIcon
|
||||
data-tooltip-id={`${profile.id}-errors-tooltip`}
|
||||
className="h-3 w-3 flex-shrink-0 cursor-pointer text-red-500"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
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;
|
||||
|
|
@ -59,6 +188,9 @@ export default function AssistantSelect() {
|
|||
};
|
||||
}, []);
|
||||
|
||||
const tinyFont = useFontSize(-4);
|
||||
const smallFont = useFontSize(-3);
|
||||
|
||||
if (!selectedProfile) {
|
||||
return (
|
||||
<div
|
||||
|
|
@ -68,38 +200,116 @@ export default function AssistantSelect() {
|
|||
orgSlug: selectedOrganization?.slug,
|
||||
});
|
||||
}}
|
||||
className="hover:bg 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 (
|
||||
<Popover>
|
||||
<div className="relative">
|
||||
<Popover.Button
|
||||
<Listbox>
|
||||
<div className="sm:max-w-4/5 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} />
|
||||
</Popover.Button>
|
||||
<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>
|
||||
|
||||
<PopoverTransition>
|
||||
<Popover.Panel 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();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</Popover.Panel>
|
||||
</PopoverTransition>
|
||||
<Transition>
|
||||
<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
|
||||
key={idx}
|
||||
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>
|
||||
</Popover>
|
||||
</Listbox>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,130 +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 AssistantIcon from "./AssistantIcon";
|
||||
import { Divider, Option, OptionDiv } from "./shared";
|
||||
|
||||
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) => {
|
||||
return (
|
||||
<Option
|
||||
key={idx}
|
||||
idx={idx}
|
||||
disabled={!!profile.errors?.length}
|
||||
showConfigure={isLocalProfile(profile)}
|
||||
selected={profile.id === selectedProfile?.id}
|
||||
onOpenConfig={() => {
|
||||
handleConfigure(profile);
|
||||
}}
|
||||
errors={profile.errors}
|
||||
onClickError={() => handleClickError(profile.id)}
|
||||
onClick={() => {
|
||||
dispatch(selectProfileThunk(profile.id));
|
||||
onClose();
|
||||
}}
|
||||
>
|
||||
<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>
|
||||
</Option>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div className="mt-auto w-full">
|
||||
<OptionDiv
|
||||
key={"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>
|
||||
</OptionDiv>
|
||||
|
||||
<Divider className="!my-0" />
|
||||
|
||||
<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>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
15
gui/src/components/ui/Combobox.tsx
Normal file
15
gui/src/components/ui/Combobox.tsx
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import {
|
||||
Combobox,
|
||||
ComboboxButton,
|
||||
ComboboxInput,
|
||||
ComboboxOption,
|
||||
ComboboxOptions,
|
||||
} from "@headlessui/react";
|
||||
|
||||
export {
|
||||
Combobox,
|
||||
ComboboxButton,
|
||||
ComboboxInput,
|
||||
ComboboxOption,
|
||||
ComboboxOptions,
|
||||
};
|
||||
89
gui/src/components/ui/Listbox.tsx
Normal file
89
gui/src/components/ui/Listbox.tsx
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
import {
|
||||
ListboxButton as HLButton,
|
||||
ListboxOption as HLOption,
|
||||
ListboxOptions as HLOptions,
|
||||
Listbox,
|
||||
} from "@headlessui/react";
|
||||
import * as React from "react";
|
||||
import { defaultBorderRadius, vscCommandCenterInactiveBorder } from "..";
|
||||
import { cn } from "../../util/cn";
|
||||
import { FontSizeModifier, useFontSize } from "./font";
|
||||
|
||||
type ListboxButtonProps = React.ComponentProps<typeof HLButton> & {
|
||||
fontSizeModifier?: FontSizeModifier;
|
||||
};
|
||||
|
||||
const ListboxButton = React.forwardRef<HTMLButtonElement, ListboxButtonProps>(
|
||||
({ fontSizeModifier = -3, ...props }, ref) => {
|
||||
const fontSize = useFontSize(fontSizeModifier);
|
||||
return (
|
||||
<HLButton
|
||||
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 border border-solid px-1 py-0.5 text-left transition-colors duration-200",
|
||||
props.className,
|
||||
)}
|
||||
style={{
|
||||
fontSize,
|
||||
borderRadius: defaultBorderRadius,
|
||||
...props.style,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
type ListboxOptionsProps = React.ComponentProps<typeof HLOptions> & {
|
||||
fontSizeModifier?: FontSizeModifier;
|
||||
};
|
||||
const ListboxOptions = React.forwardRef<HTMLUListElement, ListboxOptionsProps>(
|
||||
({ fontSizeModifier = -3, ...props }, ref) => {
|
||||
const fontSize = useFontSize(fontSizeModifier);
|
||||
return (
|
||||
<HLOptions
|
||||
ref={ref}
|
||||
anchor={"bottom start"}
|
||||
{...props}
|
||||
className={cn(
|
||||
"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,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
type ListboxOptionProps = React.ComponentProps<typeof HLOption> & {
|
||||
fontSizeModifier?: FontSizeModifier;
|
||||
};
|
||||
const ListboxOption = React.forwardRef<HTMLLIElement, ListboxOptionProps>(
|
||||
({ fontSizeModifier = -3, ...props }, ref) => {
|
||||
const fontSize = useFontSize(fontSizeModifier);
|
||||
return (
|
||||
<HLOption
|
||||
ref={ref}
|
||||
{...props}
|
||||
className={cn(
|
||||
"text-vsc-foreground flex select-none flex-row items-center justify-between px-2 py-1",
|
||||
props.disabled
|
||||
? "opacity-50"
|
||||
: "background-transparent hover:bg-list-active hover:text-list-active-foreground cursor-pointer opacity-100",
|
||||
props.className,
|
||||
)}
|
||||
style={{
|
||||
fontSize,
|
||||
...props.style,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
export { Listbox, ListboxButton, ListboxOption, ListboxOptions };
|
||||
3
gui/src/components/ui/Popover.tsx
Normal file
3
gui/src/components/ui/Popover.tsx
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import { Popover, PopoverButton, PopoverPanel } from "@headlessui/react";
|
||||
|
||||
export { Popover, PopoverButton, PopoverPanel };
|
||||
20
gui/src/components/ui/Transition.tsx
Normal file
20
gui/src/components/ui/Transition.tsx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { Transition as HLTransition } from "@headlessui/react";
|
||||
import { cn } from "../../util/cn";
|
||||
|
||||
type TransitionProps = React.ComponentProps<typeof HLTransition>;
|
||||
function Transition(props: TransitionProps) {
|
||||
return (
|
||||
<HLTransition
|
||||
enter="transition duration-100 ease-out"
|
||||
enterFrom="transform scale-95 opacity-0"
|
||||
enterTo="transform scale-100 opacity-100"
|
||||
leave="transition duration-75 ease-out"
|
||||
leaveFrom="transform scale-100 opacity-100"
|
||||
leaveTo="transform scale-95 opacity-0"
|
||||
{...props}
|
||||
className={cn("flex flex-col", props.className)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export { Transition };
|
||||
15
gui/src/components/ui/font.ts
Normal file
15
gui/src/components/ui/font.ts
Normal file
|
|
@ -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]);
|
||||
};
|
||||
4
gui/src/components/ui/index.tsx
Normal file
4
gui/src/components/ui/index.tsx
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export * from "./Combobox";
|
||||
export * from "./Listbox";
|
||||
export * from "./Popover";
|
||||
export * from "./Transition";
|
||||
41
gui/src/context/LocalStorage.tsx
Normal file
41
gui/src/context/LocalStorage.tsx
Normal file
|
|
@ -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<LocalStorageType>(
|
||||
DEFAULT_LOCAL_STORAGE,
|
||||
);
|
||||
|
||||
export const LocalStorageProvider: React.FC<{ children: React.ReactNode }> = ({
|
||||
children,
|
||||
}) => {
|
||||
const [values, setValues] = useState<LocalStorageType>(DEFAULT_LOCAL_STORAGE);
|
||||
|
||||
// TODO setvalue
|
||||
|
||||
useEffect(() => {
|
||||
const isJetbrains = getLocalStorage("ide") === "jetbrains";
|
||||
let fontSize = getLocalStorage("fontSize") ?? (isJetbrains ? 15 : 14);
|
||||
setValues({
|
||||
fontSize,
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<LocalStorageContext.Provider value={values}>
|
||||
{children}
|
||||
</LocalStorageContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
export const useLocalStorage = () => {
|
||||
const context = useContext(LocalStorageContext);
|
||||
return context;
|
||||
};
|
||||
45
gui/src/hooks/useBookmarkedSlashCommands.ts
Normal file
45
gui/src/hooks/useBookmarkedSlashCommands.ts
Normal file
|
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
|
@ -4,7 +4,11 @@ import { IdeMessengerContext } from "../context/IdeMessenger";
|
|||
|
||||
import { ConfigResult } from "@continuedev/config-yaml";
|
||||
import { BrowserSerializedContinueConfig } from "core";
|
||||
import { selectProfileThunk } from "../redux";
|
||||
import {
|
||||
initializeProfilePreferencesThunk,
|
||||
selectProfileThunk,
|
||||
selectSelectedProfileId,
|
||||
} from "../redux";
|
||||
import { useAppDispatch, useAppSelector } from "../redux/hooks";
|
||||
import {
|
||||
selectDefaultModel,
|
||||
|
|
@ -28,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);
|
||||
|
||||
|
|
@ -47,6 +52,12 @@ function useSetup() {
|
|||
dispatch(setConfigResult(configResult));
|
||||
dispatch(selectProfileThunk(profileId));
|
||||
|
||||
const isNewProfileId = profileId && profileId !== selectedProfileId;
|
||||
|
||||
if (isNewProfileId) {
|
||||
dispatch(initializeProfilePreferencesThunk({ profileId }));
|
||||
}
|
||||
|
||||
// Perform any actions needed with the config
|
||||
if (configResult.config?.ui?.fontSize) {
|
||||
setLocalStorage("fontSize", configResult.config.ui.fontSize);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
import { Popover, Transition } from "@headlessui/react";
|
||||
import { UserCircleIcon } from "@heroicons/react/24/outline";
|
||||
import { Fragment } from "react";
|
||||
|
||||
import { SecondaryButton } from "../../components";
|
||||
import {
|
||||
Popover,
|
||||
PopoverButton,
|
||||
PopoverPanel,
|
||||
Transition,
|
||||
} from "../../components/ui";
|
||||
import { useAuth } from "../../context/Auth";
|
||||
import { ScopeSelect } from "./ScopeSelect";
|
||||
|
||||
|
|
@ -11,26 +15,23 @@ export function AccountButton() {
|
|||
|
||||
if (!session) {
|
||||
return (
|
||||
<SecondaryButton onClick={() => login(false)}>Sign in</SecondaryButton>
|
||||
<SecondaryButton
|
||||
className="whitespace-nowrap"
|
||||
onClick={() => login(false)}
|
||||
>
|
||||
Sign in
|
||||
</SecondaryButton>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Popover className="relative">
|
||||
<Popover.Button className="bg-vsc-background hover:bg-vsc-input-background text-vsc-foreground mr-4 flex h-8 w-8 cursor-pointer items-center justify-center rounded-full border-none">
|
||||
<PopoverButton className="bg-vsc-background hover:bg-vsc-input-background text-vsc-foreground flex h-8 w-8 cursor-pointer items-center justify-center rounded-full border-none">
|
||||
<UserCircleIcon className="h-6 w-6" />
|
||||
</Popover.Button>
|
||||
</PopoverButton>
|
||||
|
||||
<Transition
|
||||
as={Fragment}
|
||||
enter="transition ease-out duration-200"
|
||||
enterFrom="opacity-0 translate-y-1"
|
||||
enterTo="opacity-100 translate-y-0"
|
||||
leave="transition ease-in duration-150"
|
||||
leaveFrom="opacity-100 translate-y-0"
|
||||
leaveTo="opacity-0 translate-y-1"
|
||||
>
|
||||
<Popover.Panel className="bg-vsc-input-background absolute right-0 z-10 mt-2 w-[250px] rounded-md border border-zinc-700 p-4 shadow-lg">
|
||||
<Transition>
|
||||
<PopoverPanel className="bg-vsc-input-background xs:p-4 absolute right-0 mt-1 rounded-md border border-zinc-700 p-2 shadow-lg">
|
||||
<div className="flex flex-col gap-3">
|
||||
<div className="flex flex-col">
|
||||
<span className="font-medium">{session.account.label}</span>
|
||||
|
|
@ -46,11 +47,11 @@ export function AccountButton() {
|
|||
<ScopeSelect />
|
||||
</div>
|
||||
)}
|
||||
<SecondaryButton onClick={logout} className="w-full justify-center">
|
||||
<SecondaryButton onClick={logout} className="">
|
||||
Sign out
|
||||
</SecondaryButton>
|
||||
</div>
|
||||
</Popover.Panel>
|
||||
</PopoverPanel>
|
||||
</Transition>
|
||||
</Popover>
|
||||
);
|
||||
|
|
|
|||
91
gui/src/pages/config/ConfigItemSelect.tsx
Normal file
91
gui/src/pages/config/ConfigItemSelect.tsx
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/**
|
||||
* A component that displays config items either as tabs (on large screens) or a popover select (on small screens)
|
||||
*/
|
||||
interface ConfigItemSelectProps {
|
||||
items: {
|
||||
id: string;
|
||||
label: string;
|
||||
icon: React.ReactNode;
|
||||
}[];
|
||||
activeId: string;
|
||||
onSelect: (id: string) => void;
|
||||
}
|
||||
|
||||
import { ChevronDownIcon } from "@heroicons/react/24/outline";
|
||||
import {
|
||||
Popover,
|
||||
PopoverButton,
|
||||
PopoverPanel,
|
||||
Transition,
|
||||
} from "../../components/ui";
|
||||
import { fontSize } from "../../util";
|
||||
|
||||
export function ConfigItemSelect({
|
||||
items,
|
||||
activeId,
|
||||
onSelect,
|
||||
}: ConfigItemSelectProps) {
|
||||
const activeItem = items.find((item) => item.id === activeId);
|
||||
|
||||
const tabContent = (
|
||||
<div className="hidden border-0 border-b-[1px] border-solid border-b-zinc-700 p-0.5 sm:flex sm:justify-center md:grid md:grid-cols-2 md:gap-x-2">
|
||||
{items.map((item) => (
|
||||
<div
|
||||
style={{ fontSize: fontSize(-2) }}
|
||||
key={item.id}
|
||||
className={`hover:bg-vsc-input-background flex cursor-pointer items-center justify-center gap-1.5 rounded-md px-2 py-2 ${
|
||||
activeId === item.id ? "" : "text-gray-400"
|
||||
}`}
|
||||
onClick={() => onSelect(item.id)}
|
||||
>
|
||||
{item.icon}
|
||||
{item.label}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
|
||||
// Render popover on smaller screens
|
||||
const popoverContent = (
|
||||
<div className="mt-2 px-1.5 sm:hidden">
|
||||
<Popover className="relative">
|
||||
<PopoverButton
|
||||
className="flex w-full items-center justify-between gap-2 rounded-md border border-zinc-700 px-3 py-2"
|
||||
style={{ fontSize: fontSize(-2) }}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
{activeItem?.icon}
|
||||
<span>{activeItem?.label}</span>
|
||||
</div>
|
||||
<ChevronDownIcon className="h-4 w-4" />
|
||||
</PopoverButton>
|
||||
|
||||
<Transition>
|
||||
<PopoverPanel className="bg-vsc-input-background absolute z-10 mt-1 w-full rounded-md border border-zinc-700 py-1">
|
||||
{items.map((item) => (
|
||||
<div
|
||||
key={item.id}
|
||||
className={`hover:bg-vsc-input-background flex cursor-pointer items-center gap-2 px-3 py-2 ${
|
||||
activeId === item.id ? "bg-vsc-input-background" : ""
|
||||
}`}
|
||||
onClick={() => {
|
||||
onSelect(item.id);
|
||||
}}
|
||||
>
|
||||
{item.icon}
|
||||
<span>{item.label}</span>
|
||||
</div>
|
||||
))}
|
||||
</PopoverPanel>
|
||||
</Transition>
|
||||
</Popover>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
{tabContent}
|
||||
{popoverContent}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
import { IndexingProgressUpdate } from "core";
|
||||
import { getProgressPercentage } from "./IndexingProgress";
|
||||
import {
|
||||
ArrowPathIcon,
|
||||
PauseCircleIcon,
|
||||
CheckCircleIcon,
|
||||
PauseCircleIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { IndexingProgressUpdate } from "core";
|
||||
import { getProgressPercentage } from "./IndexingProgress";
|
||||
|
||||
export interface IndexingProgressIndicatorProps {
|
||||
update: IndexingProgressUpdate;
|
||||
|
|
@ -28,13 +28,13 @@ function IndexingProgressIndicator({ update }: IndexingProgressIndicatorProps) {
|
|||
update.status !== "disabled" && progressPercentage !== "100";
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-between gap-1 text-stone-500">
|
||||
<div className="text-lightgray flex items-center justify-between gap-1">
|
||||
{showProgress && <span className="text-xs">{progressPercentage}%</span>}
|
||||
|
||||
{Icon && (
|
||||
<div className="flex items-center">
|
||||
<Icon
|
||||
className={`inline-block h-4 w-4 align-top text-stone-500 ${
|
||||
className={`text-lightgray inline-block h-4 w-4 align-top ${
|
||||
animateIcon ? "animate-spin-slow" : ""
|
||||
}`}
|
||||
></Icon>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ function IndexingProgressSubtext({
|
|||
return (
|
||||
<div className="flex justify-between">
|
||||
<span
|
||||
className={`inline-block cursor-pointer text-xs text-stone-500 underline`}
|
||||
className={`text-lightgray inline-block cursor-pointer text-xs underline`}
|
||||
onClick={onClick}
|
||||
>
|
||||
{STATUS_TO_SUBTITLE_TEXT[update.status]}
|
||||
|
|
@ -35,7 +35,7 @@ function IndexingProgressSubtext({
|
|||
|
||||
<div className={`${showIndexingDesc ? "w-2/3" : "flex-1"}`}>
|
||||
{showIndexingDesc && (
|
||||
<span className="block truncate text-right text-xs text-stone-500">
|
||||
<span className="text-lightgray block truncate text-right text-xs">
|
||||
{update.desc}
|
||||
</span>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export function IndexingSettingsSection() {
|
|||
<div className="py-5">
|
||||
<div>
|
||||
<h3 className="mx-auto mb-1 mt-0 text-xl">@codebase index</h3>
|
||||
<span className="w-3/4 text-xs text-stone-500">
|
||||
<span className="text-lightgray w-3/4 text-xs">
|
||||
Local embeddings of your codebase
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<div className="flex w-full items-center justify-between gap-x-4">
|
||||
<span className="text-xs">{props.description}</span>
|
||||
<div className="float-right flex gap-2">
|
||||
<div className="flex w-full flex-wrap items-center justify-between gap-x-4 gap-y-1">
|
||||
<span className="max-w-60 text-xs">{props.description}:</span>
|
||||
<div className="flex flex-1 flex-row items-center justify-end gap-1.5">
|
||||
{shortcut.split(" ").map((key, i) => {
|
||||
return <KeyDiv key={i} text={key}></KeyDiv>;
|
||||
})}
|
||||
|
|
@ -201,23 +192,25 @@ const jetbrainsShortcuts: KeyboardShortcutProps[] = [
|
|||
];
|
||||
|
||||
function KeyboardShortcuts() {
|
||||
const shortcuts = useMemo(() => {
|
||||
return isJetBrains() ? jetbrainsShortcuts : vscodeShortcuts;
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h3 className="mx-auto mb-1 text-xl">Keyboard shortcuts</h3>
|
||||
<GridDiv>
|
||||
{(isJetBrains() ? jetbrainsShortcuts : vscodeShortcuts).map(
|
||||
(shortcut, i) => {
|
||||
return (
|
||||
<KeyboardShortcut
|
||||
key={i}
|
||||
mac={shortcut.mac}
|
||||
windows={shortcut.windows}
|
||||
description={shortcut.description}
|
||||
/>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</GridDiv>
|
||||
<div className="flex max-w-[400px] flex-col">
|
||||
<h3 className="mb-2 text-xl">Keyboard shortcuts</h3>
|
||||
<div className="flex flex-col items-center justify-center gap-x-3 gap-y-3 p-1">
|
||||
{shortcuts.map((shortcut, i) => {
|
||||
return (
|
||||
<KeyboardShortcut
|
||||
key={i}
|
||||
mac={shortcut.mac}
|
||||
windows={shortcut.windows}
|
||||
description={shortcut.description}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 { AddBlockButton } from "../../components/mainInput/Lump/sections/AddBlockButton";
|
||||
import EditBlockButton from "../../components/mainInput/Lump/EditBlockButton";
|
||||
import { ExploreBlocksButton } from "../../components/mainInput/Lump/sections/ExploreBlocksButton";
|
||||
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<ConfigYaml["mcpServers"]>[number];
|
||||
}
|
||||
function MCPServerPreview({ server }: MCPServerStatusProps) {
|
||||
function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const config = useAppSelector((store) => store.config.config);
|
||||
const dispatch = useAppDispatch();
|
||||
|
|
@ -55,7 +59,7 @@ function MCPServerPreview({ server }: MCPServerStatusProps) {
|
|||
>
|
||||
<div className="flex flex-row items-center gap-3">
|
||||
{/* Name and Status */}
|
||||
<h3 className="m-0">{server.name}</h3>
|
||||
<span className="m-0 font-semibold">{server.name}</span>
|
||||
|
||||
{/* Error indicator if any */}
|
||||
{server.errors.length ? (
|
||||
|
|
@ -85,7 +89,7 @@ function MCPServerPreview({ server }: MCPServerStatusProps) {
|
|||
<code key={idx}>{tool.name}</code>
|
||||
))}
|
||||
{server.tools.length === 0 && (
|
||||
<span className="text-stone-500">No tools</span>
|
||||
<span className="text-lightgray">No tools</span>
|
||||
)}
|
||||
</ToolTip>
|
||||
</div>
|
||||
|
|
@ -100,7 +104,7 @@ function MCPServerPreview({ server }: MCPServerStatusProps) {
|
|||
<code key={idx}>{prompt.name}</code>
|
||||
))}
|
||||
{server.prompts.length === 0 && (
|
||||
<span className="text-stone-500">No prompts</span>
|
||||
<span className="text-lightgray">No prompts</span>
|
||||
)}
|
||||
</ToolTip>
|
||||
</div>
|
||||
|
|
@ -115,7 +119,7 @@ function MCPServerPreview({ server }: MCPServerStatusProps) {
|
|||
<code key={idx}>{resource.name}</code>
|
||||
))}
|
||||
{server.resources.length === 0 && (
|
||||
<span className="text-stone-500">No resources</span>
|
||||
<span className="text-lightgray">No resources</span>
|
||||
)}
|
||||
</ToolTip>
|
||||
</div>
|
||||
|
|
@ -124,6 +128,7 @@ function MCPServerPreview({ server }: MCPServerStatusProps) {
|
|||
|
||||
{/* Refresh button */}
|
||||
<div className="flex items-center gap-2">
|
||||
<EditBlockButton blockType={"mcpServers"} block={serverFromYaml} />
|
||||
<div
|
||||
className="text-lightgray flex cursor-pointer items-center hover:opacity-80"
|
||||
onClick={onRefresh}
|
||||
|
|
@ -153,16 +158,30 @@ function MCPServersPreview() {
|
|||
const servers = useAppSelector(
|
||||
(store) => 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 (
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex max-h-[170px] flex-col gap-1 overflow-y-auto overflow-x-hidden pr-2">
|
||||
{servers.map((server, idx) => (
|
||||
<MCPServerPreview key={idx} server={server} />
|
||||
{mergedBlocks.map(({ block, blockFromYaml }, idx) => (
|
||||
<MCPServerPreview
|
||||
key={idx}
|
||||
server={block}
|
||||
serverFromYaml={blockFromYaml}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<AddBlockButton blockType="mcpServers" />
|
||||
<ExploreBlocksButton blockType="mcpServers" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
@ -42,67 +47,46 @@ const ModelRoleSelector = ({
|
|||
</ToolTip>
|
||||
</div>
|
||||
<Listbox value={selectedModel?.title ?? null} onChange={handleSelect}>
|
||||
{({ open }) => (
|
||||
<div className="relative">
|
||||
<Listbox.Button
|
||||
aria-disabled={models.length === 0}
|
||||
className={`border-vsc-input-border 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 rounded-md border border-solid px-1.5 py-0.5 text-left text-sm`}
|
||||
>
|
||||
{models.length === 0 ? (
|
||||
<span
|
||||
className="text-lightgray lines lines-1 italic"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>{`No ${displayName} models${["Chat", "Apply", "Edit"].includes(displayName) ? ". Using chat model" : ""}`}</span>
|
||||
) : (
|
||||
<span
|
||||
className="lines lines-1"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
{selectedModel?.title ?? `Select ${displayName} model`}
|
||||
</span>
|
||||
)}
|
||||
{models.length ? (
|
||||
<div className="pointer-events-none flex items-center">
|
||||
<ChevronUpDownIcon className="h-3 w-3" aria-hidden="true" />
|
||||
</div>
|
||||
) : null}
|
||||
</Listbox.Button>
|
||||
<div className="relative">
|
||||
<ListboxButton
|
||||
disabled={models.length === 0}
|
||||
className={`bg-vsc-editor-background hover:bg-list-active hover:text-list-active-foreground w-full justify-between`}
|
||||
>
|
||||
{models.length === 0 ? (
|
||||
<span className="text-lightgray line-clamp-1 italic">{`No ${displayName} models${["Chat", "Apply", "Edit"].includes(displayName) ? ". Using chat model" : ""}`}</span>
|
||||
) : (
|
||||
<span className="line-clamp-1">
|
||||
{selectedModel?.title ?? `Select ${displayName} model`}
|
||||
</span>
|
||||
)}
|
||||
{models.length ? (
|
||||
<div className="pointer-events-none flex items-center">
|
||||
<ChevronUpDownIcon className="h-3 w-3" aria-hidden="true" />
|
||||
</div>
|
||||
) : null}
|
||||
</ListboxButton>
|
||||
|
||||
<Transition
|
||||
as={Fragment}
|
||||
show={open}
|
||||
enter="transition ease-out duration-100"
|
||||
enterFrom="transform opacity-0 scale-95"
|
||||
enterTo="transform opacity-100 scale-100"
|
||||
leave="transition ease-in duration-75"
|
||||
leaveFrom="transform opacity-100 scale-100"
|
||||
leaveTo="transform opacity-0 scale-95"
|
||||
<Transition>
|
||||
<ListboxOptions
|
||||
style={{ borderRadius: defaultBorderRadius }}
|
||||
className="min-w-40"
|
||||
>
|
||||
<Listbox.Options
|
||||
style={{ borderRadius: defaultBorderRadius }}
|
||||
className="bg-vsc-input-background border-vsc-input-border fixed z-[800] mt-0.5 min-w-40 overflow-auto border border-solid p-0 shadow-lg"
|
||||
>
|
||||
{models.map((option, idx) => (
|
||||
<Listbox.Option
|
||||
key={idx}
|
||||
value={option.title}
|
||||
className={`text-vsc-foreground hover:bg-list-active hover:text-list-active-foreground flex cursor-pointer flex-row items-center justify-between px-1 py-0.5`}
|
||||
{models.map((option, idx) => (
|
||||
<ListboxOption key={idx} value={option.title} className={""}>
|
||||
<span
|
||||
className="line-clamp-1 flex h-4 items-center gap-2"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
<span
|
||||
className="lines lines-1 relative flex h-4 items-center gap-2"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
{option.title}
|
||||
</span>
|
||||
{option.title === selectedModel?.title && (
|
||||
<CheckIcon className="h-3 w-3" aria-hidden="true" />
|
||||
)}
|
||||
</Listbox.Option>
|
||||
))}
|
||||
</Listbox.Options>
|
||||
</Transition>
|
||||
</div>
|
||||
)}
|
||||
{option.title}
|
||||
</span>
|
||||
{option.title === selectedModel?.title && (
|
||||
<CheckIcon className="h-3 w-3" aria-hidden="true" />
|
||||
)}
|
||||
</ListboxOption>
|
||||
))}
|
||||
</ListboxOptions>
|
||||
</Transition>
|
||||
</div>
|
||||
</Listbox>
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
import { useContext } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import PageHeader from "../../components/PageHeader";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { useNavigationListener } from "../../hooks/useNavigationListener";
|
||||
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
|
||||
import { AccountButton } from "./AccountButton";
|
||||
|
||||
function MorePage() {
|
||||
useNavigationListener();
|
||||
const dispatch = useAppDispatch();
|
||||
const navigate = useNavigate();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const config = useAppSelector((store) => store.config.config);
|
||||
const { disableIndexing } = config;
|
||||
|
||||
return (
|
||||
<div className="overflow-y-scroll">
|
||||
<PageHeader
|
||||
showBorder
|
||||
onTitleClick={() => navigate("/")}
|
||||
title="Chat"
|
||||
rightContent={<AccountButton />}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default MorePage;
|
||||
|
|
@ -14,10 +14,10 @@ function MoreHelpRow({ title, description, onClick, Icon }: MoreHelpRowProps) {
|
|||
>
|
||||
<div className="flex w-4/5 flex-col justify-center">
|
||||
<h3 className="my-0 text-sm">{title}</h3>
|
||||
<span className="py-1 text-xs text-stone-500">{description}</span>
|
||||
<span className="text-lightgray py-1 text-xs">{description}</span>
|
||||
</div>
|
||||
|
||||
<div className="flex h-5 w-1/5 w-5 cursor-pointer justify-end text-stone-500">
|
||||
<div className="text-lightgray flex h-5 w-1/5 w-5 cursor-pointer justify-end">
|
||||
<Icon />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
import { Listbox } 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";
|
||||
|
|
@ -36,59 +41,45 @@ export function ScopeSelect() {
|
|||
return (
|
||||
<Listbox value={selectedOrgId} onChange={handleChange}>
|
||||
<div className="relative">
|
||||
<Listbox.Button className="border-vsc-input-border hover:bg-vsc-input-background text-vsc-foreground bg-vsc-background flex w-full max-w-[400px] cursor-pointer items-center gap-0.5 rounded border border-solid p-2 hover:opacity-90">
|
||||
<div className="flex w-full items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
{selectedDisplay?.iconUrl ? (
|
||||
<img src={selectedDisplay.iconUrl} alt="" className="h-5 w-5" />
|
||||
) : (
|
||||
<CurScopeEntityFallBackIcon className="h-5 w-5" />
|
||||
)}
|
||||
<span className="truncate">
|
||||
{selectedDisplay?.name || "Select Organization"}
|
||||
</span>
|
||||
</div>
|
||||
<ChevronUpDownIcon className="h-5 w-5" aria-hidden="true" />
|
||||
<ListboxButton className="hover:bg-list-active hover:text-list-active-foreground min-w-[140px] justify-between px-4 py-2 sm:min-w-[200px]">
|
||||
<div className="flex items-center gap-2">
|
||||
{selectedDisplay?.iconUrl ? (
|
||||
<img src={selectedDisplay.iconUrl} alt="" className="h-5 w-5" />
|
||||
) : (
|
||||
<CurScopeEntityFallBackIcon className="h-5 w-5" />
|
||||
)}
|
||||
<span className="truncate">
|
||||
{selectedDisplay?.name || "Select Organization"}
|
||||
</span>
|
||||
</div>
|
||||
</Listbox.Button>
|
||||
<ChevronUpDownIcon className="h-5 w-5" aria-hidden="true" />
|
||||
</ListboxButton>
|
||||
|
||||
<Listbox.Options className="bg-vsc-input-background absolute z-50 mt-1 w-full max-w-[400px] list-none overflow-auto rounded p-0 shadow-lg">
|
||||
{organizations.length > 0 && (
|
||||
<>
|
||||
<div className="text-vsc-foreground p-2 font-semibold">
|
||||
Organizations
|
||||
<ListboxOptions className="z-[1000] min-w-[140px] pt-0.5 sm:min-w-[200px]">
|
||||
{organizations.map((org) => (
|
||||
<ListboxOption key={org.id} value={org.id} className="py-2">
|
||||
<div className="flex items-center gap-2">
|
||||
{org.iconUrl ? (
|
||||
<img src={org.iconUrl} alt="" className="h-5 w-5" />
|
||||
) : (
|
||||
<BuildingOfficeIcon className="h-5 w-5" />
|
||||
)}
|
||||
<span>{org.name}</span>
|
||||
</div>
|
||||
{organizations.map((org) => (
|
||||
<Listbox.Option
|
||||
key={org.id}
|
||||
value={org.id}
|
||||
className="text-vsc-foreground hover:bg-list-active cursor-pointer rounded p-2 text-sm hover:opacity-90"
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
{org.iconUrl ? (
|
||||
<img src={org.iconUrl} alt="" className="h-5 w-5" />
|
||||
) : (
|
||||
<BuildingOfficeIcon className="h-5 w-5" />
|
||||
)}
|
||||
<span>{org.name}</span>
|
||||
</div>
|
||||
</Listbox.Option>
|
||||
))}
|
||||
</ListboxOption>
|
||||
))}
|
||||
|
||||
<div className="bg-lightgray mx-1 my-1 h-px" />
|
||||
</>
|
||||
{!!organizations.length && (
|
||||
<div className="bg-lightgray mx-1 my-1 h-px" />
|
||||
)}
|
||||
|
||||
<Listbox.Option
|
||||
value={null}
|
||||
className="text-vsc-foreground hover:bg-list-active cursor-pointer rounded p-2 hover:opacity-90"
|
||||
>
|
||||
<ListboxOption value={null}>
|
||||
<div className="flex items-center gap-2">
|
||||
<UserCircleIcon className="h-5 w-5" />
|
||||
<span>Personal</span>
|
||||
</div>
|
||||
</Listbox.Option>
|
||||
</Listbox.Options>
|
||||
</ListboxOption>
|
||||
</ListboxOptions>
|
||||
</div>
|
||||
</Listbox>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import {
|
|||
} from "@heroicons/react/24/outline";
|
||||
import { useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import PageHeader from "../../components/PageHeader";
|
||||
import { PageHeader } from "../../components/PageHeader";
|
||||
import { useNavigationListener } from "../../hooks/useNavigationListener";
|
||||
import { fontSize } from "../../util";
|
||||
import { AccountButton } from "./AccountButton";
|
||||
|
|
@ -32,30 +32,32 @@ function ConfigPage() {
|
|||
id: "settings",
|
||||
label: "Settings",
|
||||
component: <UserSettingsForm />,
|
||||
icon: <Cog6ToothIcon className="h-4 w-4 flex-shrink-0" />,
|
||||
icon: <Cog6ToothIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
|
||||
},
|
||||
{
|
||||
id: "indexing",
|
||||
label: "Indexing",
|
||||
component: <IndexingSettingsSection />,
|
||||
icon: <CircleStackIcon className="h-4 w-4 flex-shrink-0" />,
|
||||
icon: <CircleStackIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
|
||||
},
|
||||
{
|
||||
id: "help",
|
||||
label: "Help",
|
||||
component: <HelpCenterSection />,
|
||||
icon: <QuestionMarkCircleIcon className="h-4 w-4 flex-shrink-0" />,
|
||||
icon: (
|
||||
<QuestionMarkCircleIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />
|
||||
),
|
||||
},
|
||||
{
|
||||
id: "shortcuts",
|
||||
label: "Shortcuts",
|
||||
component: <KeyboardShortcuts />,
|
||||
icon: <AcademicCapIcon className="h-4 w-4 flex-shrink-0" />,
|
||||
icon: <AcademicCapIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-col">
|
||||
<div className="flex h-full flex-col overflow-y-auto">
|
||||
<div className="bg-vsc-background sticky top-0 z-10">
|
||||
<PageHeader
|
||||
showBorder
|
||||
|
|
@ -65,14 +67,14 @@ function ConfigPage() {
|
|||
/>
|
||||
|
||||
{/* Tab Headers */}
|
||||
<div className="grid w-full grid-cols-2 border-0 border-b-[1px] border-solid border-b-zinc-700 sm:flex sm:justify-center">
|
||||
<div className="grid grid-cols-2 border-0 border-b-[1px] border-solid border-b-zinc-700 p-0.5 sm:flex sm:justify-center md:gap-x-2">
|
||||
{tabs.map((tab) => (
|
||||
<div
|
||||
style={{
|
||||
fontSize: fontSize(-2),
|
||||
}}
|
||||
key={tab.id}
|
||||
className={`hover:bg-vsc-input-background flex cursor-pointer items-center justify-center gap-2 rounded-md px-4 py-2 ${
|
||||
className={`hover:bg-vsc-input-background flex cursor-pointer items-center justify-center gap-1.5 rounded-md px-2 py-2 ${
|
||||
activeTab === tab.id ? "" : "text-gray-400"
|
||||
}`}
|
||||
onClick={() => setActiveTab(tab.id)}
|
||||
|
|
@ -85,7 +87,7 @@ function ConfigPage() {
|
|||
</div>
|
||||
|
||||
{/* Tab Content */}
|
||||
<div className="flex-1 overflow-y-auto overflow-x-hidden px-4">
|
||||
<div className="flex-1 overflow-y-auto px-4">
|
||||
{tabs.find((tab) => tab.id === activeTab)?.component}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ export function Chat() {
|
|||
|
||||
<StepsDiv
|
||||
ref={stepsDivRef}
|
||||
className={`overflow-y-scroll ${showPageHeader ? "" : "pt-[8px]"} ${showScrollbar ? "thin-scrollbar" : "no-scrollbar"} ${history.length > 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) => (
|
||||
|
|
@ -426,7 +426,7 @@ export function Chat() {
|
|||
className="flex items-center gap-2"
|
||||
>
|
||||
<ArrowLeftIcon className="h-3 w-3" />
|
||||
Last Session
|
||||
<span className="text-xs">Last Session</span>
|
||||
</NewSessionButton>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { Chat } from "./Chat";
|
|||
|
||||
export default function GUI() {
|
||||
return (
|
||||
<div className="flex overflow-hidden">
|
||||
<div className="flex w-screen flex-col overflow-hidden">
|
||||
<aside className="4xl:block border-vsc-input-border no-scrollbar hidden w-96 overflow-y-auto border-0 border-r border-solid">
|
||||
<History />
|
||||
</aside>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { useNavigate } from "react-router-dom";
|
||||
import { History } from "../../components/History";
|
||||
import PageHeader from "../../components/PageHeader";
|
||||
import { PageHeader } from "../../components/PageHeader";
|
||||
import { getFontSize } from "../../util";
|
||||
import { AccountButton } from "../config/AccountButton";
|
||||
|
||||
|
|
|
|||
|
|
@ -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<string | null>) => {
|
||||
state.selectedProfileId = payload;
|
||||
|
||||
if (payload) {
|
||||
ensureProfilePreferences(state, payload);
|
||||
}
|
||||
},
|
||||
setAvailableProfiles: (
|
||||
state,
|
||||
{ payload }: PayloadAction<ProfileDescription[] | null>,
|
||||
) => {
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
import { ProfilesState } from "./slice";
|
||||
|
||||
export function ensureProfilePreferences(
|
||||
state: ProfilesState,
|
||||
profileId: string,
|
||||
) {
|
||||
if (!state.preferencesByProfileId[profileId]) {
|
||||
state.preferencesByProfileId[profileId] = {
|
||||
bookmarksByName: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -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 = {
|
||||
|
|
|
|||
6
gui/src/util/cn.ts
Normal file
6
gui/src/util/cn.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import { clsx, type ClassValue } from "clsx";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
"tsc:watch:binary": "tsc --project binary/tsconfig.json --watch --noEmit --pretty"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.6.3",
|
||||
"@typescript-eslint/parser": "^7.8.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"prettier": "^3.3.3",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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