From 462a2239bfcc58be10c4c5334ee8b8d924f2c62e Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 2 Nov 2024 11:01:41 -0700 Subject: [PATCH] prompt files v2 --- core/commands/index.ts | 2 +- core/config/load.ts | 42 +++++++------ core/config/promptFile.ts | 2 +- .../providers/PromptFilesContextProvider.ts | 55 +++++++++++++++++ core/context/providers/index.ts | 2 +- core/core.ts | 6 +- core/llm/llms/index.ts | 8 +-- .../{ => v1}/createNewPromptFile.ts | 4 +- .../{ => v1}/getContextProviderHelpers.ts | 0 core/promptFiles/{ => v1}/getPromptFiles.ts | 4 +- core/promptFiles/{ => v1}/handlebarUtils.ts | 0 core/promptFiles/{ => v1}/index.ts | 5 +- .../{ => v1}/renderTemplatedString.ts | 0 .../{ => v1}/slashCommandFromPromptFile.ts | 8 +-- .../promptFiles/{ => v1}/updateChatHistory.ts | 0 core/promptFiles/v2/createNewPromptFile.ts | 35 +++++++++++ core/promptFiles/v2/getPromptFiles.ts | 59 +++++++++++++++++++ core/promptFiles/v2/parse.ts | 27 +++++++++ core/promptFiles/v2/renderPromptFile.ts | 3 + extensions/vscode/package-lock.json | 4 +- gui/src/components/mainInput/MentionList.tsx | 19 +++++- gui/src/components/mainInput/getSuggestion.ts | 23 ++++---- 22 files changed, 252 insertions(+), 56 deletions(-) create mode 100644 core/context/providers/PromptFilesContextProvider.ts rename core/promptFiles/{ => v1}/createNewPromptFile.ts (96%) rename core/promptFiles/{ => v1}/getContextProviderHelpers.ts (100%) rename core/promptFiles/{ => v1}/getPromptFiles.ts (86%) rename core/promptFiles/{ => v1}/handlebarUtils.ts (100%) rename core/promptFiles/{ => v1}/index.ts (73%) rename core/promptFiles/{ => v1}/renderTemplatedString.ts (100%) rename core/promptFiles/{ => v1}/slashCommandFromPromptFile.ts (94%) rename core/promptFiles/{ => v1}/updateChatHistory.ts (100%) create mode 100644 core/promptFiles/v2/createNewPromptFile.ts create mode 100644 core/promptFiles/v2/getPromptFiles.ts create mode 100644 core/promptFiles/v2/parse.ts create mode 100644 core/promptFiles/v2/renderPromptFile.ts diff --git a/core/commands/index.ts b/core/commands/index.ts index fd075c6ff..94b57c2b9 100644 --- a/core/commands/index.ts +++ b/core/commands/index.ts @@ -1,6 +1,6 @@ import { CustomCommand, SlashCommand, SlashCommandDescription } from "../"; import { stripImages } from "../llm/images"; -import { renderTemplatedString } from "../promptFiles/renderTemplatedString"; +import { renderTemplatedString } from "../promptFiles/v1/renderTemplatedString"; import SlashCommands from "./slash"; export function slashFromCustomCommand( diff --git a/core/config/load.ts b/core/config/load.ts index 2064dd61d..d9d020d2d 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -1,16 +1,9 @@ +import { execSync } from "child_process"; import * as JSONC from "comment-json"; import * as fs from "fs"; +import os from "os"; import path from "path"; import * as tar from "tar"; -import { - slashCommandFromDescription, - slashFromCustomCommand, -} from "../commands/index.js"; -import CustomContextProviderClass from "../context/providers/CustomContextProvider"; -import FileContextProvider from "../context/providers/FileContextProvider"; -import { contextProviderClassFromName } from "../context/providers/index"; -import { AllRerankers } from "../context/rerankers/index"; -import { LLMReranker } from "../context/rerankers/llm"; import { BrowserSerializedContinueConfig, Config, @@ -30,18 +23,25 @@ import { SerializedContinueConfig, SlashCommand, } from ".."; -import TransformersJsEmbeddingsProvider from "../indexing/embeddings/TransformersJsEmbeddingsProvider"; -import { allEmbeddingsProviders } from "../indexing/embeddings"; -import { BaseLLM } from "../llm"; -import CustomLLMClass from "../llm/llms/CustomLLM"; -import FreeTrial from "../llm/llms/FreeTrial"; -import { llmFromDescription } from "../llm/llms"; -import os from "os"; -import { execSync } from "child_process"; +import { + slashCommandFromDescription, + slashFromCustomCommand, +} from "../commands/index.js"; import CodebaseContextProvider from "../context/providers/CodebaseContextProvider"; import ContinueProxyContextProvider from "../context/providers/ContinueProxyContextProvider"; -import { fetchwithRequestOptions } from "../util/fetchWithOptions"; +import CustomContextProviderClass from "../context/providers/CustomContextProvider"; +import FileContextProvider from "../context/providers/FileContextProvider"; +import { contextProviderClassFromName } from "../context/providers/index"; +import { AllRerankers } from "../context/rerankers/index"; +import { LLMReranker } from "../context/rerankers/llm"; +import { allEmbeddingsProviders } from "../indexing/embeddings"; +import TransformersJsEmbeddingsProvider from "../indexing/embeddings/TransformersJsEmbeddingsProvider"; +import { BaseLLM } from "../llm"; +import { llmFromDescription } from "../llm/llms"; +import CustomLLMClass from "../llm/llms/CustomLLM"; +import FreeTrial from "../llm/llms/FreeTrial"; import { copyOf } from "../util"; +import { fetchwithRequestOptions } from "../util/fetchWithOptions"; import mergeJson from "../util/merge"; import { DEFAULT_CONFIG_TS_CONTENTS, @@ -65,8 +65,9 @@ import { getPromptFiles, slashCommandFromPromptFile, } from "./promptFile.js"; -import { validateConfig, ConfigValidationError } from "./validation.js"; +import { ConfigValidationError, validateConfig } from "./validation.js"; +import PromptFilesContextProvider from "../context/providers/PromptFilesContextProvider"; import { GlobalContext } from "../util/GlobalContext"; export interface ConfigResult { @@ -187,6 +188,7 @@ async function serializedToIntermediateConfig( const promptFolder = initial.experimental?.promptPath; if (loadPromptFiles) { + // v1 prompt files let promptFiles: { path: string; content: string }[] = []; promptFiles = ( await Promise.all( @@ -238,6 +240,7 @@ async function intermediateToFinalConfig( uniqueId: string, writeLog: (log: string) => Promise, workOsAccessToken: string | undefined, + loadPromptFiles: boolean = true, allowFreeTrial: boolean = true, ): Promise { // Auto-detect models @@ -389,6 +392,7 @@ async function intermediateToFinalConfig( const DEFAULT_CONTEXT_PROVIDERS = [ new FileContextProvider({}), new CodebaseContextProvider(codebaseContextParams), + ...(loadPromptFiles ? [new PromptFilesContextProvider({})] : []), ]; const DEFAULT_CONTEXT_PROVIDERS_TITLES = DEFAULT_CONTEXT_PROVIDERS.map( diff --git a/core/config/promptFile.ts b/core/config/promptFile.ts index ebbbd59ab..1cee2875f 100644 --- a/core/config/promptFile.ts +++ b/core/config/promptFile.ts @@ -4,7 +4,7 @@ import * as YAML from "yaml"; import type { IDE, SlashCommand } from ".."; import { walkDir } from "../indexing/walkDir"; import { stripImages } from "../llm/images"; -import { renderTemplatedString } from "../promptFiles/renderTemplatedString"; +import { renderTemplatedString } from "../promptFiles/v1/renderTemplatedString"; import { getBasename } from "../util/index"; export const DEFAULT_PROMPTS_FOLDER = ".prompts"; diff --git a/core/context/providers/PromptFilesContextProvider.ts b/core/context/providers/PromptFilesContextProvider.ts new file mode 100644 index 000000000..61314adae --- /dev/null +++ b/core/context/providers/PromptFilesContextProvider.ts @@ -0,0 +1,55 @@ +import { BaseContextProvider } from ".."; +import { + ContextItem, + ContextProviderDescription, + ContextProviderExtras, + ContextSubmenuItem, + LoadSubmenuItemsArgs, +} from "../../"; +import { getAllPromptFilesV2 } from "../../promptFiles/v2/getPromptFiles"; +import { parsePreamble } from "../../promptFiles/v2/parse"; +import { renderPromptFileV2 } from "../../promptFiles/v2/renderPromptFile"; + +class PromptFilesContextProvider extends BaseContextProvider { + static description: ContextProviderDescription = { + title: "prompt-files", + displayTitle: "Prompt Files", + description: ".prompt files", + type: "submenu", + }; + + async getContextItems( + query: string, + extras: ContextProviderExtras, + ): Promise { + const rawContent = await extras.ide.readFile(query); + const preamble = parsePreamble(query, rawContent); + const rendered = await renderPromptFileV2(rawContent); + return [ + { + content: rendered, + name: preamble.name, + description: preamble.description, + }, + ]; + } + + async loadSubmenuItems( + args: LoadSubmenuItemsArgs, + ): Promise { + const promptFiles = await getAllPromptFilesV2( + args.ide, + args.config.experimental?.promptPath, + ); + return promptFiles.map((file) => { + const preamble = parsePreamble(file.path, file.content); + return { + id: file.path, + title: preamble.name, + description: preamble.description, + }; + }); + } +} + +export default PromptFilesContextProvider; diff --git a/core/context/providers/index.ts b/core/context/providers/index.ts index fc56f6de9..ec1d7c6ad 100644 --- a/core/context/providers/index.ts +++ b/core/context/providers/index.ts @@ -4,6 +4,7 @@ import CodeContextProvider from "./CodeContextProvider"; import ContinueProxyContextProvider from "./ContinueProxyContextProvider"; import CurrentFileContextProvider from "./CurrentFileContextProvider"; import DatabaseContextProvider from "./DatabaseContextProvider"; +import DebugLocalsProvider from "./DebugLocalsProvider"; import DiffContextProvider from "./DiffContextProvider"; import DiscordContextProvider from "./DiscordContextProvider"; import DocsContextProvider from "./DocsContextProvider"; @@ -15,7 +16,6 @@ import GoogleContextProvider from "./GoogleContextProvider"; import GreptileContextProvider from "./GreptileContextProvider"; import HttpContextProvider from "./HttpContextProvider"; import JiraIssuesContextProvider from "./JiraIssuesContextProvider/"; -import DebugLocalsProvider from "./DebugLocalsProvider"; import OSContextProvider from "./OSContextProvider"; import OpenFilesContextProvider from "./OpenFilesContextProvider"; import PostgresContextProvider from "./PostgresContextProvider"; diff --git a/core/core.ts b/core/core.ts index 8ce7c7a5d..dcf27f6eb 100644 --- a/core/core.ts +++ b/core/core.ts @@ -8,7 +8,6 @@ import { setupLocalConfigAfterFreeTrial, setupQuickstartConfig, } from "./config/onboarding"; -import { createNewPromptFile } from "./config/promptFile"; import { addModel, addOpenAIKey, deleteModel } from "./config/util"; import { recentlyEditedFilesCache } from "./context/retrieval/recentlyEditedFilesCache"; import { ContinueServerClient } from "./continueServer/stubs/client"; @@ -18,6 +17,7 @@ import { streamDiffLines } from "./edit/streamDiffLines"; import { CodebaseIndexer, PauseToken } from "./indexing/CodebaseIndexer"; import DocsService from "./indexing/docs/DocsService"; import Ollama from "./llm/llms/Ollama"; +import { createNewPromptFileV2 } from "./promptFiles/v2/createNewPromptFile"; import type { FromCoreProtocol, ToCoreProtocol } from "./protocol"; import { GlobalContext } from "./util/GlobalContext"; import { ChatDescriber } from "./util/chatDescriber"; @@ -245,11 +245,11 @@ export class Core { }); on("config/newPromptFile", async (msg) => { - void createNewPromptFile( + await createNewPromptFileV2( this.ide, (await this.config()).experimental?.promptPath, ); - void this.configHandler.reloadConfig(); + await this.configHandler.reloadConfig(); }); on("config/reload", (msg) => { diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index 4a6b1d539..a3fa6c910 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -5,9 +5,10 @@ import { LLMOptions, ModelDescription, } from "../.."; -import { renderTemplatedString } from "../../promptFiles/renderTemplatedString"; +import { renderTemplatedString } from "../../promptFiles/v1/renderTemplatedString"; import { BaseLLM } from "../index"; import Anthropic from "./Anthropic"; +import Asksage from "./Asksage"; import Azure from "./Azure"; import Bedrock from "./Bedrock"; import BedrockImport from "./BedrockImport"; @@ -40,11 +41,10 @@ import SageMaker from "./SageMaker"; import SambaNova from "./SambaNova"; import TextGenWebUI from "./TextGenWebUI"; import Together from "./Together"; +import VertexAI from "./VertexAI"; import Vllm from "./Vllm"; import WatsonX from "./WatsonX"; import ContinueProxy from "./stubs/ContinueProxy"; -import VertexAI from "./VertexAI"; -import Asksage from "./Asksage"; const LLMs = [ Anthropic, @@ -84,7 +84,7 @@ const LLMs = [ Cerebras, Asksage, Nebius, - VertexAI + VertexAI, ]; export async function llmFromDescription( diff --git a/core/promptFiles/createNewPromptFile.ts b/core/promptFiles/v1/createNewPromptFile.ts similarity index 96% rename from core/promptFiles/createNewPromptFile.ts rename to core/promptFiles/v1/createNewPromptFile.ts index d686e0d72..e6386056c 100644 --- a/core/promptFiles/createNewPromptFile.ts +++ b/core/promptFiles/v1/createNewPromptFile.ts @@ -1,6 +1,6 @@ import path from "path"; -import { IDE } from ".."; -import { DEFAULT_PROMPTS_FOLDER } from "./"; +import { DEFAULT_PROMPTS_FOLDER } from "."; +import { IDE } from "../.."; const DEFAULT_PROMPT_FILE = `# This is an example ".prompt" file # It is used to define and reuse prompts within Continue diff --git a/core/promptFiles/getContextProviderHelpers.ts b/core/promptFiles/v1/getContextProviderHelpers.ts similarity index 100% rename from core/promptFiles/getContextProviderHelpers.ts rename to core/promptFiles/v1/getContextProviderHelpers.ts diff --git a/core/promptFiles/getPromptFiles.ts b/core/promptFiles/v1/getPromptFiles.ts similarity index 86% rename from core/promptFiles/getPromptFiles.ts rename to core/promptFiles/v1/getPromptFiles.ts index 2ab9dc893..b9bb5d823 100644 --- a/core/promptFiles/getPromptFiles.ts +++ b/core/promptFiles/v1/getPromptFiles.ts @@ -1,5 +1,5 @@ -import { IDE } from ".."; -import { walkDir } from "../indexing/walkDir"; +import { IDE } from "../.."; +import { walkDir } from "../../indexing/walkDir"; export async function getPromptFiles( ide: IDE, diff --git a/core/promptFiles/handlebarUtils.ts b/core/promptFiles/v1/handlebarUtils.ts similarity index 100% rename from core/promptFiles/handlebarUtils.ts rename to core/promptFiles/v1/handlebarUtils.ts diff --git a/core/promptFiles/index.ts b/core/promptFiles/v1/index.ts similarity index 73% rename from core/promptFiles/index.ts rename to core/promptFiles/v1/index.ts index c3afdec76..2eed3a15d 100644 --- a/core/promptFiles/index.ts +++ b/core/promptFiles/v1/index.ts @@ -1,8 +1,7 @@ -import { IDE } from ".."; -import { getPromptFiles } from "./getPromptFiles"; import { createNewPromptFile } from "./createNewPromptFile"; +import { getPromptFiles } from "./getPromptFiles"; import { slashCommandFromPromptFile } from "./slashCommandFromPromptFile"; export const DEFAULT_PROMPTS_FOLDER = ".prompts"; -export { getPromptFiles, createNewPromptFile, slashCommandFromPromptFile }; +export { createNewPromptFile, getPromptFiles, slashCommandFromPromptFile }; diff --git a/core/promptFiles/renderTemplatedString.ts b/core/promptFiles/v1/renderTemplatedString.ts similarity index 100% rename from core/promptFiles/renderTemplatedString.ts rename to core/promptFiles/v1/renderTemplatedString.ts diff --git a/core/promptFiles/slashCommandFromPromptFile.ts b/core/promptFiles/v1/slashCommandFromPromptFile.ts similarity index 94% rename from core/promptFiles/slashCommandFromPromptFile.ts rename to core/promptFiles/v1/slashCommandFromPromptFile.ts index e81f13615..1bb99b9cc 100644 --- a/core/promptFiles/slashCommandFromPromptFile.ts +++ b/core/promptFiles/v1/slashCommandFromPromptFile.ts @@ -1,10 +1,10 @@ -import { SlashCommand } from ".."; -import { stripImages } from "../llm/images"; +import * as YAML from "yaml"; +import { SlashCommand } from "../.."; +import { stripImages } from "../../llm/images"; +import { getBasename } from "../../util/index"; import { getContextProviderHelpers } from "./getContextProviderHelpers"; import { renderTemplatedString } from "./renderTemplatedString"; import { updateChatHistory } from "./updateChatHistory"; -import * as YAML from "yaml"; -import { getBasename } from "../util/index"; export function extractName(preamble: { name?: string }, path: string): string { return preamble.name ?? getBasename(path).split(".prompt")[0]; diff --git a/core/promptFiles/updateChatHistory.ts b/core/promptFiles/v1/updateChatHistory.ts similarity index 100% rename from core/promptFiles/updateChatHistory.ts rename to core/promptFiles/v1/updateChatHistory.ts diff --git a/core/promptFiles/v2/createNewPromptFile.ts b/core/promptFiles/v2/createNewPromptFile.ts new file mode 100644 index 000000000..e334a5085 --- /dev/null +++ b/core/promptFiles/v2/createNewPromptFile.ts @@ -0,0 +1,35 @@ +import path from "path"; +import { IDE } from "../.."; +import { DEFAULT_PROMPTS_FOLDER_V2 } from "./getPromptFiles"; + +const DEFAULT_PROMPT_FILE = `# This is an example ".prompt" file +# It is used to define and reuse prompts within Continue +# Continue will automatically create a context provider for each prompt in the .prompts folder +# To learn more, see the full .prompt file reference: https://docs.continue.dev/features/prompt-files +temperature: 0.0 +version: 2 +--- +@README.md + +Please reference the above README.md file to understand the current project. +`; + +export async function createNewPromptFileV2( + ide: IDE, + promptPath: string | undefined, +): Promise { + const workspaceDirs = await ide.getWorkspaceDirs(); + if (workspaceDirs.length === 0) { + throw new Error( + "No workspace directories found. Make sure you've opened a folder in your IDE.", + ); + } + const promptFilePath = path.join( + workspaceDirs[0], + promptPath ?? DEFAULT_PROMPTS_FOLDER_V2, + "new-prompt-file.prompt", + ); + + await ide.writeFile(promptFilePath, DEFAULT_PROMPT_FILE); + await ide.openFile(promptFilePath); +} diff --git a/core/promptFiles/v2/getPromptFiles.ts b/core/promptFiles/v2/getPromptFiles.ts new file mode 100644 index 000000000..ae02013a3 --- /dev/null +++ b/core/promptFiles/v2/getPromptFiles.ts @@ -0,0 +1,59 @@ +import path from "path"; +import { IDE } from "../.."; +import { walkDir } from "../../indexing/walkDir"; +import { readAllGlobalPromptFiles } from "../../util/paths"; + +async function getPromptFilesFromDir( + ide: IDE, + dir: string, +): Promise<{ path: string; content: string }[]> { + try { + const exists = await ide.fileExists(dir); + + if (!exists) { + return []; + } + + const paths = await walkDir(dir, ide, { ignoreFiles: [] }); + const results = paths.map(async (path) => { + const content = await ide.readFile(path); // make a try catch + return { path, content }; + }); + return Promise.all(results); + } catch (e) { + console.error(e); + return []; + } +} + +export const DEFAULT_PROMPTS_FOLDER_V2 = ".prompts"; + +export async function getAllPromptFilesV2( + ide: IDE, + overridePromptFolder?: string, +): Promise<{ path: string; content: string }[]> { + const workspaceDirs = await ide.getWorkspaceDirs(); + let promptFiles: { path: string; content: string }[] = []; + promptFiles = ( + await Promise.all( + workspaceDirs.map((dir) => + getPromptFilesFromDir( + ide, + path.join(dir, overridePromptFolder ?? DEFAULT_PROMPTS_FOLDER_V2), + ), + ), + ) + ) + .flat() + .filter(({ path }) => path.endsWith(".prompt")); + + // Also read from ~/.continue/.prompts + promptFiles.push(...readAllGlobalPromptFiles()); + + return await Promise.all( + promptFiles.map(async (file) => { + const content = await ide.readFile(file.path); + return { path: file.path, content }; + }), + ); +} diff --git a/core/promptFiles/v2/parse.ts b/core/promptFiles/v2/parse.ts new file mode 100644 index 000000000..1c952ba1b --- /dev/null +++ b/core/promptFiles/v2/parse.ts @@ -0,0 +1,27 @@ +import * as YAML from "yaml"; +import { getBasename } from "../../util"; + +export function extractName(preamble: { name?: string }, path: string): string { + return preamble.name ?? getBasename(path).split(".prompt")[0]; +} + +export function parsePreamble( + path: string, + content: string, +): { [key: string]: any; name: string; description: string } { + let [preambleRaw, prompt] = content.split("\n---\n"); + if (prompt === undefined) { + // This means there is no preamble + preambleRaw = ""; + } + + const preamble = YAML.parse(preambleRaw) ?? {}; + const name = extractName(preamble, path); + const description = preamble.description ?? name; + + return { + ...preamble, + name, + description, + }; +} diff --git a/core/promptFiles/v2/renderPromptFile.ts b/core/promptFiles/v2/renderPromptFile.ts new file mode 100644 index 000000000..769c93d3e --- /dev/null +++ b/core/promptFiles/v2/renderPromptFile.ts @@ -0,0 +1,3 @@ +export async function renderPromptFileV2(rawContent: string): Promise { + return rawContent; +} diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 760e977b6..44ade3c05 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.224", + "version": "0.9.225", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.224", + "version": "0.9.225", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/gui/src/components/mainInput/MentionList.tsx b/gui/src/components/mainInput/MentionList.tsx index a84294a23..62dfdf1de 100644 --- a/gui/src/components/mainInput/MentionList.tsx +++ b/gui/src/components/mainInput/MentionList.tsx @@ -6,6 +6,7 @@ import { BookOpenIcon, CodeBracketIcon, CommandLineIcon, + DocumentTextIcon, ExclamationCircleIcon, ExclamationTriangleIcon, FolderIcon, @@ -21,6 +22,7 @@ import { import { Editor } from "@tiptap/react"; import { forwardRef, + useContext, useEffect, useImperativeHandle, useRef, @@ -36,6 +38,7 @@ import { vscListActiveForeground, vscQuickInputBackground, } from ".."; +import { IdeMessengerContext } from "../../context/IdeMessenger"; import { setDialogMessage, setShowDialog, @@ -61,6 +64,7 @@ const ICONS_FOR_DROPDOWN: { [key: string]: any } = { issue: ExclamationCircleIcon, trash: TrashIcon, web: GlobeAltIcon, + "prompt-files": DocumentTextIcon, "repo-map": FolderIcon, "/edit": PencilIcon, "/clear": TrashIcon, @@ -177,6 +181,8 @@ interface MentionListProps { const MentionList = forwardRef((props: MentionListProps, ref) => { const dispatch = useDispatch(); + const ideMessenger = useContext(IdeMessengerContext); + const [selectedIndex, setSelectedIndex] = useState(0); const [subMenuTitle, setSubMenuTitle] = useState( @@ -208,6 +214,15 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { }, description: "Add a new documentation source", }); + } else if (subMenuTitle === ".prompt files") { + items.push({ + title: "New .prompt file", + type: "action", + action: () => { + ideMessenger.request("config/newPromptFile", undefined); + }, + description: "Create a new .prompt file", + }); } setAllItems(items); @@ -375,7 +390,7 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { onClick={() => selectItem(index)} onMouseEnter={() => setSelectedIndex(index)} > - +
{showFileIconForItem(item) && ( { opacity: index !== selectedIndex ? 0 : 1, minWidth: "30px", }} - className="whitespace-nowrap overflow-hidden overflow-ellipsis ml-2 flex items-center" + className="ml-2 flex items-center overflow-hidden overflow-ellipsis whitespace-nowrap" > {item.description} {item.type === "contextProvider" && diff --git a/gui/src/components/mainInput/getSuggestion.ts b/gui/src/components/mainInput/getSuggestion.ts index 196fe09a2..7711562ae 100644 --- a/gui/src/components/mainInput/getSuggestion.ts +++ b/gui/src/components/mainInput/getSuggestion.ts @@ -189,18 +189,17 @@ export function getSlashCommandDropdownOptions( const items = async ({ query }: { query: string }) => { const options = [ ...availableSlashCommandsRef.current, - { - title: "Build a custom prompt", - description: "Build a custom prompt", - type: "action", - id: "createPromptFile", - label: "Create Prompt File", - action: () => { - console.log("I", ideMessenger.request); - ideMessenger.request("config/newPromptFile", undefined); - }, - name: "Create Prompt File", - }, + // { + // title: "Build a custom prompt", + // description: "Build a custom prompt", + // type: "action", + // id: "createPromptFile", + // label: "Create Prompt File", + // action: () => { + // ideMessenger.request("config/newPromptFile", undefined); + // }, + // name: "Create Prompt File", + // }, ]; return ( options.filter((slashCommand) => {