Skip to content

Commit da4a71c

Browse files
authored
Merge pull request continuedev#4839 from continuedev/dallin/complex-tool-output-fix
Tools and settings fixes
2 parents fa79ccd + ddf5c41 commit da4a71c

File tree

17 files changed

+102
-46
lines changed

17 files changed

+102
-46
lines changed

core/config/load.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ async function intermediateToFinalConfig(
500500
...config,
501501
contextProviders,
502502
models,
503-
tools: allTools,
503+
tools: [...allTools],
504504
mcpServerStatuses: [],
505505
slashCommands: config.slashCommands ?? [],
506506
modelsByRole: {
@@ -529,7 +529,7 @@ async function intermediateToFinalConfig(
529529
(config.experimental?.modelContextProtocolServers ?? []).map(
530530
(server, index) => ({
531531
id: `continue-mcp-server-${index + 1}`,
532-
name: `MCP Server ${index + 1}`,
532+
name: `MCP Server`,
533533
...server,
534534
}),
535535
),

core/config/profile/doLoadConfig.ts

-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ export default async function doLoadConfig(
135135
faviconUrl: server.faviconUrl,
136136
readonly: false,
137137
type: "function" as const,
138-
wouldLikeTo: "",
139138
uri: encodeMCPToolUri(server.id, tool.name),
140139
group: server.name,
141140
}));

core/index.d.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,9 @@ export interface Tool {
903903
};
904904

905905
displayTitle: string;
906-
wouldLikeTo: string;
906+
wouldLikeTo?: string;
907+
isCurrently?: string;
908+
hasAlready?: string;
907909
readonly: boolean;
908910
uri?: string;
909911
faviconUrl?: string;

core/llm/llm.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ function testLLM(
140140
},
141141
},
142142
type: "function",
143-
wouldLikeTo: "Say hello",
143+
wouldLikeTo: "say hello",
144+
isCurrently: "saying hello",
145+
hasAlready: "said hello",
144146
readonly: true,
145147
group: "Hello",
146148
},

core/tools/definitions/createNewFile.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
44
export const createNewFileTool: Tool = {
55
type: "function",
66
displayTitle: "Create New File",
7-
wouldLikeTo: "create a new file",
7+
wouldLikeTo: "create a new file at {{{ filepath }}}",
8+
isCurrently: "creating a new file at {{{ filepath }}}",
9+
hasAlready: "created a new file at {{{ filepath }}}",
810
group: BUILT_IN_GROUP_NAME,
911
readonly: false,
1012
function: {

core/tools/definitions/exactSearch.ts

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export const exactSearchTool: Tool = {
55
type: "function",
66
displayTitle: "Exact Search",
77
wouldLikeTo: 'search for "{{{ query }}}" in the repository',
8+
isCurrently: 'getting search results for "{{{ query }}}"',
9+
hasAlready: 'retreived search results for "{{{ query }}}"',
810
readonly: true,
911
group: BUILT_IN_GROUP_NAME,
1012
function: {

core/tools/definitions/readCurrentlyOpenFile.ts

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export const readCurrentlyOpenFileTool: Tool = {
55
type: "function",
66
displayTitle: "Read Currently Open File",
77
wouldLikeTo: "read the current file",
8+
isCurrently: "reading the current file",
9+
hasAlready: "read the current file",
810
readonly: true,
911
group: BUILT_IN_GROUP_NAME,
1012
function: {

core/tools/definitions/readFile.ts

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export const readFileTool: Tool = {
55
type: "function",
66
displayTitle: "Read File",
77
wouldLikeTo: "read {{{ filepath }}}",
8+
isCurrently: "reading {{{ filepath }}}",
9+
hasAlready: "read {{{ filepath }}}",
810
readonly: true,
911
group: BUILT_IN_GROUP_NAME,
1012
function: {

core/tools/definitions/runTerminalCommand.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
44
export const runTerminalCommandTool: Tool = {
55
type: "function",
66
displayTitle: "Run Terminal Command",
7-
wouldLikeTo: "run a terminal command",
7+
wouldLikeTo: "run the following terminal command:",
8+
isCurrently: "running the following terminal command:",
9+
hasAlready: "ran the following terminal command:",
810
readonly: false,
911
group: BUILT_IN_GROUP_NAME,
1012
function: {

core/tools/definitions/searchWeb.ts

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export const searchWebTool: Tool = {
66
type: "function",
77
displayTitle: "Search Web",
88
wouldLikeTo: 'search the web for "{{{ query }}}"',
9+
isCurrently: 'searching the web for "{{{ query }}}"',
10+
hasAlready: 'searched the web fore "{{{ query }}}"',
911
readonly: true,
1012
group: BUILT_IN_GROUP_NAME,
1113
function: {

core/tools/definitions/viewDiff.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
55
export const viewDiffTool: Tool = {
66
type: "function",
77
displayTitle: "View Diff",
8-
wouldLikeTo: "view a diff",
8+
wouldLikeTo: "view the git diff",
9+
isCurrently: "getting the git diff",
10+
hasAlready: "viewed the git diff",
911
readonly: true,
1012
group: BUILT_IN_GROUP_NAME,
1113
function: {

core/tools/definitions/viewRepoMap.ts

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export const viewRepoMapTool: Tool = {
66
type: "function",
77
displayTitle: "View Repo Map",
88
wouldLikeTo: "view the repository map",
9+
isCurrently: "getting the repository map",
10+
hasAlready: "viewed the repository map",
911
readonly: true,
1012
group: BUILT_IN_GROUP_NAME,
1113
function: {

core/tools/definitions/viewSubdirectory.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
44
export const viewSubdirectoryTool: Tool = {
55
type: "function",
66
displayTitle: "View Subdirectory",
7-
wouldLikeTo: 'view the contents of "{{{ directory_path }}}"',
7+
wouldLikeTo: 'view a map of "{{{ directory_path }}}"',
8+
isCurrently: 'getting a map of "{{{ directory_path }}}"',
9+
hasAlready: 'viewed a map of "{{{ directory_path }}}"',
810
readonly: true,
911
group: BUILT_IN_GROUP_NAME,
1012
function: {

extensions/vscode/package-lock.json

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

gui/src/components/modelSelection/platform/AssistantSelect.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export default function AssistantSelect() {
224224
>
225225
<div className="flex flex-row items-center gap-1.5">
226226
<div className="h-3 w-3 flex-shrink-0 select-none">
227-
<AssistantIcon assistant={selectedProfile} />
227+
<AssistantIcon size={3} assistant={selectedProfile} />
228228
</div>
229229
<span
230230
className={`line-clamp-1 select-none ${isLumpToolbarExpanded ? "xs:hidden sm:line-clamp-1" : ""}`}

gui/src/pages/config/UserSettingsForm.tsx

+16-16
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,20 @@ export function UserSettingsForm() {
6363
}, [promptPath]);
6464

6565
// TODO defaults are in multiple places, should be consolidated and probably not explicit here
66-
const enableSessionTabs = config.ui?.showSessionTabs ?? false;
66+
const showSessionTabs = config.ui?.showSessionTabs ?? false;
6767
const codeWrap = config.ui?.codeWrap ?? false;
6868
const showChatScrollbar = config.ui?.showChatScrollbar ?? false;
69-
const formatMarkdownOutput = !(config.ui?.displayRawMarkdown ?? false);
70-
const enableSessionTitles = !(config.disableSessionTitles ?? false);
7169
const readResponseTTS = config.experimental?.readResponseTTS ?? false;
70+
const displayRawMarkdown = config.ui?.displayRawMarkdown ?? false;
71+
const disableSessionTitles = config.disableSessionTitles ?? false;
7272

7373
const allowAnonymousTelemetry = config.allowAnonymousTelemetry ?? true;
74-
const enableIndexing = !(config.disableIndexing ?? false);
74+
const disableIndexing = config.disableIndexing ?? false;
7575

76-
const useAutocompleteCache = config.tabAutocompleteOptions?.useCache ?? true;
77-
const useChromiumForDocsCrawling =
78-
config.experimental?.useChromiumForDocsCrawling ?? false;
79-
const codeBlockToolbarPosition = config.ui?.codeBlockToolbarPosition ?? "top";
76+
// const useAutocompleteCache = config.tabAutocompleteOptions?.useCache ?? true;
77+
// const useChromiumForDocsCrawling =
78+
// config.experimental?.useChromiumForDocsCrawling ?? false;
79+
// const codeBlockToolbarPosition = config.ui?.codeBlockToolbarPosition ?? "top";
8080
const useAutocompleteMultilineCompletions =
8181
config.tabAutocompleteOptions?.multilineCompletions ?? "auto";
8282
const fontSize = getFontSize();
@@ -112,10 +112,10 @@ export function UserSettingsForm() {
112112

113113
<div className="flex flex-col gap-4">
114114
<ToggleSwitch
115-
isToggled={enableSessionTabs}
115+
isToggled={showSessionTabs}
116116
onToggle={() =>
117117
handleUpdate({
118-
showSessionTabs: !enableSessionTabs,
118+
showSessionTabs: !showSessionTabs,
119119
})
120120
}
121121
text="Show Session Tabs"
@@ -159,19 +159,19 @@ export function UserSettingsForm() {
159159
text="Use Chromium for Docs Crawling"
160160
/> */}
161161
<ToggleSwitch
162-
isToggled={enableSessionTitles}
162+
isToggled={!disableSessionTitles}
163163
onToggle={() =>
164164
handleUpdate({
165-
disableSessionTitles: !enableSessionTitles,
165+
disableSessionTitles: !disableSessionTitles,
166166
})
167167
}
168168
text="Enable Session Titles"
169169
/>
170170
<ToggleSwitch
171-
isToggled={formatMarkdownOutput}
171+
isToggled={!displayRawMarkdown}
172172
onToggle={() =>
173173
handleUpdate({
174-
displayRawMarkdown: !formatMarkdownOutput,
174+
displayRawMarkdown: !displayRawMarkdown,
175175
})
176176
}
177177
text="Format Markdown"
@@ -188,10 +188,10 @@ export function UserSettingsForm() {
188188
/>
189189

190190
<ToggleSwitch
191-
isToggled={enableIndexing}
191+
isToggled={!disableIndexing}
192192
onToggle={() =>
193193
handleUpdate({
194-
disableIndexing: !enableIndexing,
194+
disableIndexing: !disableIndexing,
195195
})
196196
}
197197
text="Enable Indexing"

gui/src/pages/gui/ToolCallDiv/ToolCall.tsx

+53-18
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/outline";
22
import { ToolCallDelta, ToolCallState } from "core";
33
import Mustache from "mustache";
4-
import { useMemo, useState } from "react";
4+
import { ReactNode, useMemo, useState } from "react";
55
import { ToolTip } from "../../../components/gui/Tooltip";
66
import { useAppSelector } from "../../../redux/hooks";
77

@@ -22,14 +22,59 @@ export function ToolCallDisplay(props: ToolCallDisplayProps) {
2222
);
2323
}, [availableTools, props.toolCall]);
2424

25-
const wouldLikeToMessage = useMemo(() => {
26-
if (!tool) return "";
25+
const statusMessage = useMemo(() => {
26+
if (!tool) return "Agent tool use";
2727

28-
const rendered = Mustache.render(
29-
tool.wouldLikeTo,
30-
props.toolCallState.parsedArgs,
28+
const defaultToolDescription = (
29+
<>
30+
<code>{tool.displayTitle ?? tool.function.name}</code> <span>tool</span>
31+
</>
32+
);
33+
34+
const futureMessage = tool.wouldLikeTo ? (
35+
Mustache.render(tool.wouldLikeTo, props.toolCallState.parsedArgs)
36+
) : (
37+
<>
38+
<span>use the</span> {defaultToolDescription}
39+
</>
40+
);
41+
42+
let intro = "";
43+
let message: ReactNode = "";
44+
45+
if (props.toolCallState.status === "generating") {
46+
intro = "is generating output to";
47+
message = futureMessage;
48+
} else if (props.toolCallState.status === "generated") {
49+
intro = "wants to";
50+
message = futureMessage;
51+
} else if (props.toolCallState.status === "calling") {
52+
intro = "is";
53+
message = tool.isCurrently ? (
54+
Mustache.render(tool.isCurrently, props.toolCallState.parsedArgs)
55+
) : (
56+
<>
57+
<span>using the</span> {defaultToolDescription}
58+
</>
59+
);
60+
} else if (props.toolCallState.status === "done") {
61+
intro = "";
62+
message = tool.hasAlready ? (
63+
Mustache.render(tool.hasAlready, props.toolCallState.parsedArgs)
64+
) : (
65+
<>
66+
<span>used the</span> {defaultToolDescription}
67+
</>
68+
);
69+
} else if (props.toolCallState.status === "canceled") {
70+
intro = "tried to";
71+
message = futureMessage;
72+
}
73+
return (
74+
<div className="block">
75+
<span>Continue</span> {intro} {message}
76+
</div>
3177
);
32-
return rendered.trim();
3378
}, [props.toolCallState, tool]);
3479

3580
const args: [string, any][] = useMemo(() => {
@@ -60,17 +105,7 @@ export function ToolCallDisplay(props: ToolCallDisplayProps) {
60105
{tool?.faviconUrl && (
61106
<img src={tool.faviconUrl} className="h-4 w-4 rounded-sm" />
62107
)}
63-
<div className="">
64-
Continue wants to{" "}
65-
{wouldLikeToMessage ? (
66-
<span>{wouldLikeToMessage}</span>
67-
) : (
68-
<>
69-
<span>use the</span> <code>{tool?.displayTitle}</code>{" "}
70-
<span>tool</span>
71-
</>
72-
)}
73-
</div>
108+
<div className="flex">{statusMessage}</div>
74109
</div>
75110
{!!args.length ? (
76111
<div

0 commit comments

Comments
 (0)