From f43ea8c51da48679290e596159d9c69c44a4d12f Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 18 Dec 2024 17:00:57 -0800 Subject: [PATCH 01/15] avoid truncation of ChatDescriber titles --- core/util/chatDescriber.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/util/chatDescriber.ts b/core/util/chatDescriber.ts index e4fce3ecd..5b5ac5f4d 100644 --- a/core/util/chatDescriber.ts +++ b/core/util/chatDescriber.ts @@ -1,13 +1,13 @@ import { ILLM, LLMFullCompletionOptions } from ".."; -import { removeQuotesAndEscapes, removeCodeBlocksAndTrim } from "."; +import { removeCodeBlocksAndTrim, removeQuotesAndEscapes } from "."; -import type { IMessenger } from "../protocol/messenger"; import type { FromCoreProtocol, ToCoreProtocol } from "../protocol"; +import type { IMessenger } from "../protocol/messenger"; export class ChatDescriber { static prompt: string | undefined = - "Given the following... please reply with a short summary that is 4-12 words in length, you should summarize what the user is asking for OR what the user is trying to accomplish. You should only respond with the summary, no additional text or explanation, you don't need ending punctuation.\n\n"; + "Given the following... please reply with a short summary that is 4-8 words in length, you should summarize what the user is asking for OR what the user is trying to accomplish. You should only respond with the summary, no additional text or explanation, you don't need ending punctuation.\n\n"; static messenger: IMessenger; static async describe( @@ -26,7 +26,7 @@ export class ChatDescriber { return; } - completionOptions.maxTokens = 6; + completionOptions.maxTokens = 12; // Prompt the user's current LLM for the title const titleResponse = await model.chat( From 1549fd77aa82ccd664e7d9d6f55ea0e92b71b570 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 18 Dec 2024 17:07:03 -0800 Subject: [PATCH 02/15] remove enableDebugLogs (unused) --- extensions/vscode/package.json | 5 -- .../src/ContinueGUIWebviewViewProvider.ts | 47 ------------------- extensions/vscode/src/VsCodeIde.ts | 2 +- 3 files changed, 1 insertion(+), 53 deletions(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index dbca6152d..8470f84fd 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -127,11 +127,6 @@ "default": false, "markdownDescription": "Pause Continue's codebase index on start." }, - "continue.enableDebugLogs": { - "type": "boolean", - "default": false, - "markdownDescription": "Enable Continue Debug Logs in the Output panel." - }, "continue.remoteConfigServerUrl": { "type": "string", "default": null, diff --git a/extensions/vscode/src/ContinueGUIWebviewViewProvider.ts b/extensions/vscode/src/ContinueGUIWebviewViewProvider.ts index f98b09f93..eb1c6ea3b 100644 --- a/extensions/vscode/src/ContinueGUIWebviewViewProvider.ts +++ b/extensions/vscode/src/ContinueGUIWebviewViewProvider.ts @@ -1,5 +1,4 @@ import { ConfigHandler } from "core/config/ConfigHandler"; -import { EXTENSION_NAME } from "core/control-plane/env"; import * as vscode from "vscode"; import { getTheme } from "./util/getTheme"; @@ -19,42 +18,6 @@ export class ContinueGUIWebviewViewProvider return !!this.webview; } - private updateDebugLogsStatus() { - const settings = vscode.workspace.getConfiguration(EXTENSION_NAME); - this.enableDebugLogs = settings.get("enableDebugLogs", false); - if (!this.enableDebugLogs) { - this.outputChannel.hide(); - } - } - - // Show or hide the output channel on enableDebugLogs - private setupDebugLogsListener() { - vscode.workspace.onDidChangeConfiguration((event) => { - if (event.affectsConfiguration("continue.enableDebugLogs")) { - const settings = vscode.workspace.getConfiguration(EXTENSION_NAME); - const enableDebugLogs = settings.get("enableDebugLogs", false); - if (!enableDebugLogs) { - this.outputChannel.hide(); - } - } - }); - } - - private async handleWebviewMessage(message: any) { - if (message.messageType === "log") { - const settings = vscode.workspace.getConfiguration(EXTENSION_NAME); - const enableDebugLogs = settings.get("enableDebugLogs", false); - - if (message.level === "debug" && !enableDebugLogs) { - return; // Skip debug logs if enableDebugLogs is false - } - - const timestamp = new Date().toISOString().split(".")[0]; - const logMessage = `[${timestamp}] [${message.level.toUpperCase()}] ${message.text}`; - this.outputChannel.appendLine(logMessage); - } - } - resolveWebviewView( webviewView: vscode.WebviewView, _context: vscode.WebviewViewResolveContext, @@ -62,9 +25,6 @@ export class ContinueGUIWebviewViewProvider ): void | Thenable { this._webviewView = webviewView; this._webview = webviewView.webview; - this._webview.onDidReceiveMessage((message) => - this.handleWebviewMessage(message), - ); webviewView.webview.html = this.getSidebarContent( this.extensionContext, webviewView, @@ -73,8 +33,6 @@ export class ContinueGUIWebviewViewProvider private _webview?: vscode.Webview; private _webviewView?: vscode.WebviewView; - private outputChannel: vscode.OutputChannel; - private enableDebugLogs: boolean; get isVisible() { return this._webviewView?.visible; @@ -104,11 +62,6 @@ export class ContinueGUIWebviewViewProvider private readonly windowId: string, private readonly extensionContext: vscode.ExtensionContext, ) { - this.outputChannel = vscode.window.createOutputChannel("Continue"); - this.enableDebugLogs = false; - this.updateDebugLogsStatus(); - this.setupDebugLogsListener(); - this.webviewProtocol = new VsCodeWebviewProtocol( (async () => { const configHandler = await this.configHandlerPromise; diff --git a/extensions/vscode/src/VsCodeIde.ts b/extensions/vscode/src/VsCodeIde.ts index 9e237350e..f4be54c26 100644 --- a/extensions/vscode/src/VsCodeIde.ts +++ b/extensions/vscode/src/VsCodeIde.ts @@ -637,7 +637,7 @@ class VsCodeIde implements IDE { "pauseCodebaseIndexOnStart", false, ), - enableDebugLogs: settings.get("enableDebugLogs", false), + enableDebugLogs: false, // settings.get( // "enableControlServerBeta", // false, From 0f05f580ef2daec19319f3ff7f9b1799ba6169be Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 18 Dec 2024 20:06:15 -0800 Subject: [PATCH 03/15] don't use tools system message when tools off --- core/llm/constructMessages.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/llm/constructMessages.ts b/core/llm/constructMessages.ts index 7b6a5151a..24f44279d 100644 --- a/core/llm/constructMessages.ts +++ b/core/llm/constructMessages.ts @@ -71,10 +71,16 @@ function constructSystemPrompt( provider: string, useTools: boolean, ): string | null { - if (CUSTOM_SYS_MSG_MODEL_FAMILIES.some((family) => model.includes(family))) { + if ( + useTools && + CUSTOM_SYS_MSG_MODEL_FAMILIES.some((family) => model.includes(family)) + ) { return SYSTEM_MESSAGE + "\n\n" + TOOL_USE_RULES; - } - if (useTools && modelSupportsTools(model, provider)) { + } else if ( + CUSTOM_SYS_MSG_MODEL_FAMILIES.some((family) => model.includes(family)) + ) { + return SYSTEM_MESSAGE; + } else if (useTools && modelSupportsTools(model, provider)) { return TOOL_USE_RULES; } From fd3644da02b6c32d18fb4183c220e3c4a6fb29bc Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 18 Dec 2024 20:46:20 -0800 Subject: [PATCH 04/15] o1 support --- core/llm/llms/OpenAI.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/llm/llms/OpenAI.ts b/core/llm/llms/OpenAI.ts index e76a34f76..aa7d81917 100644 --- a/core/llm/llms/OpenAI.ts +++ b/core/llm/llms/OpenAI.ts @@ -93,9 +93,7 @@ class OpenAI extends BaseLLM { } private isO1Model(model?: string): boolean { - return ( - !!model && (model.startsWith("o1-preview") || model.startsWith("o1-mini")) - ); + return !!model && model.startsWith("o1"); } protected supportsPrediction(model: string): boolean { From 18c74307a890287689e4d271bae7841653713814 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 18 Dec 2024 21:03:35 -0800 Subject: [PATCH 05/15] don't display "Continue generation" for empty output --- gui/src/components/StepContainer/StepContainer.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gui/src/components/StepContainer/StepContainer.tsx b/gui/src/components/StepContainer/StepContainer.tsx index a497a0b22..9f03d3fe7 100644 --- a/gui/src/components/StepContainer/StepContainer.tsx +++ b/gui/src/components/StepContainer/StepContainer.tsx @@ -4,12 +4,12 @@ import { useEffect, useState } from "react"; import { useDispatch } from "react-redux"; import styled from "styled-components"; import { vscBackground } from ".."; -import { getFontSize } from "../../util"; -import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview"; -import ResponseActions from "./ResponseActions"; import { useAppSelector } from "../../redux/hooks"; import { selectUIConfig } from "../../redux/slices/configSlice"; import { deleteMessage } from "../../redux/slices/sessionSlice"; +import { getFontSize } from "../../util"; +import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview"; +import ResponseActions from "./ResponseActions"; interface StepContainerProps { item: ChatHistoryItem; @@ -48,6 +48,7 @@ export default function StepContainer(props: StepContainerProps) { // If not ending in punctuation or emoji, we assume the response got truncated if ( + content.trim() !== "" && !( endingPunctuation.some((p) => content.endsWith(p)) || /\p{Emoji}/u.test(content.slice(-2)) From b98c7a53af71dd4a4eefe0228a8bb86856f35406 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 18 Dec 2024 21:07:45 -0800 Subject: [PATCH 06/15] border for tokens tables --- gui/src/pages/stats.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gui/src/pages/stats.tsx b/gui/src/pages/stats.tsx index 81287d676..21c2481b6 100644 --- a/gui/src/pages/stats.tsx +++ b/gui/src/pages/stats.tsx @@ -4,14 +4,14 @@ import { useNavigate } from "react-router-dom"; import styled from "styled-components"; import { table } from "table"; import { lightGray, vscBackground, vscInputBackground } from "../components"; +import { CopyIconButton } from "../components/gui/CopyIconButton"; import { IdeMessengerContext } from "../context/IdeMessenger"; import { useNavigationListener } from "../hooks/useNavigationListener"; -import { CopyIconButton } from "../components/gui/CopyIconButton"; const Th = styled.th` padding: 0.5rem; text-align: left; - border: 1px solid ${vscInputBackground}; + border: 1px solid ${lightGray}; `; const Tr = styled.tr` @@ -21,12 +21,12 @@ const Tr = styled.tr` overflow-wrap: anywhere; - border: 1px solid ${vscInputBackground}; + border: 1px solid ${lightGray}; `; const Td = styled.td` padding: 0.5rem; - border: 1px solid ${vscInputBackground}; + border: 1px solid ${lightGray}; `; function generateTable(data: unknown[][]) { From 3d75fb4a2b296f87f2ecbac763bb3e4339a6f307 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 18 Dec 2024 21:19:49 -0800 Subject: [PATCH 07/15] fix prompt logs for tools --- core/llm/index.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/llm/index.ts b/core/llm/index.ts index c5a0d5c79..70fafda53 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -445,11 +445,22 @@ export abstract class BaseLLM implements ILLM { const msgsCopy = messages ? messages.map((msg) => ({ ...msg })) : []; let formatted = ""; for (const msg of msgsCopy) { - if ("content" in msg && Array.isArray(msg.content)) { + let contentToShow = ""; + if (msg.role === "tool") { + contentToShow = msg.content; + } else if (msg.role === "assistant" && msg.toolCalls) { + contentToShow = msg.toolCalls + ?.map( + (toolCall) => + `${toolCall.function?.name}(${toolCall.function?.arguments})`, + ) + .join("\n"); + } else if ("content" in msg && Array.isArray(msg.content)) { const content = renderChatMessage(msg); msg.content = content; } - formatted += `<${msg.role}>\n${msg.content || ""}\n\n`; + + formatted += `<${msg.role}>\n${contentToShow}\n\n`; } return formatted; } From f65704f6ad5357d8c9cae462c193fd76efe925c8 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 18 Dec 2024 22:47:46 -0800 Subject: [PATCH 08/15] resolve relative paths in read_file tool --- core/tools/implementations/readFile.ts | 9 +++++++-- core/util/uri.ts | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/core/tools/implementations/readFile.ts b/core/tools/implementations/readFile.ts index 674b41578..2653b3730 100644 --- a/core/tools/implementations/readFile.ts +++ b/core/tools/implementations/readFile.ts @@ -1,8 +1,13 @@ +import { firstAbsUriMatch, getUriPathBasename } from "../../util/uri"; + import { ToolImpl } from "."; -import { getUriPathBasename } from "../../util/uri"; export const readFileImpl: ToolImpl = async (args, extras) => { - const content = await extras.ide.readFile(args.filepath); + const firstUriMatch = await firstAbsUriMatch( + args.filepath, + await extras.ide.getWorkspaceDirs(), + ); + const content = await extras.ide.readFile(firstUriMatch); return [ { name: getUriPathBasename(args.filepath), diff --git a/core/util/uri.ts b/core/util/uri.ts index 49a9e8389..7842ced10 100644 --- a/core/util/uri.ts +++ b/core/util/uri.ts @@ -188,3 +188,20 @@ export function getLastNPathParts(filepath: string, n: number): string { } return filepath.split(/[\\/]/).slice(-n).join("/"); } + +export function firstAbsUriMatch( + relativePath: string, + workspaceDirUris: string[], +): string { + const cleanRelativePath = pathToUriPathSegment(relativePath); + + return workspaceDirUris + .map((dirUri) => { + try { + return joinPathsToUri(dirUri, cleanRelativePath); + } catch { + return null; + } + }) + .filter((uri): uri is string => uri !== null)[0]; +} From 7fe6ac1159b6c4034c2f406a72d341fad290eccc Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 18 Dec 2024 22:50:05 -0800 Subject: [PATCH 09/15] use existing function --- core/tools/implementations/readFile.ts | 10 +++++++--- core/util/uri.ts | 17 ----------------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/core/tools/implementations/readFile.ts b/core/tools/implementations/readFile.ts index 2653b3730..787955b5b 100644 --- a/core/tools/implementations/readFile.ts +++ b/core/tools/implementations/readFile.ts @@ -1,12 +1,16 @@ -import { firstAbsUriMatch, getUriPathBasename } from "../../util/uri"; +import { getUriPathBasename } from "../../util/uri"; import { ToolImpl } from "."; +import { resolveRelativePathInDir } from "../../util/ideUtils"; export const readFileImpl: ToolImpl = async (args, extras) => { - const firstUriMatch = await firstAbsUriMatch( + const firstUriMatch = await resolveRelativePathInDir( args.filepath, - await extras.ide.getWorkspaceDirs(), + extras.ide, ); + if (!firstUriMatch) { + throw new Error(`Could not find file ${args.filepath}`); + } const content = await extras.ide.readFile(firstUriMatch); return [ { diff --git a/core/util/uri.ts b/core/util/uri.ts index 7842ced10..49a9e8389 100644 --- a/core/util/uri.ts +++ b/core/util/uri.ts @@ -188,20 +188,3 @@ export function getLastNPathParts(filepath: string, n: number): string { } return filepath.split(/[\\/]/).slice(-n).join("/"); } - -export function firstAbsUriMatch( - relativePath: string, - workspaceDirUris: string[], -): string { - const cleanRelativePath = pathToUriPathSegment(relativePath); - - return workspaceDirUris - .map((dirUri) => { - try { - return joinPathsToUri(dirUri, cleanRelativePath); - } catch { - return null; - } - }) - .filter((uri): uri is string => uri !== null)[0]; -} From 1f70c968494bcaac639b0655dab3161c3b75cfa3 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 18 Dec 2024 23:05:06 -0800 Subject: [PATCH 10/15] show file in tool context item --- core/tools/implementations/readCurrentlyOpenFile.ts | 7 ++++++- core/tools/implementations/readFile.ts | 6 +++++- gui/src/components/mainInput/ContextItemsPeek.tsx | 5 +++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/core/tools/implementations/readCurrentlyOpenFile.ts b/core/tools/implementations/readCurrentlyOpenFile.ts index acfd9bec2..d0db3b60c 100644 --- a/core/tools/implementations/readCurrentlyOpenFile.ts +++ b/core/tools/implementations/readCurrentlyOpenFile.ts @@ -1,6 +1,7 @@ -import { ToolImpl } from "."; import { getUriPathBasename } from "../../util/uri"; +import { ToolImpl } from "."; + export const readCurrentlyOpenFileImpl: ToolImpl = async (args, extras) => { const result = await extras.ide.getCurrentFile(); @@ -15,6 +16,10 @@ export const readCurrentlyOpenFileImpl: ToolImpl = async (args, extras) => { name: "Current file", description: basename, content: `\`\`\`${basename}\n${result.contents}\n\`\`\``, + uri: { + type: "file", + value: result.path, + }, }, ]; }; diff --git a/core/tools/implementations/readFile.ts b/core/tools/implementations/readFile.ts index 787955b5b..c08713997 100644 --- a/core/tools/implementations/readFile.ts +++ b/core/tools/implementations/readFile.ts @@ -1,7 +1,7 @@ +import { resolveRelativePathInDir } from "../../util/ideUtils"; import { getUriPathBasename } from "../../util/uri"; import { ToolImpl } from "."; -import { resolveRelativePathInDir } from "../../util/ideUtils"; export const readFileImpl: ToolImpl = async (args, extras) => { const firstUriMatch = await resolveRelativePathInDir( @@ -17,6 +17,10 @@ export const readFileImpl: ToolImpl = async (args, extras) => { name: getUriPathBasename(args.filepath), description: args.filepath, content, + uri: { + type: "file", + value: firstUriMatch, + }, }, ]; }; diff --git a/gui/src/components/mainInput/ContextItemsPeek.tsx b/gui/src/components/mainInput/ContextItemsPeek.tsx index 77a9f222d..0450d15af 100644 --- a/gui/src/components/mainInput/ContextItemsPeek.tsx +++ b/gui/src/components/mainInput/ContextItemsPeek.tsx @@ -5,6 +5,7 @@ import { } from "@heroicons/react/24/outline"; import { ContextItemWithId } from "core"; import { ctxItemToRifWithContents } from "core/commands/util"; +import { getUriPathBasename } from "core/util/uri"; import { useContext, useMemo, useState } from "react"; import { AnimatedEllipsis, lightGray, vscBackground } from ".."; import { IdeMessengerContext } from "../../context/IdeMessenger"; @@ -13,7 +14,6 @@ import { selectIsGatheringContext } from "../../redux/slices/sessionSlice"; import FileIcon from "../FileIcon"; import SafeImg from "../SafeImg"; import { getIconFromDropdownItem } from "./MentionList"; -import { getUriPathBasename } from "core/util/uri"; interface ContextItemsPeekProps { contextItems?: ContextItemWithId[]; @@ -71,7 +71,8 @@ function ContextItemsPeekItem({ contextItem }: ContextItemsPeekItemProps) { } // Heuristic to check if it's a file - const shouldShowFileIcon = contextItem.content.includes("```"); + const shouldShowFileIcon = + contextItem.content.includes("```") || contextItem.uri?.type === "file"; if (shouldShowFileIcon) { return ( From f3ccf06d28d7ab003d71784e2e074b59b39806a3 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 18 Dec 2024 23:09:40 -0800 Subject: [PATCH 11/15] disable autocomplete in prompt files --- core/autocomplete/prefiltering/index.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/core/autocomplete/prefiltering/index.ts b/core/autocomplete/prefiltering/index.ts index ed1266ecc..8db50cda6 100644 --- a/core/autocomplete/prefiltering/index.ts +++ b/core/autocomplete/prefiltering/index.ts @@ -1,11 +1,9 @@ -import path from "node:path"; - import ignore from "ignore"; import { IDE } from "../.."; import { getConfigJsonPath } from "../../util/paths"; -import { HelperVars } from "../util/HelperVars"; import { findUriInDirs } from "../../util/uri"; +import { HelperVars } from "../util/HelperVars"; async function isDisabledForFile( currentFilepath: string, @@ -52,9 +50,8 @@ export async function shouldPrefilter( } // Check whether autocomplete is disabled for this file - if ( - await isDisabledForFile(helper.filepath, helper.options.disableInFiles, ide) - ) { + const disableInFiles = [...(helper.options.disableInFiles ?? []), "*.prompt"]; + if (await isDisabledForFile(helper.filepath, disableInFiles, ide)) { return true; } From 51418a6ba79b320d44070297e0b77c676e24aef4 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 19 Dec 2024 10:57:05 -0800 Subject: [PATCH 12/15] update docs about @ codebase --- docs/docs/chat/context-selection.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/chat/context-selection.md b/docs/docs/chat/context-selection.md index 71ae2a3cb..7bd8fe927 100644 --- a/docs/docs/chat/context-selection.md +++ b/docs/docs/chat/context-selection.md @@ -25,9 +25,9 @@ You can include a specific file in your current workspace as context by typing [ You can include a folder in your current workspace as context by typing [`@Folder`](../customize/context-providers.md#folder) and selecting the directory. It [works like `@Codebase`](../customize/deep-dives/codebase.md) but only includes the files in the selected folder. -## Entire codebase +## Codebase search -You can include your entire codebase as context by typing [`@Codebase`](../customize/context-providers.md#codebase). You can learn about how @Codebase works [here](../customize/deep-dives/codebase.md). +You can automatically include relevant files from your codebase as context by typing [`@Codebase`](../customize/context-providers.md#codebase). You can learn about how @Codebase works [here](../customize/deep-dives/codebase.md). ## Documentation site From 12f9a209f8f9164bb6888ee2720599838c630fca Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 19 Dec 2024 12:32:28 -0800 Subject: [PATCH 13/15] fix display of terminal command tool call --- gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx index 71082844d..be4905398 100644 --- a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx +++ b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx @@ -12,14 +12,14 @@ function FunctionSpecificToolCallDiv({ const args = toolCallState.parsedArgs; switch (toolCall.function.name) { - case "create_new_file": + case "builtin_create_new_file": return ( ); - case "run_terminal_command": + case "builtin_run_terminal_command": return ( Date: Thu, 19 Dec 2024 12:40:58 -0800 Subject: [PATCH 14/15] fix chat describer tests --- core/util/chatDescriber.test.ts | 8 ++++---- core/util/chatDescriber.ts | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/util/chatDescriber.test.ts b/core/util/chatDescriber.test.ts index 0b9e4aaf4..0e8851120 100644 --- a/core/util/chatDescriber.test.ts +++ b/core/util/chatDescriber.test.ts @@ -1,6 +1,6 @@ -import { ChatDescriber } from "./chatDescriber"; -import { testLLM } from "../test/fixtures"; import { LLMFullCompletionOptions } from ".."; +import { testLLM } from "../test/fixtures"; +import { ChatDescriber } from "./chatDescriber"; describe("ChatDescriber", () => { beforeEach(() => { @@ -30,7 +30,7 @@ describe("ChatDescriber", () => { expect(result).toBeUndefined(); }); - it("should set completionOptions.maxTokens to 6", async () => { + it("should set completionOptions.maxTokens to 12", async () => { const message = "Test message"; const completionOptions: LLMFullCompletionOptions = { temperature: 0.7 }; @@ -38,7 +38,7 @@ describe("ChatDescriber", () => { await ChatDescriber.describe(testLLM, completionOptions, message); - expect(completionOptions.maxTokens).toBe(6); + expect(completionOptions.maxTokens).toBe(ChatDescriber.maxTokens); }); it("should call model.chat with correct parameters", async () => { diff --git a/core/util/chatDescriber.ts b/core/util/chatDescriber.ts index 5b5ac5f4d..20eab20b7 100644 --- a/core/util/chatDescriber.ts +++ b/core/util/chatDescriber.ts @@ -6,6 +6,7 @@ import type { FromCoreProtocol, ToCoreProtocol } from "../protocol"; import type { IMessenger } from "../protocol/messenger"; export class ChatDescriber { + static maxTokens = 12; static prompt: string | undefined = "Given the following... please reply with a short summary that is 4-8 words in length, you should summarize what the user is asking for OR what the user is trying to accomplish. You should only respond with the summary, no additional text or explanation, you don't need ending punctuation.\n\n"; static messenger: IMessenger; @@ -26,7 +27,7 @@ export class ChatDescriber { return; } - completionOptions.maxTokens = 12; + completionOptions.maxTokens = ChatDescriber.maxTokens; // Prompt the user's current LLM for the title const titleResponse = await model.chat( From 34c0c7ddabb792c9a890fc2362e9c2a9ffcf95d5 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 19 Dec 2024 17:18:29 -0800 Subject: [PATCH 15/15] use dedicated container div for tippy.js --- gui/src/components/mainInput/MentionList.tsx | 6 +-- gui/src/components/mainInput/TipTapEditor.tsx | 38 +++++++++++-------- gui/src/components/mainInput/getSuggestion.ts | 8 +++- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/gui/src/components/mainInput/MentionList.tsx b/gui/src/components/mainInput/MentionList.tsx index 02cf4d8aa..f0f328a8d 100644 --- a/gui/src/components/mainInput/MentionList.tsx +++ b/gui/src/components/mainInput/MentionList.tsx @@ -38,10 +38,10 @@ import { } from ".."; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; -import HeaderButtonWithToolTip from "../gui/HeaderButtonWithToolTip"; import FileIcon from "../FileIcon"; import SafeImg from "../SafeImg"; import AddDocsDialog from "../dialogs/AddDocsDialog"; +import HeaderButtonWithToolTip from "../gui/HeaderButtonWithToolTip"; import { ComboBoxItem, ComboBoxItemType } from "./types"; const ICONS_FOR_DROPDOWN: { [key: string]: any } = { @@ -120,7 +120,7 @@ const ItemsDiv = styled.div` overflow-y: auto; max-height: 330px; padding: 0.2rem; - position: relative; + position: relative; // absolute to test tippy.js bug background-color: ${vscQuickInputBackground}; /* backdrop-filter: blur(12px); */ @@ -352,7 +352,7 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { }, [allItems]); return ( - + {querySubmenuItem ? ( ` resize: none; @@ -986,6 +986,12 @@ function TipTapEditor(props: TipTapEditorProps) { Hold ⇧ to drop image )} +
); } diff --git a/gui/src/components/mainInput/getSuggestion.ts b/gui/src/components/mainInput/getSuggestion.ts index b52328148..41e6338c1 100644 --- a/gui/src/components/mainInput/getSuggestion.ts +++ b/gui/src/components/mainInput/getSuggestion.ts @@ -37,9 +37,15 @@ function getSuggestion( return; } + const container = document.getElementById("tippy-js-div"); + if (!container) { + console.log("no container"); + return; + } + popup = tippy("body", { getReferenceClientRect: props.clientRect, - appendTo: () => document.body, + appendTo: () => container, content: component.element, showOnCreate: true, interactive: true,