modified assistant indicator in UI

This commit is contained in:
Nate Sesti 2024-07-22 22:10:13 -07:00
parent 0fa0c3bcbd
commit b46706af56
2 changed files with 94 additions and 104 deletions

View file

@ -35,6 +35,7 @@ interface StepContainerProps {
isFirst: boolean;
isLast: boolean;
index: number;
subtext?: string;
}
// #region styled components
@ -141,82 +142,90 @@ function StepContainer(props: StepContainerProps) {
</ContentDiv>
{(isHovered || typeof feedback !== "undefined") && !active && (
<div
className="flex items-center gap-2 right-2 absolute -bottom-1"
className="flex items-center justify-between absolute -bottom-2 w-full"
style={{ zIndex: 200 }}
>
{truncatedEarly && (
<div
className="pl-2"
style={{ color: lightGray, fontSize: getFontSize() - 3 }}
>
{props.subtext ?? ""}
</div>
<div className="flex items-center gap-2 pr-2">
{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="Continue generation"
text="Regenerate"
onClick={(e) => {
props.onContinueGeneration();
props.onRetry();
}}
>
<BarsArrowDownIcon
<ArrowUturnLeftIcon
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();
}}
>
<ArrowUturnLeftIcon
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" : "")
}
{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"
color={lightGray}
onClick={() => {
sendFeedback(true);
props.onDelete();
}}
/>
</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>

View file

@ -3,7 +3,6 @@ import {
ChatBubbleOvalLeftIcon,
CodeBracketSquareIcon,
ExclamationTriangleIcon,
SparklesIcon,
} from "@heroicons/react/24/outline";
import { JSONContent } from "@tiptap/react";
import { InputModifiers } from "core";
@ -40,9 +39,9 @@ import { useWebviewListener } from "../hooks/useWebviewListener";
import { defaultModelSelector } from "../redux/selectors/modelSelectors";
import {
clearLastResponse,
deleteMessage,
newSession,
setInactive,
deleteMessage,
} from "../redux/slices/stateSlice";
import {
setDialogEntryOn,
@ -58,7 +57,6 @@ import {
} from "../util";
import { FREE_TRIAL_LIMIT_REQUESTS } from "../util/freeTrial";
import { getLocalStorage, setLocalStorage } from "../util/localStorage";
import Logo from "../components/Logo";
const TopGuiDiv = styled.div`
overflow-y: scroll;
@ -142,9 +140,11 @@ const ThreadHead = styled.div`
margin: 18px 6px 0 6px;
`;
const THREAD_AVATAR_SIZE = 15;
const ThreadAvatar = styled.div`
width: 32px;
height: 32px;
width: 24px;
height: 24px;
border-radius: 50%;
background-color: rgba(248, 248, 248, 0.75);
color: #000;
@ -399,47 +399,22 @@ function GUI() {
}}
>
{item.message.role === "user" ? (
<div className="thread-message">
<ThreadHead>
<ThreadAvatar>
<Logo height={19} width={19} />
</ThreadAvatar>
<div>
<ThreadUserTitle>Continue</ThreadUserTitle>
<ThreadUserName>User</ThreadUserName>
</div>
</ThreadHead>
<ContinueInputBox
onEnter={async (editorState, modifiers) => {
streamResponse(
editorState,
modifiers,
ideMessenger,
index,
);
}}
isLastUserInput={isLastUserInput(index)}
isMainInput={false}
editorState={item.editorState}
contextItems={item.contextItems}
></ContinueInputBox>
</div>
<ContinueInputBox
onEnter={async (editorState, modifiers) => {
streamResponse(
editorState,
modifiers,
ideMessenger,
index,
);
}}
isLastUserInput={isLastUserInput(index)}
isMainInput={false}
editorState={item.editorState}
contextItems={item.contextItems}
></ContinueInputBox>
) : (
<div className="thread-message">
<ThreadHead>
<ThreadAvatar>
<SparklesIcon height={20} width={20} />
</ThreadAvatar>
<div>
<ThreadUserTitle>
{item.message.role}
</ThreadUserTitle>
<ThreadUserName>
{item.promptLogs?.[0]?.completionOptions?.model ??
"Agent"}
</ThreadUserName>
</div>
</ThreadHead>
<TimelineItem
item={item}
iconElement={
@ -504,7 +479,13 @@ function GUI() {
"*",
);
}}
onDelete={() => {dispatch(deleteMessage(index))}}
onDelete={() => {
dispatch(deleteMessage(index));
}}
subtext={
item.promptLogs?.[0]?.completionOptions?.model ??
""
}
/>
</TimelineItem>
</div>