Step control icons and layout adjustment (#1909)

* fix: layout alignment, colors and update icons

* feat: add always show step controls on last step

---------

Co-authored-by: Nate Sesti <33237525+sestinj@users.noreply.github.com>
This commit is contained in:
Priyash 2024-08-06 05:11:02 +05:30 • committed by GitHub
parent 6fc8ccc6c5
commit 5cb5df26c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,10 +1,9 @@
import {
ArrowUturnLeftIcon,
BarsArrowDownIcon,
HandThumbDownIcon,
HandThumbUpIcon,
TrashIcon,
CubeIcon,
ArrowPathIcon,
} from "@heroicons/react/24/outline";
import { ChatHistoryItem } from "core";
import { stripImages } from "core/llm/images";
@ -15,7 +14,6 @@ import {
defaultBorderRadius,
lightGray,
vscBackground,
vscButtonBackground,
vscInputBackground,
} from "..";
import { IdeMessengerContext } from "../../context/IdeMessenger";
@ -123,103 +121,101 @@ function StepContainer(props: StepContainerProps) {
/>
)}
</ContentDiv>
{(isHovered || typeof feedback !== "undefined") && !active && (
<div
className="flex gap-1 absolute -bottom-2 right-0"
style={{
zIndex: 200,
color: lightGray,
fontSize: getFontSize() - 3,
}}
>
{props.modelTitle && (
<div className="flex items-center">
<CubeIcon className="w-3 h-4 mr-1 flex-shrink-0" />
{props.modelTitle}
<div
style={{
backgroundColor: vscButtonBackground,
borderColor: vscButtonBackground,
}}
className="w-px h-full ml-3 mr-1"
/>
</div>
)}
{truncatedEarly && (
<HeaderButtonWithText
text="Continue generation"
onClick={(e) => {
props.onContinueGeneration();
}}
>
<BarsArrowDownIcon
color={lightGray}
width="1.2em"
height="1.2em"
/>
</HeaderButtonWithText>
)}
<CopyButton
text={stripImages(props.item.message.content)}
color={lightGray}
/>
<HeaderButtonWithText
text="Regenerate"
onClick={(e) => {
props.onRetry();
{(props.isLast || isHovered || typeof feedback !== "undefined") &&
!active && (
<div
className="flex items-center gap-1 absolute -bottom-2 right-1"
style={{
zIndex: 200,
color: lightGray,
fontSize: getFontSize() - 3,
}}
>
<ArrowUturnLeftIcon
{props.subtext && (
<>
<div className="flex items-center">{props.subtext}</div>
<div
className="ml-2 mr-1"
style={{
width: "1px",
height: "20px",
backgroundColor: lightGray,
}}
></div>
</>
)}
{truncatedEarly && (
<HeaderButtonWithText
text="Continue generation"
onClick={(e) => {
props.onContinueGeneration();
}}
>
<BarsArrowDownIcon
color={lightGray}
width="1.2em"
height="1.2em"
/>
</HeaderButtonWithText>
)}
<CopyButton
text={stripImages(props.item.message.content)}
color={lightGray}
width="1.2em"
height="1.2em"
/>
</HeaderButtonWithText>
{feedback === false || (
<HeaderButtonWithText text="Helpful">
<HandThumbUpIcon
className={
"cursor-pointer hover:text-green-500" +
(feedback === true ? " text-green-500" : "")
}
width="1.2em"
height="1.2em"
color={lightGray}
onClick={() => {
sendFeedback(true);
}}
/>
</HeaderButtonWithText>
)}
{feedback === true || (
<HeaderButtonWithText text="Unhelpful">
<HandThumbDownIcon
className={
"cursor-pointer hover:text-red-500" +
(feedback === false ? " text-red-500" : "")
}
width="1.2em"
height="1.2em"
color={lightGray}
onClick={() => {
sendFeedback(false);
}}
/>
</HeaderButtonWithText>
)}
<HeaderButtonWithText text="Delete Message">
<TrashIcon
color={lightGray}
width="1.2em"
height="1.2em"
onClick={() => {
props.onDelete();
<HeaderButtonWithText
text="Regenerate"
onClick={(e) => {
props.onRetry();
}}
/>
</HeaderButtonWithText>
</div>
)}
>
<ArrowPathIcon color={lightGray} width="1.2em" height="1.2em" />
</HeaderButtonWithText>
{feedback === false || (
<HeaderButtonWithText text="Helpful">
<HandThumbUpIcon
className={
"cursor-pointer hover:text-green-500" +
(feedback === true ? " text-green-500" : "")
}
width="1.2em"
height="1.2em"
color={lightGray}
onClick={() => {
sendFeedback(true);
}}
/>
</HeaderButtonWithText>
)}
{feedback === true || (
<HeaderButtonWithText text="Unhelpful">
<HandThumbDownIcon
className={
"cursor-pointer hover:text-red-500" +
(feedback === false ? " text-red-500" : "")
}
width="1.2em"
height="1.2em"
color={lightGray}
onClick={() => {
sendFeedback(false);
}}
/>
</HeaderButtonWithText>
)}
<HeaderButtonWithText text="Delete Message">
<TrashIcon
color={lightGray}
width="1.2em"
height="1.2em"
onClick={() => {
props.onDelete();
}}
/>
</HeaderButtonWithText>
</div>
)}
</div>
</div>
);