Merge branch 'main' into dallin/apply-state
This commit is contained in:
commit
71aa9b07ff
25 changed files with 214 additions and 117 deletions
2
.github/workflows/jetbrains-release.yaml
vendored
2
.github/workflows/jetbrains-release.yaml
vendored
|
|
@ -481,7 +481,7 @@ jobs:
|
|||
|
||||
# Run Qodana inspections
|
||||
- name: Qodana - Code Inspection
|
||||
uses: JetBrains/qodana-action@v2024.3.2
|
||||
uses: JetBrains/qodana-action@v2025.1.0
|
||||
with:
|
||||
cache-default-branch-only: true
|
||||
|
||||
|
|
|
|||
|
|
@ -739,19 +739,16 @@ export class Core {
|
|||
|
||||
private async isItemTooBig(item: ContextItemWithId) {
|
||||
const { config } = await this.configHandler.loadConfig();
|
||||
|
||||
if (!config) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const llm = (await this.configHandler.loadConfig()).config
|
||||
?.selectedModelByRole.chat;
|
||||
|
||||
|
||||
const llm = config?.selectedModelByRole.chat;
|
||||
if (!llm) {
|
||||
throw new Error("No chat model selected");
|
||||
}
|
||||
|
||||
const tokens = countTokens(item.content);
|
||||
const tokens = countTokens(item.content, llm.model);
|
||||
|
||||
if (tokens > llm.contextLength - llm.completionOptions!.maxTokens!) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
|
|||
|
||||
export interface EditToolArgs {
|
||||
filepath: string;
|
||||
new_contents: string;
|
||||
changes: string;
|
||||
}
|
||||
|
||||
export const editFileTool: Tool = {
|
||||
|
|
@ -20,16 +20,17 @@ export const editFileTool: Tool = {
|
|||
"Use this tool to edit an existing file. If you don't know the contents of the file, read it first.",
|
||||
parameters: {
|
||||
type: "object",
|
||||
required: ["filepath", "new_contents"],
|
||||
required: ["filepath", "changes"],
|
||||
properties: {
|
||||
filepath: {
|
||||
type: "string",
|
||||
description:
|
||||
"The path of the file to edit, relative to the root of the workspace.",
|
||||
},
|
||||
new_contents: {
|
||||
changes: {
|
||||
type: "string",
|
||||
description: "The new file contents",
|
||||
description:
|
||||
"Any modifications to the file, showing only needed changes. Do NOT wrap this in a codeblock. Use brief language-appropriate placeholders for large unmodified sections, e.g. '// ... rest of code here ...'",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ In Continue, these models are used for normal [Chat](../../chat/how-to-use-it.md
|
|||
|
||||
For the best overall Chat experience, you will want to use a 400B+ parameter model or one of the frontier models.
|
||||
|
||||
### Claude Sonnet 3.5 from Anthropic
|
||||
### Claude Sonnet 3.7 from Anthropic
|
||||
|
||||
Our current top recommendation is Claude 3.7 Sonnet from [Anthropic](../model-providers/top-level/anthropic.mdx).
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ const sidebars = {
|
|||
{
|
||||
type: "category",
|
||||
label: "Model providers",
|
||||
collapsed: false,
|
||||
link: {
|
||||
slug: "/customize/model-providers",
|
||||
type: "generated-index",
|
||||
|
|
|
|||
4
extensions/vscode/package-lock.json
generated
4
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "1.1.25",
|
||||
"version": "1.1.26",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "1.1.25",
|
||||
"version": "1.1.26",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/fetch": "^1.0.3",
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ const AtMentionDropdown = forwardRef((props: AtMentionDropdownProps, ref) => {
|
|||
modal: true,
|
||||
detail:
|
||||
fileSize > 0
|
||||
? `'${item.title}' is ${formatFileSize(fileSize)} which exceeds the allowed context length and connot be processed by the model`
|
||||
? `'${item.title}' is ${formatFileSize(fileSize)} which exceeds the allowed context length and cannot be processed by the model`
|
||||
: `'${item.title}' could not be loaded. Please check if the file exists and has the correct permissions.`,
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -9,15 +9,21 @@ import {
|
|||
Squares2X2Icon,
|
||||
WrenchScrewdriverIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { ReactNode } from "react";
|
||||
import { vscBadgeForeground } from "../..";
|
||||
import { useAppSelector } from "../../../redux/hooks";
|
||||
import { fontSize } from "../../../util";
|
||||
import { ToolTip } from "../../gui/Tooltip";
|
||||
import AssistantSelect from "../../modelSelection/platform/AssistantSelect";
|
||||
import HoverItem from "../InputToolbar/HoverItem";
|
||||
import { useLump } from "./LumpContext";
|
||||
import { ErrorsSectionTooltip } from "./sections/errors/ErrorsSectionTooltip";
|
||||
import { McpSectionTooltip } from "./sections/mcp/MCPTooltip";
|
||||
import { ToolsSectionTooltip } from "./sections/tool-policies/ToolPoliciesSectionTooltip";
|
||||
|
||||
interface BlockSettingsToolbarIcon {
|
||||
tooltip: string;
|
||||
title: string;
|
||||
tooltip: ReactNode;
|
||||
icon: React.ComponentType<any>;
|
||||
itemCount?: number;
|
||||
onClick: () => void;
|
||||
|
|
@ -27,18 +33,39 @@ interface BlockSettingsToolbarIcon {
|
|||
|
||||
interface Section {
|
||||
id: string;
|
||||
tooltip: string;
|
||||
title: string;
|
||||
tooltip: ReactNode;
|
||||
icon: React.ComponentType<any>;
|
||||
}
|
||||
|
||||
const sections: Section[] = [
|
||||
{ id: "models", tooltip: "Models", icon: CubeIcon },
|
||||
{ id: "rules", tooltip: "Rules", icon: PencilIcon },
|
||||
{ id: "docs", tooltip: "Docs", icon: BookOpenIcon },
|
||||
{ id: "prompts", tooltip: "Prompts", icon: ChatBubbleLeftIcon },
|
||||
{ id: "tools", tooltip: "Tools", icon: WrenchScrewdriverIcon },
|
||||
{ id: "mcp", tooltip: "MCP", icon: Squares2X2Icon },
|
||||
{ id: "error", tooltip: "Errors", icon: ExclamationTriangleIcon },
|
||||
{ id: "models", title: "Models", tooltip: "Models", icon: CubeIcon },
|
||||
{ id: "rules", title: "Rules", tooltip: "Rules", icon: PencilIcon },
|
||||
{ id: "docs", title: "Docs", tooltip: "Docs", icon: BookOpenIcon },
|
||||
{
|
||||
id: "prompts",
|
||||
title: "Prompts",
|
||||
tooltip: "Prompts",
|
||||
icon: ChatBubbleLeftIcon,
|
||||
},
|
||||
{
|
||||
id: "tools",
|
||||
title: "Tools",
|
||||
tooltip: <ToolsSectionTooltip />,
|
||||
icon: WrenchScrewdriverIcon,
|
||||
},
|
||||
{
|
||||
id: "mcp",
|
||||
title: "MCP",
|
||||
tooltip: <McpSectionTooltip />,
|
||||
icon: Squares2X2Icon,
|
||||
},
|
||||
{
|
||||
id: "error",
|
||||
title: "Errors",
|
||||
tooltip: <ErrorsSectionTooltip />,
|
||||
icon: ExclamationTriangleIcon,
|
||||
},
|
||||
];
|
||||
|
||||
function BlockSettingsToolbarIcon(
|
||||
|
|
@ -46,53 +73,60 @@ function BlockSettingsToolbarIcon(
|
|||
) {
|
||||
const isErrorSection = props.sectionId === "error";
|
||||
|
||||
const id = `block-settings-toolbar-icon-${props.sectionId}`;
|
||||
return (
|
||||
<HoverItem
|
||||
px={0}
|
||||
onClick={props.onClick}
|
||||
data-testid={`block-settings-toolbar-icon-${props.sectionId}`}
|
||||
>
|
||||
<div
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
e.preventDefault();
|
||||
props.onClick();
|
||||
}
|
||||
}}
|
||||
className={`${
|
||||
props.isSelected
|
||||
? isErrorSection
|
||||
? "bg-red-600"
|
||||
: "bg-badge"
|
||||
: undefined
|
||||
} relative flex select-none items-center rounded-full px-1 transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/50 ${props.className || ""}`}
|
||||
<>
|
||||
<HoverItem
|
||||
px={0}
|
||||
onClick={props.onClick}
|
||||
data-testid={id}
|
||||
data-tooltip-id={id}
|
||||
>
|
||||
<props.icon
|
||||
className={`h-[13px] w-[13px] flex-shrink-0 hover:brightness-125 ${
|
||||
isErrorSection ? "text-red-600" : ""
|
||||
}`}
|
||||
style={{
|
||||
color: props.isSelected ? vscBadgeForeground : undefined,
|
||||
}}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<div
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
className={`overflow-hidden transition-all duration-200 ${
|
||||
props.isSelected ? "ml-1 w-auto opacity-100" : "w-0 opacity-0"
|
||||
}`}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
e.preventDefault();
|
||||
props.onClick();
|
||||
}
|
||||
}}
|
||||
className={`${
|
||||
props.isSelected
|
||||
? isErrorSection
|
||||
? "bg-red-600"
|
||||
: "bg-badge"
|
||||
: undefined
|
||||
} relative flex select-none items-center rounded-full px-1 transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/50 ${props.className || ""}`}
|
||||
>
|
||||
<span
|
||||
className="whitespace-nowrap"
|
||||
style={{ color: vscBadgeForeground }}
|
||||
<props.icon
|
||||
className={`h-[13px] w-[13px] flex-shrink-0 hover:brightness-125 ${
|
||||
isErrorSection ? "text-red-600" : ""
|
||||
}`}
|
||||
style={{
|
||||
color: props.isSelected ? vscBadgeForeground : undefined,
|
||||
}}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<div
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
className={`overflow-hidden transition-all duration-200 ${
|
||||
props.isSelected ? "ml-1 w-auto opacity-100" : "w-0 opacity-0"
|
||||
}`}
|
||||
>
|
||||
{props.tooltip}
|
||||
</span>
|
||||
<span
|
||||
className="whitespace-nowrap"
|
||||
style={{ color: vscBadgeForeground }}
|
||||
>
|
||||
{props.title}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</HoverItem>
|
||||
</HoverItem>
|
||||
<ToolTip delayShow={700} id={id}>
|
||||
{props.tooltip}
|
||||
</ToolTip>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -129,6 +163,7 @@ export function BlockSettingsTopToolbar() {
|
|||
tooltip={
|
||||
isToolbarExpanded ? "Collapse sections" : "Expand sections"
|
||||
}
|
||||
title=""
|
||||
isSelected={false}
|
||||
onClick={handleEllipsisClick}
|
||||
/>
|
||||
|
|
@ -142,6 +177,7 @@ export function BlockSettingsTopToolbar() {
|
|||
sectionId={section.id}
|
||||
icon={section.icon}
|
||||
tooltip={section.tooltip}
|
||||
title={section.title}
|
||||
isSelected={selectedSection === section.id}
|
||||
onClick={() =>
|
||||
setSelectedSection(
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
import MCPServersPreview from "../../../../pages/config/MCPServersPreview";
|
||||
|
||||
export function MCPSection() {
|
||||
return <MCPServersPreview />;
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import { useLump } from "../LumpContext";
|
||||
import { ContextSection } from "./ContextSection";
|
||||
import DocsSection from "./docs/DocsSection";
|
||||
import { ErrorSection } from "./ErrorSection";
|
||||
import { MCPSection } from "./MCPSection";
|
||||
import { ErrorSection } from "./errors/ErrorSection";
|
||||
import MCPSection from "./mcp/MCPSection";
|
||||
import { ModelsSection } from "./ModelsSection";
|
||||
import { PromptsSection } from "./PromptsSection";
|
||||
import { RulesSection } from "./RulesSection";
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import {
|
|||
ExclamationCircleIcon,
|
||||
ExclamationTriangleIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useAppSelector } from "../../../../redux/hooks";
|
||||
import { useAppSelector } from "../../../../../redux/hooks";
|
||||
|
||||
export function ErrorSection() {
|
||||
const configError = useAppSelector((state) => state.config.configError);
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
import { useAppSelector } from "../../../../../redux/hooks";
|
||||
|
||||
export const ErrorsSectionTooltip = () => {
|
||||
const configError = useAppSelector((store) => store.config.configError);
|
||||
|
||||
const numErrors = configError?.length ?? 0;
|
||||
const plural = numErrors > 1 ? "s" : "";
|
||||
|
||||
return (
|
||||
<div>
|
||||
<span>{`${numErrors} Config Error${plural}`}</span>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
@ -8,14 +8,14 @@ import {
|
|||
} from "@heroicons/react/24/outline";
|
||||
import { MCPServerStatus } from "core";
|
||||
import { useContext, useMemo } from "react";
|
||||
import { ToolTip } from "../../components/gui/Tooltip";
|
||||
import EditBlockButton from "../../components/mainInput/Lump/EditBlockButton";
|
||||
import { ExploreBlocksButton } from "../../components/mainInput/Lump/sections/ExploreBlocksButton";
|
||||
import { useAuth } from "../../context/Auth";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
|
||||
import { updateConfig } from "../../redux/slices/configSlice";
|
||||
import { fontSize } from "../../util";
|
||||
import { useAuth } from "../../../../../context/Auth";
|
||||
import { IdeMessengerContext } from "../../../../../context/IdeMessenger";
|
||||
import { useAppDispatch, useAppSelector } from "../../../../../redux/hooks";
|
||||
import { updateConfig } from "../../../../../redux/slices/configSlice";
|
||||
import { fontSize } from "../../../../../util";
|
||||
import { ToolTip } from "../../../../gui/Tooltip";
|
||||
import EditBlockButton from "../../EditBlockButton";
|
||||
import { ExploreBlocksButton } from "../ExploreBlocksButton";
|
||||
|
||||
interface MCPServerStatusProps {
|
||||
server: MCPServerStatus;
|
||||
|
|
@ -154,7 +154,7 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) {
|
|||
);
|
||||
}
|
||||
|
||||
function MCPServersPreview() {
|
||||
function MCPSection() {
|
||||
const servers = useAppSelector(
|
||||
(store) => store.config.config.mcpServerStatuses,
|
||||
);
|
||||
|
|
@ -186,4 +186,4 @@ function MCPServersPreview() {
|
|||
);
|
||||
}
|
||||
|
||||
export default MCPServersPreview;
|
||||
export default MCPSection;
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
import { useAppSelector } from "../../../../../redux/hooks";
|
||||
|
||||
export const McpSectionTooltip = () => {
|
||||
const mcpServers = useAppSelector(
|
||||
(store) => store.config.config.mcpServerStatuses,
|
||||
);
|
||||
|
||||
const numServers = mcpServers.length;
|
||||
const numActiveServers = mcpServers.filter(
|
||||
(server) => server.status === "connected",
|
||||
).length;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<span>{`MCP Servers (${numActiveServers}/${numServers} active)`}</span>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
import { useAppSelector } from "../../../../../redux/hooks";
|
||||
import { selectActiveTools } from "../../../../../redux/selectors/selectActiveTools";
|
||||
|
||||
export const ToolsSectionTooltip = () => {
|
||||
const tools = useAppSelector((store) => store.config.config.tools);
|
||||
const activeTools = useAppSelector(selectActiveTools);
|
||||
|
||||
const numTools = tools.length;
|
||||
const numActiveTools = activeTools.length;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<span>{`Tools (${numActiveTools}/${numTools} active)`}</span>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
@ -146,8 +146,9 @@ function ModelSelect() {
|
|||
|
||||
// Sort so that options without an API key are at the end
|
||||
useEffect(() => {
|
||||
const enabledOptions = options.filter((option) => option.apiKey !== "");
|
||||
const disabledOptions = options.filter((option) => option.apiKey === "");
|
||||
const alphaSort = options.sort((a, b) => a.title.localeCompare(b.title));
|
||||
const enabledOptions = alphaSort.filter((option) => option.apiKey !== "");
|
||||
const disabledOptions = alphaSort.filter((option) => option.apiKey === "");
|
||||
|
||||
const sorted = [...enabledOptions, ...disabledOptions];
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ const ListboxOptions = React.forwardRef<HTMLUListElement, ListboxOptionsProps>(
|
|||
border: `1px solid ${vscCommandCenterInactiveBorder}`,
|
||||
fontSize,
|
||||
borderRadius: defaultBorderRadius,
|
||||
zIndex: 1000,
|
||||
zIndex: 200000,
|
||||
...props.style,
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ const ModelRoleSelector = ({
|
|||
style={{ borderRadius: defaultBorderRadius }}
|
||||
className="min-w-40"
|
||||
>
|
||||
{models.map((option, idx) => {
|
||||
{[...models].sort((a,b)=>a.title.localeCompare(b.title)).map((option, idx) => {
|
||||
const showMissingApiKeyMsg =
|
||||
option.configurationStatus ===
|
||||
LLMConfigurationStatuses.MISSING_API_KEY;
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ import {
|
|||
|
||||
type EditToolCallProps = {
|
||||
relativeFilePath: string;
|
||||
newContents: string;
|
||||
changes: string;
|
||||
toolCallId?: string;
|
||||
historyIndex: number;
|
||||
};
|
||||
|
||||
export function EditFile(props: EditToolCallProps) {
|
||||
const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath ?? "test.txt")} ${props.relativeFilePath}\n${props.newContents ?? ""}\n\`\`\``;
|
||||
const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath ?? "test.txt")} ${props.relativeFilePath}\n${props.changes ?? ""}\n\`\`\``;
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
const isStreaming = useAppSelector((state) => state.session.isStreaming);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ function FunctionSpecificToolCallDiv({
|
|||
return (
|
||||
<EditFile
|
||||
relativeFilePath={args.filepath}
|
||||
newContents={args.new_contents}
|
||||
changes={args.changes}
|
||||
toolCallId={toolCall.id}
|
||||
historyIndex={historyIndex}
|
||||
/>
|
||||
|
|
|
|||
22
gui/src/redux/selectors/selectActiveTools.ts
Normal file
22
gui/src/redux/selectors/selectActiveTools.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { createSelector } from "@reduxjs/toolkit";
|
||||
import { Tool } from "core";
|
||||
import { RootState } from "../store";
|
||||
|
||||
export const selectActiveTools = createSelector(
|
||||
[
|
||||
(store: RootState) => store.session.mode,
|
||||
(store: RootState) => store.config.config.tools,
|
||||
(store: RootState) => store.ui.toolSettings,
|
||||
(store: RootState) => store.ui.toolGroupSettings,
|
||||
],
|
||||
(mode, tools, policies, groupPolicies): Tool[] => {
|
||||
if (mode !== "agent") {
|
||||
return [];
|
||||
}
|
||||
return tools.filter(
|
||||
(tool) =>
|
||||
policies[tool.function.name] !== "disabled" &&
|
||||
groupPolicies[tool.group] !== "exclude",
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
@ -744,9 +744,6 @@ export const sessionSlice = createSlice({
|
|||
selectHasCodeToEdit: (state) => {
|
||||
return state.codeToEdit.length > 0;
|
||||
},
|
||||
selectUseTools: (state) => {
|
||||
return state.mode === "agent";
|
||||
},
|
||||
},
|
||||
extraReducers: (builder) => {
|
||||
addPassthroughCases(builder, [streamResponseThunk]);
|
||||
|
|
@ -838,7 +835,6 @@ export const {
|
|||
selectCurrentMode,
|
||||
selectIsSingleRangeEditOrInsertion,
|
||||
selectHasCodeToEdit,
|
||||
selectUseTools,
|
||||
} = sessionSlice.selectors;
|
||||
|
||||
export default sessionSlice.reducer;
|
||||
|
|
|
|||
|
|
@ -7,12 +7,15 @@ import {
|
|||
} from "../../components/OnboardingCard";
|
||||
import { getLocalStorage, LocalStorageKey } from "../../util/localStorage";
|
||||
|
||||
type ToolSetting =
|
||||
export type ToolPolicy =
|
||||
| "allowedWithPermission"
|
||||
| "allowedWithoutPermission"
|
||||
| "disabled";
|
||||
|
||||
type ToolGroupSetting = "include" | "exclude";
|
||||
export type ToolGroupPolicy = "include" | "exclude";
|
||||
|
||||
export type ToolPolicies = { [toolName: string]: ToolPolicy };
|
||||
export type ToolGroupPolicies = { [toolGroupName: string]: ToolGroupPolicy };
|
||||
|
||||
type UIState = {
|
||||
showDialog: boolean;
|
||||
|
|
@ -22,12 +25,12 @@ type UIState = {
|
|||
isExploreDialogOpen: boolean;
|
||||
hasDismissedExploreDialog: boolean;
|
||||
shouldAddFileForEditing: boolean;
|
||||
toolSettings: { [toolName: string]: ToolSetting };
|
||||
toolGroupSettings: { [toolGroupName: string]: ToolGroupSetting };
|
||||
toolSettings: ToolPolicies;
|
||||
toolGroupSettings: ToolGroupPolicies;
|
||||
ttsActive: boolean;
|
||||
};
|
||||
|
||||
export const DEFAULT_TOOL_SETTING: ToolSetting = "allowedWithPermission";
|
||||
export const DEFAULT_TOOL_SETTING: ToolPolicy = "allowedWithPermission";
|
||||
|
||||
export const uiSlice = createSlice({
|
||||
name: "ui",
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit";
|
||||
import { ChatMessage } from "core";
|
||||
import { ChatMessage, LLMFullCompletionOptions } from "core";
|
||||
import { modelSupportsTools } from "core/llm/autodetect";
|
||||
import { ToCoreProtocol } from "core/protocol";
|
||||
import { selectActiveTools } from "../selectors/selectActiveTools";
|
||||
import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall";
|
||||
import { selectSelectedChatModel } from "../slices/configSlice";
|
||||
import {
|
||||
abortStream,
|
||||
addPromptCompletionPair,
|
||||
selectUseTools,
|
||||
setToolGenerated,
|
||||
streamUpdate,
|
||||
} from "../slices/sessionSlice";
|
||||
|
|
@ -31,27 +31,24 @@ export const streamNormalInput = createAsyncThunk<
|
|||
const state = getState();
|
||||
const selectedChatModel = selectSelectedChatModel(state);
|
||||
|
||||
const toolSettings = state.ui.toolSettings;
|
||||
const toolGroupSettings = state.ui.toolGroupSettings;
|
||||
const streamAborter = state.session.streamAborter;
|
||||
const useTools = selectUseTools(state);
|
||||
if (!selectedChatModel) {
|
||||
throw new Error("Default model not defined");
|
||||
}
|
||||
const includeTools = useTools && modelSupportsTools(selectedChatModel);
|
||||
|
||||
let completionOptions: LLMFullCompletionOptions = {};
|
||||
const activeTools = selectActiveTools(state);
|
||||
const toolsSupported = modelSupportsTools(selectedChatModel);
|
||||
if (toolsSupported && activeTools.length > 0) {
|
||||
completionOptions = {
|
||||
tools: activeTools,
|
||||
};
|
||||
}
|
||||
|
||||
// Send request
|
||||
const gen = extra.ideMessenger.llmStreamChat(
|
||||
{
|
||||
completionOptions: includeTools
|
||||
? {
|
||||
tools: state.config.config.tools.filter(
|
||||
(tool) =>
|
||||
toolSettings[tool.function.name] !== "disabled" &&
|
||||
toolGroupSettings[tool.group] !== "exclude",
|
||||
),
|
||||
}
|
||||
: {},
|
||||
completionOptions,
|
||||
title: selectedChatModel.title,
|
||||
messages,
|
||||
legacySlashCommandData,
|
||||
|
|
@ -105,7 +102,9 @@ export const streamNormalInput = createAsyncThunk<
|
|||
}
|
||||
|
||||
// If it's a tool call that is automatically accepted, we should call it
|
||||
const toolCallState = selectCurrentToolCall(getState());
|
||||
const newState = getState();
|
||||
const toolSettings = newState.ui.toolSettings;
|
||||
const toolCallState = selectCurrentToolCall(newState);
|
||||
if (toolCallState) {
|
||||
dispatch(
|
||||
setToolGenerated({
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export const editToolImpl: ClientToolImpl = async (
|
|||
}
|
||||
const apply = await extras.ideMessenger.request("applyToFile", {
|
||||
streamId: extras.streamId,
|
||||
text: args.new_contents,
|
||||
text: args.changes,
|
||||
toolCallId,
|
||||
filepath: firstUriMatch,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue