🚸 improve onboarding

This commit is contained in:
Nate Sesti 2024-04-24 14:52:04 -07:00
parent 4bd76bd809
commit 646b19c4bf
11 changed files with 157 additions and 98 deletions

View file

@ -1,4 +1,4 @@
import { SerializedContinueConfig } from "..";
import { ContextProviderWithParams, SerializedContinueConfig } from "..";
export const defaultConfig: SerializedContinueConfig = {
models: [
@ -28,24 +28,6 @@ export const defaultConfig: SerializedContinueConfig = {
model: "mistral-8x7b",
},
],
slashCommands: [
{
name: "edit",
description: "Edit selected code",
},
{
name: "comment",
description: "Write comments for the selected code",
},
{
name: "share",
description: "Export the current chat session to markdown",
},
{
name: "cmd",
description: "Generate a shell command",
},
],
customCommands: [
{
name: "test",
@ -54,16 +36,6 @@ export const defaultConfig: SerializedContinueConfig = {
description: "Write unit tests for highlighted code",
},
],
contextProviders: [
{ name: "code", params: {} },
{ name: "docs", params: {} },
{ name: "diff", params: {} },
{ name: "open", params: {} },
{ name: "terminal", params: {} },
{ name: "problems", params: {} },
{ name: "folder", params: {} },
{ name: "codebase", params: {} },
],
tabAutocompleteModel: {
title: "Starcoder2 3b",
provider: "ollama",
@ -99,20 +71,6 @@ export const defaultConfigJetBrains: SerializedContinueConfig = {
model: "mistral-8x7b",
},
],
slashCommands: [
{
name: "edit",
description: "Edit selected code",
},
{
name: "comment",
description: "Write comments for the selected code",
},
{
name: "share",
description: "Export the current chat session to markdown",
},
],
customCommands: [
{
name: "test",
@ -121,10 +79,58 @@ export const defaultConfigJetBrains: SerializedContinueConfig = {
description: "Write unit tests for highlighted code",
},
],
contextProviders: [{ name: "open", params: {} }],
tabAutocompleteModel: {
title: "Starcoder2 3b",
provider: "ollama",
model: "starcoder2:3b",
},
};
export const defaultSlashCommandsVscode = [
{
name: "edit",
description: "Edit selected code",
},
{
name: "comment",
description: "Write comments for the selected code",
},
{
name: "share",
description: "Export the current chat session to markdown",
},
{
name: "cmd",
description: "Generate a shell command",
},
];
export const defaultSlashCommandsJetBrains = [
{
name: "edit",
description: "Edit selected code",
},
{
name: "comment",
description: "Write comments for the selected code",
},
{
name: "share",
description: "Export the current chat session to markdown",
},
];
export const defaultContextProvidersVsCode: ContextProviderWithParams[] = [
{ name: "code", params: {} },
{ name: "docs", params: {} },
{ name: "diff", params: {} },
{ name: "open", params: {} },
{ name: "terminal", params: {} },
{ name: "problems", params: {} },
{ name: "folder", params: {} },
{ name: "codebase", params: {} },
];
export const defaultContextProvidersJetBrains: ContextProviderWithParams[] = [
{ name: "open", params: {} },
];

View file

@ -43,6 +43,12 @@ import {
getContinueDotEnv,
migrate,
} from "../util/paths";
import {
defaultContextProvidersJetBrains,
defaultContextProvidersVsCode,
defaultSlashCommandsJetBrains,
defaultSlashCommandsVscode,
} from "./default";
const { execSync } = require("child_process");
function resolveSerializedConfig(filepath: string): SerializedContinueConfig {
@ -139,6 +145,16 @@ function loadSerializedConfig(
);
}
// Set defaults if undefined (this lets us keep config.json uncluttered for new users)
config.contextProviders ??=
ideType === "vscode"
? defaultContextProvidersVsCode
: defaultContextProvidersJetBrains;
config.slashCommands ??=
ideType === "vscode"
? defaultSlashCommandsVscode
: defaultSlashCommandsJetBrains;
return config;
}
@ -182,6 +198,7 @@ async function intermediateToFinalConfig(
config: Config,
readFile: (filepath: string) => Promise<string>,
): Promise<ContinueConfig> {
// Auto-detect models
const models: BaseLLM[] = [];
for (const desc of config.models) {
if (isModelDescription(desc)) {
@ -244,6 +261,7 @@ async function intermediateToFinalConfig(
}
}
// Tab autocomplete model
let autocompleteLlm: BaseLLM | undefined = undefined;
if (config.tabAutocompleteModel) {
if (isModelDescription(config.tabAutocompleteModel)) {
@ -258,6 +276,7 @@ async function intermediateToFinalConfig(
}
}
// Context providers
const contextProviders: IContextProvider[] = [new FileContextProvider({})];
for (const provider of config.contextProviders || []) {
if (isContextProviderWithParams(provider)) {

View file

@ -94,10 +94,8 @@ class FreeTrial extends BaseLLM {
async listModels(): Promise<string[]> {
return [
"gpt-3.5-turbo",
"gpt-4",
"gemini-1.5-pro-latest",
"gpt-4-turbo",
"codellama-70b",
"gemini-1.5-pro-latest",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307",

View file

@ -1127,6 +1127,29 @@
}
}
}
},
{
"if": {
"properties": {
"name": {
"enum": [
"share"
]
}
}
},
"then": {
"properties": {
"params": {
"properties": {
"outputDir": {
"type": "string",
"markdownDescription": "If outputDir is set to `.` or begins with `./` or `.\\`, file will be saved to the current workspace or a subdirectory thereof, respectively. `~` can similarly be used to specify the user's home directory."
}
}
}
}
}
}
],
"required": ["name", "description"]

View file

@ -1127,6 +1127,29 @@
}
}
}
},
{
"if": {
"properties": {
"name": {
"enum": [
"share"
]
}
}
},
"then": {
"properties": {
"params": {
"properties": {
"outputDir": {
"type": "string",
"markdownDescription": "If outputDir is set to `.` or begins with `./` or `.\\`, file will be saved to the current workspace or a subdirectory thereof, respectively. `~` can similarly be used to specify the user's home directory."
}
}
}
}
}
}
],
"required": ["name", "description"]

View file

@ -1244,6 +1244,29 @@
}
}
}
},
{
"if": {
"properties": {
"name": {
"enum": [
"share"
]
}
}
},
"then": {
"properties": {
"params": {
"properties": {
"outputDir": {
"type": "string",
"markdownDescription": "If outputDir is set to `.` or begins with `./` or `.\\`, file will be saved to the current workspace or a subdirectory thereof, respectively. `~` can similarly be used to specify the user's home directory."
}
}
}
}
}
}
],
"required": [

View file

@ -6,40 +6,9 @@ import { VsCodeExtension } from "../extension/vscodeExtension";
import registerQuickFixProvider from "../lang-server/codeActions";
import { getExtensionVersion } from "../util/util";
import { getExtensionUri } from "../util/vscode";
import { showTutorial } from "../webviewProtocol";
import { setupInlineTips } from "./inlineTips";
function showRefactorMigrationMessage(
extensionContext: vscode.ExtensionContext,
) {
// Only if the vscode setting continue.manuallyRunningSserver is true
const manuallyRunningServer =
vscode.workspace
.getConfiguration("continue")
.get<boolean>("manuallyRunningServer") || false;
if (
manuallyRunningServer &&
extensionContext?.globalState.get<boolean>(
"continue.showRefactorMigrationMessage",
) !== false
) {
vscode.window
.showInformationMessage(
"The Continue server protocol was recently updated in a way that requires the latest server version to work properly. Since you are manually running the server, please be sure to upgrade with `pip install --upgrade continuedev`.",
"Got it",
"Don't show again",
)
.then((selection) => {
if (selection === "Don't show again") {
// Get the global state
extensionContext?.globalState.update(
"continue.showRefactorMigrationMessage",
false,
);
}
});
}
}
export async function activateExtension(context: vscode.ExtensionContext) {
// Add necessary files
getTsConfigPath();
@ -47,18 +16,15 @@ export async function activateExtension(context: vscode.ExtensionContext) {
// Register commands and providers
registerQuickFixProvider();
setupInlineTips(context);
showRefactorMigrationMessage(context);
const vscodeExtension = new VsCodeExtension(context);
migrate("showWelcome_1", () => {
vscode.commands.executeCommand(
"markdown.showPreview",
vscode.Uri.file(
path.join(getExtensionUri().fsPath, "media", "welcome.md"),
),
);
});
showTutorial();
vscode.commands.executeCommand(
"markdown.showPreview",
vscode.Uri.file(path.join(getExtensionUri().fsPath, "media", "welcome.md")),
);
migrate("showWelcome_1", () => {});
// Load Continue configuration
if (!context.globalState.get("hasBeenInstalled")) {

View file

@ -73,6 +73,7 @@ export function openEditorAndRevealRange(
editorFilename: string,
range?: vscode.Range,
viewColumn?: vscode.ViewColumn,
preview?: boolean,
): Promise<vscode.TextEditor> {
return new Promise((resolve, _) => {
if (editorFilename.startsWith("~")) {
@ -93,10 +94,10 @@ export function openEditorAndRevealRange(
}
showTextDocumentInProcess = true;
vscode.window
.showTextDocument(
doc,
getViewColumnOfFile(editorFilename) || viewColumn,
)
.showTextDocument(doc, {
viewColumn: getViewColumnOfFile(editorFilename) || viewColumn,
preview,
})
.then((editor) => {
if (range) {
editor.revealRange(range);

View file

@ -26,7 +26,7 @@ import * as vscode from "vscode";
import { VerticalPerLineDiffManager } from "./diff/verticalPerLine/manager";
import { getExtensionUri } from "./util/vscode";
async function showTutorial() {
export async function showTutorial() {
const tutorialPath = path.join(
getExtensionUri().fsPath,
"continue_tutorial.py",
@ -41,7 +41,7 @@ async function showTutorial() {
const doc = await vscode.workspace.openTextDocument(
vscode.Uri.file(tutorialPath),
);
await vscode.window.showTextDocument(doc);
await vscode.window.showTextDocument(doc, { preview: false });
}
export class VsCodeWebviewProtocol {

View file

@ -75,7 +75,7 @@ function HelpPage() {
<TutorialButton
onClick={() => {
postToIde("showTutorial", undefined);
// navigate("/onboarding");
navigate("/onboarding");
}}
>
Open tutorial

View file

@ -33,9 +33,9 @@ function Onboarding() {
>
<h3>✨ Cloud models</h3>
<p>
This is the best experience. Use the best available commercial models
to index code and answer questions. Code is still only ever stored
locally.
This is the best experience. Continue will use the strongest available
commercial models to index code and answer questions. Code is only
ever stored locally.
</p>
</Div>
{selected === 0 && (