Skip to content

Commit ed6f001

Browse files
Merge pull request continuedev#4758 from continuedev/pe/conversation-starters
feat: conversation starters
2 parents 716f12e + 4c030c1 commit ed6f001

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+783
-543
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ Icon?
157157
notes.md
158158

159159
manual-testing-sandbox/.idea/**
160+
manual-testing-sandbox/.continue/**
160161
extensions/intellij/.idea/**
161162

162163
**/.idea/workspace.xml

binary/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/commands/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export function slashFromCustomCommand(
1010
return {
1111
name: customCommand.name,
1212
description: customCommand.description ?? "",
13+
prompt: customCommand.prompt,
1314
run: async function* ({ input, llm, history, ide, completionOptions }) {
1415
// Remove slash command prefix from input
1516
let userInput = input;

core/commands/util.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import { v4 as uuidv4 } from "uuid";
2+
13
import { ContextItemWithId, RangeInFileWithContents } from "../";
24
import { findUriInDirs, getUriPathBasename } from "../util/uri";
3-
import { v4 as uuidv4 } from "uuid";
45

56
export function rifWithContentsToContextItem(
67
rif: RangeInFileWithContents,

core/config/load.ts

+3-8
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ import ContinueProxyContextProvider from "../context/providers/ContinueProxyCont
4444
import CustomContextProviderClass from "../context/providers/CustomContextProvider";
4545
import FileContextProvider from "../context/providers/FileContextProvider";
4646
import { contextProviderClassFromName } from "../context/providers/index";
47-
import PromptFilesContextProvider from "../context/providers/PromptFilesContextProvider";
4847
import { useHub } from "../control-plane/env";
4948
import { allEmbeddingsProviders } from "../indexing/allEmbeddingsProviders";
5049
import { BaseLLM } from "../llm";
@@ -400,8 +399,6 @@ async function intermediateToFinalConfig(
400399
...(!config.disableIndexing
401400
? [new CodebaseContextProvider(codebaseContextParams)]
402401
: []),
403-
// Add prompt files provider if enabled
404-
...(loadPromptFiles ? [new PromptFilesContextProvider({})] : []),
405402
];
406403

407404
const DEFAULT_CONTEXT_PROVIDERS_TITLES = DEFAULT_CONTEXT_PROVIDERS.map(
@@ -633,11 +630,9 @@ async function finalToBrowserConfig(
633630
models: final.models.map(llmToSerializedModelDescription),
634631
systemMessage: final.systemMessage,
635632
completionOptions: final.completionOptions,
636-
slashCommands: final.slashCommands?.map((s) => ({
637-
name: s.name,
638-
description: s.description,
639-
params: s.params, // TODO: is this why params aren't referenced properly by slash commands?
640-
})),
633+
slashCommands: final.slashCommands?.map(
634+
({ run, ...slashCommandDescription }) => slashCommandDescription,
635+
),
641636
contextProviders: final.contextProviders?.map((c) => c.description),
642637
disableIndexing: final.disableIndexing,
643638
disableSessionTitles: final.disableSessionTitles,

core/config/profile/ControlPlaneProfileLoader.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ConfigJson } from "@continuedev/config-types";
22
import { ConfigResult } from "@continuedev/config-yaml";
33

44
import { ControlPlaneClient } from "../../control-plane/client.js";
5+
import { PRODUCTION_ENV } from "../../control-plane/env.js";
56
import {
67
ContinueConfig,
78
IDE,
@@ -10,7 +11,6 @@ import {
1011
} from "../../index.js";
1112
import { ProfileDescription } from "../ProfileLifecycleManager.js";
1213

13-
import { PRODUCTION_ENV } from "../../control-plane/env.js";
1414
import doLoadConfig from "./doLoadConfig.js";
1515
import { IProfileLoader } from "./IProfileLoader.js";
1616

core/config/profile/PlatformProfileLoader.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { AssistantUnrolled, ConfigResult } from "@continuedev/config-yaml";
22

33
import { ControlPlaneClient } from "../../control-plane/client.js";
4+
import { getControlPlaneEnv } from "../../control-plane/env.js";
45
import { ContinueConfig, IDE, IdeSettings } from "../../index.js";
5-
66
import { ProfileDescription } from "../ProfileLifecycleManager.js";
77

8-
import { getControlPlaneEnv } from "../../control-plane/env.js";
98
import doLoadConfig from "./doLoadConfig.js";
109
import { IProfileLoader } from "./IProfileLoader.js";
1110

core/config/profile/doLoadConfig.ts

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
ConfigValidationError,
77
ModelRole,
88
} from "@continuedev/config-yaml";
9+
910
import {
1011
ContinueConfig,
1112
ContinueRcJson,
@@ -31,6 +32,7 @@ import { loadContinueConfigFromJson } from "../load";
3132
import { migrateJsonSharedConfig } from "../migrateSharedConfig";
3233
import { rectifySelectedModelsFromGlobalContext } from "../selectedModels";
3334
import { loadContinueConfigFromYaml } from "../yaml/loadYaml";
35+
3436
import { PlatformConfigMetadata } from "./PlatformProfileLoader";
3537

3638
export default async function doLoadConfig(

core/config/validation.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ConfigValidationError } from "@continuedev/config-yaml";
2+
23
import { ModelDescription, SerializedContinueConfig } from "../";
34
import { Telemetry } from "../util/posthog";
45

core/config/yaml/loadYaml.ts

-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import CodebaseContextProvider from "../../context/providers/CodebaseContextProv
2828
import DocsContextProvider from "../../context/providers/DocsContextProvider";
2929
import FileContextProvider from "../../context/providers/FileContextProvider";
3030
import { contextProviderClassFromName } from "../../context/providers/index";
31-
import PromptFilesContextProvider from "../../context/providers/PromptFilesContextProvider";
3231
import { ControlPlaneClient } from "../../control-plane/client";
3332
import { allEmbeddingsProviders } from "../../indexing/allEmbeddingsProviders";
3433
import FreeTrial from "../../llm/llms/FreeTrial";
@@ -335,7 +334,6 @@ async function configYamlToContinueConfig(
335334
const DEFAULT_CONTEXT_PROVIDERS = [
336335
new FileContextProvider({}),
337336
new CodebaseContextProvider(codebaseContextParams),
338-
new PromptFilesContextProvider({}),
339337
];
340338

341339
const DEFAULT_CONTEXT_PROVIDERS_TITLES = DEFAULT_CONTEXT_PROVIDERS.map(

core/context/providers/PromptFilesContextProvider.ts

-57
This file was deleted.

core/index.d.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,7 @@ export interface ContinueSDK {
766766
export interface SlashCommand {
767767
name: string;
768768
description: string;
769+
prompt?: string;
769770
params?: { [key: string]: any };
770771
run: (sdk: ContinueSDK) => AsyncGenerator<string | undefined>;
771772
}
@@ -869,11 +870,7 @@ export interface ContextProviderWithParams {
869870
params: { [key: string]: any };
870871
}
871872

872-
export interface SlashCommandDescription {
873-
name: string;
874-
description: string;
875-
params?: { [key: string]: any };
876-
}
873+
export type SlashCommandDescription = Omit<SlashCommand, "run">;
877874

878875
export interface CustomCommand {
879876
name: string;

core/promptFiles/v1/slashCommandFromPromptFile.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,15 @@ export function slashCommandFromPromptFileV1(
5353
path: string,
5454
content: string,
5555
): SlashCommand | null {
56-
const { name, description, systemMessage, prompt, version } =
57-
parsePromptFileV1V2(path, content);
58-
59-
if (version !== 1) {
60-
return null;
61-
}
56+
const { name, description, systemMessage, prompt } = parsePromptFileV1V2(
57+
path,
58+
content,
59+
);
6260

6361
return {
6462
name,
6563
description,
64+
prompt,
6665
run: async function* (context) {
6766
const originalSystemMessage = context.llm.systemMessage;
6867
context.llm.systemMessage = systemMessage;

core/promptFiles/v2/parse.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as YAML from "yaml";
2+
23
import { getLastNPathParts } from "../../util/uri";
34

45
export function extractName(preamble: { name?: string }, path: string): string {

core/promptFiles/v2/parsePromptFileV1V2.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as YAML from "yaml";
2+
23
import { getLastNPathParts } from "../../util/uri";
34

45
export function parsePromptFileV1V2(path: string, content: string) {

core/promptFiles/v2/renderPromptFile.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { contextProviderClassFromName } from "../../context/providers";
33
import URLContextProvider from "../../context/providers/URLContextProvider";
44
import { resolveRelativePathInDir } from "../../util/ideUtils";
55
import { getUriPathBasename } from "../../util/uri";
6+
67
import { getPreambleAndBody } from "./parse";
78

89
async function resolveAttachment(

core/protocol/core.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
import { ConfigResult, ModelRole } from "@continuedev/config-yaml";
1+
import {
2+
ConfigResult,
3+
DevDataLogEvent,
4+
ModelRole,
5+
} from "@continuedev/config-yaml";
26

37
import { AutocompleteInput } from "../autocomplete/util/types";
48
import { ProfileDescription } from "../config/ConfigHandler";
59
import { OrganizationDescription } from "../config/ProfileLifecycleManager";
610
import { SharedConfigSchema } from "../config/sharedConfig";
11+
import { GlobalContextModelSelections } from "../util/GlobalContext";
712

8-
import { DevDataLogEvent } from "@continuedev/config-yaml";
913
import type {
1014
BrowserSerializedContinueConfig,
1115
ChatMessage,
@@ -29,7 +33,6 @@ import type {
2933
SlashCommandDescription,
3034
ToolCall,
3135
} from "../";
32-
import { GlobalContextModelSelections } from "../util/GlobalContext";
3336

3437
export type OnboardingModes = "Local" | "Best" | "Custom" | "Quickstart";
3538

core/util/paths.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import * as fs from "fs";
22
import * as os from "os";
33
import * as path from "path";
44

5+
import { DevEventName } from "@continuedev/config-yaml";
56
import * as JSONC from "comment-json";
67
import dotenv from "dotenv";
78

8-
import { DevEventName } from "@continuedev/config-yaml";
99
import { IdeType, SerializedContinueConfig } from "../";
1010
import { defaultConfig, defaultConfigJetBrains } from "../config/default";
1111
import Types from "../config/types";

docs/docs/customize/deep-dives/prompt-files.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
title: Prompt files
33
---
44

5-
Prompt files provide a convenient way to standardize common patterns and share a collection of LLM prompts with your team. They make it easy to build and use these prompts.
5+
Prompt files allow you to build and use local prompts, and provide a convenient way to test and iterate on prompts before publishing them to the Hub.
66

7-
On the [hub](../../hub/introduction.md), prompt files are stored within [prompt blocks](../../hub/blocks/block-types.md#prompts), which show up as [slash commands](../slash-commands.mdx) in Chat. Visit the hub to [explore prompts](https://hub.continue.dev/explore/prompts) or [create your own](https://hub.continue.dev/new?type=block&blockType=rules).
8-
9-
Prompt files can also be stored within your project's root directory as `.prompt` files. See below.
7+
:::info
8+
Visit the Hub to [explore prompts](https://hub.continue.dev/explore/prompts) or [create your own](https://hub.continue.dev/new?type=block&blockType=prompts)
9+
:::
1010

1111
## Quick start
1212

@@ -25,7 +25,7 @@ Attached is a summary of the current Ruby on Rails application, including the @G
2525

2626
Now to use this prompt, you can highlight code and use <kbd>cmd/ctrl</kbd> + <kbd>L</kbd> to select it in the Continue sidebar.
2727

28-
Then, type "@", select "Prompt files", and choose the one called "Rails Project". You can now ask any question as usual and the LLM will have the information from your .prompt file.
28+
Then, type <kbd>/</kbd> and choose the "Rails Project" prompt. You can now ask any question as usual and the LLM will have the information from your .prompt file.
2929

3030
## Format
3131

docs/docs/hub/blocks/block-types.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ Prompts blocks are pre-written, reusable prompts that can be referenced at any t
4343

4444
Prompt blocks have the same syntax as [prompt files](../../customize/deep-dives/prompt-files.md). There are two important differences between prompt blocks and prompt files:
4545

46-
1. Prompt blocks are stored within `config.yaml` rather than `.continue/prompts` in project directory and
47-
2. Prompt blocks only show up as slash commands in Chat, not under the `@Prompt Files` context provider
46+
1. Currently, prompt blocks cannot use context providers
47+
2. Prompt blocks are stored within `config.yaml` rather than `.continue/prompts` in project directory and
4848

4949
The `config.yaml` spec for `prompts` can be found [here](../../yaml-reference.md#prompts).
5050

5151
## Data
5252

5353
Data blocks allow you send your development data to custom destinations of your choice. Development data can be used for a variety of purposes, including analyzing usage, gathering insights, or fine-tuning models. You can read more about development data [here](../../customize/deep-dives/development-data.md). Explore data block examples [here](https://hub.continue.dev/explore/data).
5454

55-
Data destinations are configured in the[`data`](../../yaml-reference.md#data) section of `config.yaml`.
55+
Data destinations are configured in the [`data`](../../yaml-reference.md#data) section of `config.yaml`.

gui/src/components/CodeToEditCard/AddFileCombobox.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { useState, useEffect, useRef } from "react";
2-
import { useSubmenuContextProviders } from "../../context/SubmenuContextProviders";
31
import { Combobox } from "@headlessui/react";
4-
import FileIcon from "../FileIcon";
5-
import { useAppSelector } from "../../redux/hooks";
62
import { ContextSubmenuItemWithProvider } from "core";
3+
import { useEffect, useRef, useState } from "react";
4+
import { useSubmenuContextProviders } from "../../context/SubmenuContextProviders";
5+
import { useAppSelector } from "../../redux/hooks";
6+
import FileIcon from "../FileIcon";
77

88
export interface AddFileComboboxProps {
99
onSelect: (filepaths: string[]) => void | Promise<void>;

0 commit comments

Comments
 (0)