chore: merge main
This commit is contained in:
parent
3682175b62
commit
bbfb126d5b
6 changed files with 71 additions and 28 deletions
|
|
@ -1,9 +1,13 @@
|
|||
import { AnimatedEllipsis } from "../../..";
|
||||
|
||||
export function GeneratingIndicator() {
|
||||
export function GeneratingIndicator({
|
||||
text = "Generating",
|
||||
}: {
|
||||
text?: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="text-description-muted text-xs">
|
||||
<span>Generating</span>
|
||||
<span>{text}</span>
|
||||
<AnimatedEllipsis />
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
import { useContext } from "react";
|
||||
import { IdeMessengerContext } from "../../../../context/IdeMessenger";
|
||||
import { getAltKeyLabel, getMetaKeyLabel } from "../../../../util";
|
||||
import { Container, StopButton } from "./components";
|
||||
import { GeneratingIndicator } from "./GeneratingIndicator";
|
||||
|
||||
export const IsApplyingToolbar = () => {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
const jetbrains = window.location.protocol === "jb-api:";
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<GeneratingIndicator text="Applying" />
|
||||
<StopButton
|
||||
className="text-description"
|
||||
onClick={() => {
|
||||
// Note that this will NOT stop generation but once apply is cancelled will show the Generating/cancel option
|
||||
// Apply is prioritized because it can be more catastrophic
|
||||
// Intentional to be more WYSIWYG for now
|
||||
ideMessenger.post("cancelApply", undefined);
|
||||
}}
|
||||
>
|
||||
{/* JetBrains overrides cmd+backspace, so we have to use another shortcut */}
|
||||
{jetbrains ? getAltKeyLabel() : getMetaKeyLabel()} ⌫ Cancel
|
||||
</StopButton>
|
||||
</Container>
|
||||
);
|
||||
};
|
||||
|
|
@ -10,6 +10,7 @@ import { isJetBrains } from "../../../../util";
|
|||
import { BlockSettingsTopToolbar } from "./BlockSettingsTopToolbar";
|
||||
import { EditOutcomeToolbar } from "./EditOutcomeToolbar";
|
||||
import { EditToolbar } from "./EditToolbar";
|
||||
import { IsApplyingToolbar } from "./IsApplyingToolbar";
|
||||
import { PendingApplyStatesToolbar } from "./PendingApplyStatesToolbar";
|
||||
import { PendingToolCallToolbar } from "./PendingToolCallToolbar";
|
||||
import { StreamingToolbar } from "./StreamingToolbar";
|
||||
|
|
@ -25,9 +26,15 @@ export function LumpToolbar() {
|
|||
const editApplyState = useAppSelector(
|
||||
(state) => state.editModeState.applyState,
|
||||
);
|
||||
const pendingApplyStates = useAppSelector(
|
||||
const applyStates = useAppSelector(
|
||||
(state) => state.session.codeBlockApplyStates.states,
|
||||
).filter((state) => state.status === "done");
|
||||
);
|
||||
|
||||
const pendingApplyStates = applyStates.filter(
|
||||
(state) => state.status === "done",
|
||||
);
|
||||
|
||||
const isApplying = applyStates.some((state) => state.status === "streaming");
|
||||
|
||||
useEffect(() => {
|
||||
if (toolCallState?.status !== "generated") {
|
||||
|
|
@ -55,6 +62,10 @@ export function LumpToolbar() {
|
|||
};
|
||||
}, [toolCallState]);
|
||||
|
||||
if (isApplying) {
|
||||
return <IsApplyingToolbar />;
|
||||
}
|
||||
|
||||
if (isInEdit) {
|
||||
if (editApplyState.status === "done") {
|
||||
return <EditOutcomeToolbar />;
|
||||
|
|
|
|||
|
|
@ -32,13 +32,13 @@ export function PendingToolCallToolbar() {
|
|||
|
||||
return (
|
||||
<Container>
|
||||
<div className="flex flex-row items-center pb-0.5 pr-1 text-xs text-gray-400">
|
||||
<div className="text-description flex flex-row items-center pb-0.5 pr-1 text-xs">
|
||||
<span className="hidden sm:flex">Pending tool call</span>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-2 pb-0.5">
|
||||
<StopButton
|
||||
className="text-gray-400"
|
||||
className="text-description"
|
||||
onClick={() => dispatch(cancelCurrentToolCall())}
|
||||
data-testid="reject-tool-call-button"
|
||||
>
|
||||
|
|
@ -47,7 +47,7 @@ export function PendingToolCallToolbar() {
|
|||
</StopButton>
|
||||
<EnterButton
|
||||
isPrimary={true}
|
||||
className="text-gray-400"
|
||||
className="text-description"
|
||||
onClick={() => dispatch(callCurrentTool())}
|
||||
data-testid="accept-tool-call-button"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -1,28 +1,9 @@
|
|||
import styled from "styled-components";
|
||||
import { useAppDispatch } from "../../../../redux/hooks";
|
||||
import { cancelStream } from "../../../../redux/thunks";
|
||||
import {
|
||||
getAltKeyLabel,
|
||||
getFontSize,
|
||||
getMetaKeyLabel,
|
||||
isJetBrains,
|
||||
} from "../../../../util";
|
||||
import { getAltKeyLabel, getMetaKeyLabel, isJetBrains } from "../../../../util";
|
||||
import { Container, StopButton } from "./components";
|
||||
import { GeneratingIndicator } from "./GeneratingIndicator";
|
||||
|
||||
const Container = styled.div`
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
`;
|
||||
|
||||
const StopButton = styled.div`
|
||||
font-size: ${getFontSize() - 3}px;
|
||||
padding: 2px;
|
||||
padding-right: 4px;
|
||||
cursor: pointer;
|
||||
`;
|
||||
|
||||
export function StreamingToolbar() {
|
||||
const dispatch = useAppDispatch();
|
||||
const jetbrains = isJetBrains();
|
||||
|
|
|
|||
18
gui/src/components/mainInput/Lump/LumpToolbar/components.ts
Normal file
18
gui/src/components/mainInput/Lump/LumpToolbar/components.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// TODO: Convert these to tailwind
|
||||
|
||||
import styled from "styled-components";
|
||||
import { getFontSize } from "../../../../util";
|
||||
|
||||
export const Container = styled.div`
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
`;
|
||||
|
||||
export const StopButton = styled.div`
|
||||
font-size: ${getFontSize() - 3}px;
|
||||
padding: 2px;
|
||||
padding-right: 4px;
|
||||
cursor: pointer;
|
||||
`;
|
||||
Loading…
Add table
Reference in a new issue