continue conversation after auto apply and add warning to user setting
This commit is contained in:
parent
4a481d33fd
commit
f54f3ec528
4 changed files with 60 additions and 25 deletions
|
|
@ -34,7 +34,7 @@ const NumberInput: React.FC<NumberInputProps> = ({
|
|||
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const newInputValue = e.target.value;
|
||||
setInputValue(newInputValue);
|
||||
|
||||
|
||||
// Only update the actual value if it's a valid number
|
||||
const numValue = parseInt(newInputValue, 10);
|
||||
if (!isNaN(numValue)) {
|
||||
|
|
@ -63,10 +63,12 @@ const NumberInput: React.FC<NumberInputProps> = ({
|
|||
WebkitAppearance: "none",
|
||||
MozAppearance: "none",
|
||||
}}
|
||||
min={min}
|
||||
max={max}
|
||||
/>
|
||||
<div className="flex flex-col">
|
||||
<button
|
||||
style={{ fontSize: "10px" }}
|
||||
style={{ fontSize: "9px" }}
|
||||
onClick={handleIncrement}
|
||||
disabled={value >= max}
|
||||
className="text-vsc-foreground m-0 mb-0.5 cursor-pointer border-none bg-inherit px-1.5 py-0 hover:opacity-80"
|
||||
|
|
@ -74,7 +76,7 @@ const NumberInput: React.FC<NumberInputProps> = ({
|
|||
▲
|
||||
</button>
|
||||
<button
|
||||
style={{ fontSize: "10px" }}
|
||||
style={{ fontSize: "9px" }}
|
||||
className="text-vsc-foreground m-0 mb-0.5 cursor-pointer border-none bg-inherit px-1.5 py-0 hover:opacity-80"
|
||||
onClick={handleDecrement}
|
||||
disabled={value <= min}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
|
||||
import React from "react";
|
||||
import { vscButtonBackground } from "..";
|
||||
import { ToolTip } from "./Tooltip";
|
||||
|
||||
type ToggleSwitchProps = {
|
||||
isToggled: boolean;
|
||||
onToggle: () => void;
|
||||
text: string;
|
||||
size?: number;
|
||||
onWarningText?: string;
|
||||
};
|
||||
|
||||
const ToggleSwitch: React.FC<ToggleSwitchProps> = ({
|
||||
|
|
@ -13,11 +16,25 @@ const ToggleSwitch: React.FC<ToggleSwitchProps> = ({
|
|||
onToggle,
|
||||
text,
|
||||
size = 16,
|
||||
onWarningText,
|
||||
}) => {
|
||||
return (
|
||||
<div className="flex cursor-pointer select-none items-center justify-between gap-3">
|
||||
<span className="truncate-right">{text}</span>
|
||||
<div>
|
||||
<div className="flex flex-row items-center gap-1">
|
||||
{isToggled && !!onWarningText && (
|
||||
<>
|
||||
<ExclamationTriangleIcon
|
||||
data-tooltip-id={`${text}-warning-tooltip`}
|
||||
className="text-yellow-500"
|
||||
style={{
|
||||
height: size,
|
||||
width: size,
|
||||
}}
|
||||
/>
|
||||
<ToolTip id={`${text}-warning-tooltip`}>{onWarningText}</ToolTip>
|
||||
</>
|
||||
)}
|
||||
<div
|
||||
className={`border-vsc-input-border bg-vsc-input-background flex items-center rounded-full border border-solid`}
|
||||
onClick={onToggle}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,11 @@ import { Input } from "../../components";
|
|||
import NumberInput from "../../components/gui/NumberInput";
|
||||
import { Select } from "../../components/gui/Select";
|
||||
import ToggleSwitch from "../../components/gui/Switch";
|
||||
import { useFontSize } from "../../components/ui/font";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
|
||||
import { updateConfig } from "../../redux/slices/configSlice";
|
||||
import { getFontSize } from "../../util";
|
||||
import { setLocalStorage } from "../../util/localStorage";
|
||||
|
||||
export function UserSettingsForm() {
|
||||
/////// User settings section //////
|
||||
|
|
@ -80,7 +81,7 @@ export function UserSettingsForm() {
|
|||
config.tabAutocompleteOptions?.multilineCompletions ?? "auto";
|
||||
const modelTimeout = config.tabAutocompleteOptions?.modelTimeout ?? 150;
|
||||
const debounceDelay = config.tabAutocompleteOptions?.debounceDelay ?? 250;
|
||||
const fontSize = getFontSize();
|
||||
const fontSize = useFontSize();
|
||||
|
||||
const cancelChangeDisableAutocomplete = () => {
|
||||
setFormDisableAutocomplete(disableAutocompleteInFiles);
|
||||
|
|
@ -163,15 +164,21 @@ export function UserSettingsForm() {
|
|||
}
|
||||
text="Text-to-Speech Output"
|
||||
/>
|
||||
<ToggleSwitch
|
||||
isToggled={autoAcceptEditToolDiffs}
|
||||
onToggle={() =>
|
||||
handleUpdate({
|
||||
autoAcceptEditToolDiffs: !autoAcceptEditToolDiffs,
|
||||
})
|
||||
}
|
||||
text="Auto-Accept Agent Edits"
|
||||
/>
|
||||
|
||||
<div className="flex flex-col gap-1">
|
||||
<ToggleSwitch
|
||||
isToggled={autoAcceptEditToolDiffs}
|
||||
onToggle={() =>
|
||||
handleUpdate({
|
||||
autoAcceptEditToolDiffs: !autoAcceptEditToolDiffs,
|
||||
})
|
||||
}
|
||||
text="Auto-Accept Agent Edits"
|
||||
onWarningText={
|
||||
"Be very careful with this setting. When turned on, Agent mode's edit tool can make changes to files with no manual review or guaranteed stopping point"
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
{/* <ToggleSwitch
|
||||
isToggled={useChromiumForDocsCrawling}
|
||||
onToggle={() =>
|
||||
|
|
@ -234,11 +241,12 @@ export function UserSettingsForm() {
|
|||
<span className="text-left">Font Size</span>
|
||||
<NumberInput
|
||||
value={fontSize}
|
||||
onChange={(val) =>
|
||||
onChange={(val) => {
|
||||
setLocalStorage("fontSize", val);
|
||||
handleUpdate({
|
||||
fontSize: val,
|
||||
})
|
||||
}
|
||||
});
|
||||
}}
|
||||
min={7}
|
||||
max={50}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -26,15 +26,23 @@ export const editToolImpl: ClientToolImpl = async (
|
|||
throw new Error(apply.error);
|
||||
}
|
||||
const state = extras.getState();
|
||||
if (state.config.config.ui?.autoAcceptEditToolDiffs) {
|
||||
await extras.ideMessenger.request("acceptDiff", {
|
||||
const autoAccept = !!state.config.config.ui?.autoAcceptEditToolDiffs;
|
||||
if (autoAccept) {
|
||||
const out = await extras.ideMessenger.request("acceptDiff", {
|
||||
streamId: extras.streamId,
|
||||
filepath: firstUriMatch,
|
||||
});
|
||||
if (out.status === "error") {
|
||||
throw new Error(out.error);
|
||||
}
|
||||
return {
|
||||
respondImmediately: true,
|
||||
output: undefined, // TODO - feed edit results back to model (also in parallel listeners)
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
respondImmediately: false,
|
||||
output: undefined, // No immediate output.
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
respondImmediately: false,
|
||||
output: undefined, // No immediate output.
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue