✨ Regenerate and copy buttons
This commit is contained in:
parent
c7bd822634
commit
90cc17989e
3 changed files with 28 additions and 3 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import {
|
||||
ArrowUturnLeftIcon,
|
||||
HandThumbDownIcon,
|
||||
HandThumbUpIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
|
|
@ -17,6 +18,7 @@ import { RootState } from "../../redux/store";
|
|||
import { getFontSize } from "../../util";
|
||||
import { postToIde } from "../../util/ide";
|
||||
import HeaderButtonWithText from "../HeaderButtonWithText";
|
||||
import { CopyButton } from "../markdown/CopyButton";
|
||||
import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview";
|
||||
|
||||
interface StepContainerProps {
|
||||
|
|
@ -98,11 +100,28 @@ function StepContainer(props: StepContainerProps) {
|
|||
showCodeBorder={true}
|
||||
/>
|
||||
</ContentDiv>
|
||||
<div className="h-2"></div>
|
||||
{(isHovered || typeof feedback !== "undefined") && !active && (
|
||||
<div
|
||||
className="flex items-center gap-2 right-2 absolute -bottom-3"
|
||||
className="flex items-center gap-2 right-2 absolute -bottom-1"
|
||||
style={{ zIndex: 200 }}
|
||||
>
|
||||
<CopyButton
|
||||
text={stripImages(props.item.message.content)}
|
||||
color={lightGray}
|
||||
/>
|
||||
<HeaderButtonWithText
|
||||
text="Regenerate"
|
||||
onClick={(e) => {
|
||||
props.onRetry();
|
||||
}}
|
||||
>
|
||||
<ArrowUturnLeftIcon
|
||||
color={lightGray}
|
||||
width="1.2em"
|
||||
height="1.2em"
|
||||
/>
|
||||
</HeaderButtonWithText>
|
||||
{feedback === false || (
|
||||
<HeaderButtonWithText text="Helpful">
|
||||
<HandThumbUpIcon
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import HeaderButtonWithText from "../HeaderButtonWithText";
|
|||
|
||||
interface CopyButtonProps {
|
||||
text: string | (() => string);
|
||||
color?: string;
|
||||
}
|
||||
|
||||
export function CopyButton(props: CopyButtonProps) {
|
||||
|
|
@ -26,7 +27,7 @@ export function CopyButton(props: CopyButtonProps) {
|
|||
{copied ? (
|
||||
<CheckIcon className="w-4 h-4 text-green-500" />
|
||||
) : (
|
||||
<ClipboardIcon className="w-4 h-4" />
|
||||
<ClipboardIcon className="w-4 h-4" color={props.color} />
|
||||
)}
|
||||
</HeaderButtonWithText>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -417,7 +417,12 @@ function GUI(props: GUIProps) {
|
|||
onUserInput={(input: string) => {}}
|
||||
item={item}
|
||||
onReverse={() => {}}
|
||||
onRetry={() => {}}
|
||||
onRetry={() => {
|
||||
streamResponse(
|
||||
state.history[index - 1].editorState,
|
||||
index - 1,
|
||||
);
|
||||
}}
|
||||
onDelete={() => {}}
|
||||
/>
|
||||
</TimelineItem>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue