diff --git a/core/commands/slash/commit.ts b/core/commands/slash/commit.ts index f5f10c920..55f5f92e4 100644 --- a/core/commands/slash/commit.ts +++ b/core/commands/slash/commit.ts @@ -5,7 +5,7 @@ const CommitMessageCommand: SlashCommand = { description: "Generate a commit message for current changes", run: async function* ({ ide, llm, input }) { const diff = await ide.getDiff(); - const prompt = `${diff}\n\nGenerate a commit message for the above set of changes. If the changes are easily described in a single concept, then give a single sentence, no more than 80 characters. Otherwise, give a list of short bullet points, each no more than 40 characters. Output nothing except for the commit message.`; + const prompt = `${diff}\n\nGenerate a commit message for the above set of changes. First, give a single sentence, no more than 80 characters. Then, after 2 line breaks, give a list of no more than 5 short bullet points, each no more than 40 characters. Output nothing except for the commit message, and don't surround it in quotes.`; for await (const chunk of llm.streamChat([ { role: "user", content: prompt }, ])) { diff --git a/core/commands/slash/draftIssue.ts b/core/commands/slash/draftIssue.ts index a706c44d2..347e0e975 100644 --- a/core/commands/slash/draftIssue.ts +++ b/core/commands/slash/draftIssue.ts @@ -46,8 +46,9 @@ const DraftIssueCommand: SlashCommand = { yield chunk.content; } - // const url = f"{self.repository_url}/issues/new?title={quote(title)}&body={quote(body)}" - const url = `${params.repositoryUrl}/issues/new?title={encodeURIComponent(title)}&body={encodeURIComponent(body)}`; + const url = `${params.repositoryUrl}/issues/new?title=${encodeURIComponent( + title + )}&body=${encodeURIComponent(body)}`; yield `\n\n[Link to draft of issue](${url})`; }, }; diff --git a/core/commands/slash/stackOverflow.ts b/core/commands/slash/stackOverflow.ts index fbe7c687c..8c9e64ba5 100644 --- a/core/commands/slash/stackOverflow.ts +++ b/core/commands/slash/stackOverflow.ts @@ -16,13 +16,20 @@ async function getResults(q: string): Promise { const resp = await fetch(`${SERVER_URL}/search`, { method: "POST", + headers: { + "Content-Type": "application/json", + }, body: payload, }); return await resp.json(); } async function fetchData(url: string): Promise { - const response = await fetch(url); + const response = await fetch(url, { + headers: { + Accept: "text/html", + }, + }); const htmlString = await response.text(); const parser = new DOMParser(); diff --git a/core/index.d.ts b/core/index.d.ts index 4ad1b1e2b..31ed1052c 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -396,7 +396,6 @@ export interface ContextProviderWithParams { export interface SlashCommandDescription { name: string; description: string; - step: StepName | string; params?: { [key: string]: any }; } diff --git a/core/llm/index.ts b/core/llm/index.ts index 7ba1ad8f2..d6ee1dad7 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -49,6 +49,10 @@ function autodetectTemplateType(model: string): TemplateType | undefined { return undefined; } + if (lower.includes("dolphin")) { + return "chatml"; + } + if (lower.includes("phind")) { return "phind"; } diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index b4a884e3c..eea749178 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -678,7 +678,22 @@ "properties": { "name": { "title": "Name", - "type": "string" + "anyOf": [ + { + "enum": [ + "issue", + "share", + "so", + "cmd", + "edit", + "comment", + "http", + "commit" + ], + "type": "string" + }, + { "type": "string" } + ] }, "description": { "title": "Description", @@ -686,19 +701,7 @@ }, "step": { "title": "Step", - "enum": [ - "AnswerQuestionChroma", - "GenerateShellCommandStep", - "EditHighlightedCodeStep", - "ShareSessionStep", - "CommentCodeStep", - "ClearHistoryStep", - "StackOverflowStep", - "OpenConfigStep", - "DraftIssueStep", - "HttpSlashCommand", - "CommitMessageStep" - ], + "description": "This property is no longer required and has no effect. To use a built-in slash command, instead set the 'name' property to one of the pre-configured options.", "type": "string" }, "params": { @@ -707,7 +710,32 @@ "type": "object" } }, - "required": ["name", "description", "step"] + "allOf": [ + { + "if": { + "properties": { + "name": { + "enum": ["issue"] + } + } + }, + "then": { + "properties": { + "params": { + "properties": { + "repositoryUrl": { + "type": "string", + "description": "Enter the URL of the GitHub repository for which you want to generate the issue." + } + }, + "required": ["repositoryUrl"] + } + }, + "required": ["params"] + } + } + ], + "required": ["name", "description"] }, "CustomCommand": { "title": "CustomCommand", @@ -734,17 +762,22 @@ "properties": { "name": { "title": "Name", - "enum": [ - "diff", - "github", - "terminal", - "open", - "google", - "search", - "url", - "http" - ], - "type": "string" + "anyOf": [ + { + "enum": [ + "diff", + "github", + "terminal", + "open", + "google", + "search", + "url", + "http" + ], + "type": "string" + }, + { "type": "string" } + ] }, "params": { "title": "Params", @@ -752,6 +785,31 @@ "type": "object" } }, + "allOf": [ + { + "if": { + "properties": { + "name": { + "enum": ["google"] + } + } + }, + "then": { + "properties": { + "params": { + "properties": { + "serperApiKey": { + "type": "string", + "description": "Your API key for https://serper.dev in order to get Google search results" + } + }, + "required": ["serperApiKey"] + } + }, + "required": ["params"] + } + } + ], "required": ["name"] }, "RetrievalSettings": { diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index eeb377f82..89d4573c6 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -233,7 +233,10 @@ function TipTapEditor(props: TipTapEditorProps) { continue; } for (const node of p.content) { - if (node.type === "slashcommand" && node.attrs.label === "/edit") { + if ( + node.type === "slashcommand" && + ["/edit", "/comment"].includes(node.attrs.label) + ) { // Update context items dispatch( setEditingContextItemAtIndex({ item: codeBlock.attrs.item })