This commit is contained in:
Nate Sesti 2024-07-22 11:08:17 -07:00
commit 423a8169a8
4 changed files with 166 additions and 76 deletions

View file

@ -0,0 +1,22 @@
export default function Logo({
height,
width,
}: {
height: number;
width: number;
}) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width={width}
height={height}
viewBox="0 0 24 24"
fill="none"
>
<path
d="M20.5286 3.26811L19.1512 5.65694L22.6328 11.6849C22.6582 11.7306 22.6735 11.7866 22.6735 11.8374C22.6735 11.8882 22.6582 11.9441 22.6328 11.9899L19.1512 18.0229L20.5286 20.4117L25.4791 11.8374L20.5286 3.26303V3.26811ZM18.6176 5.3469L19.995 2.95807H17.2402L15.8628 5.3469H18.6227H18.6176ZM15.8577 5.96697L19.075 11.5324H21.8298L18.6176 5.96697H15.8577ZM18.6176 17.7179L21.8298 12.1474H19.075L15.8577 17.7179H18.6176ZM15.8577 18.338L17.2351 20.7167H19.9899L18.6125 18.338H15.8526H15.8577ZM6.52098 21.3063C6.46507 21.3063 6.41424 21.291 6.3685 21.2656C6.32276 21.2402 6.28209 21.1995 6.25668 21.1538L2.77002 15.1207H0.0152482L4.9657 23.69H14.8615L13.4841 21.3063H6.52606H6.52098ZM14.0178 20.9962L15.3952 23.38L16.7726 20.9911L15.3952 18.6023L14.0178 20.9911V20.9962ZM14.8615 18.2974H8.43712L7.05973 20.6862H13.4841L14.8615 18.2974ZM7.89836 17.9924L4.68108 12.4219L3.30369 14.8107L6.52098 20.3812L7.89836 17.9924ZM0.0101654 14.5007H2.76494L4.14232 12.1118H1.39263L0.0101654 14.5007ZM6.24143 2.5413C6.26685 2.49556 6.30751 2.4549 6.35325 2.42948C6.399 2.40407 6.4549 2.38882 6.50573 2.38882H13.474L14.8514 0H4.95045L0 8.57435H2.75477L6.23127 2.54638L6.24143 2.5413ZM4.14232 11.5782L2.76494 9.18934H0.0101654L1.38755 11.5782H4.14232ZM6.51081 3.31386L3.29861 8.8793L4.67599 11.2681L7.8882 5.70268L6.51081 3.31386ZM13.4791 3.00382H7.04448L8.42187 5.39264H14.8564L13.4791 3.00382ZM15.3952 5.0826L16.7675 2.69886L15.3952 0.310038L14.0178 2.69378L15.3952 5.0826Z"
fill="currentColor"
></path>
</svg>
);
}

View file

@ -58,7 +58,7 @@ const ContentDiv = styled.div<{ isUserInput: boolean; fontSize?: number }>`
background-color: ${(props) =>
props.isUserInput ? vscInputBackground : vscBackground};
font-size: ${(props) => props.fontSize || getFontSize()}px;
border-radius: ${defaultBorderRadius};
// border-radius: ${defaultBorderRadius};
overflow: hidden;
`;
@ -138,7 +138,6 @@ function StepContainer(props: StepContainerProps) {
/>
)}
</ContentDiv>
<div className="h-2"></div>
{(isHovered || typeof feedback !== "undefined") && !active && (
<div
className="flex items-center gap-2 right-2 absolute -bottom-1"

View file

@ -98,7 +98,7 @@ const ContextItemsPeek = (props: ContextItemsPeekProps) => {
style={{ color: lightGray }}
></ChevronDownIcon>
)}
Context Used
<span className="ms-1">Context Used</span>
</div>
{open && (
<div

View file

@ -3,6 +3,7 @@ import {
ChatBubbleOvalLeftIcon,
CodeBracketSquareIcon,
ExclamationTriangleIcon,
SparklesIcon,
} from "@heroicons/react/24/outline";
import { JSONContent } from "@tiptap/react";
import { InputModifiers } from "core";
@ -56,6 +57,7 @@ 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;
@ -103,6 +105,13 @@ const StepsDiv = styled.div`
// z-index: 0;
// bottom: 12px;
// }
.thread-message {
margin: 16px 8px 0 8px;
}
.thread-message:not(:first-child) {
border-top: 1px solid ${lightGray}22;
}
`;
const NewSessionButton = styled.div`
@ -125,6 +134,36 @@ const NewSessionButton = styled.div`
cursor: pointer;
`;
const ThreadHead = styled.div`
display: flex;
align-items: center;
gap: 6px;
margin: 18px 6px 0 6px;
`;
const ThreadAvatar = styled.div`
width: 32px;
height: 32px;
border-radius: 50%;
background-color: rgba(248, 248, 248, 0.75);
color: #000;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid rgba(136, 136, 136, 0.3);
`;
const ThreadUserTitle = styled.div`
text-transform: capitalize;
font-weight: 500;
margin-bottom: 2px;
`;
const ThreadUserName = styled.div`
font-size: ${getFontSize() - 3}px;
color: ${lightGray};
`;
function fallbackRender({ error, resetErrorBoundary }) {
// Call resetErrorBoundary() to reset the error boundary and retry the render.
@ -359,85 +398,115 @@ function GUI() {
}}
>
{item.message.role === "user" ? (
<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>
<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>
) : (
<TimelineItem
item={item}
iconElement={
false ? (
<CodeBracketSquareIcon width="16px" height="16px" />
) : false ? (
<ExclamationTriangleIcon
width="16px"
height="16px"
color="red"
/>
) : (
<ChatBubbleOvalLeftIcon
width="16px"
height="16px"
/>
)
}
open={
typeof stepsOpen[index] === "undefined"
? false
? false
: true
: stepsOpen[index]!
}
onToggle={() => {}}
>
<StepContainer
index={index}
isLast={index === sessionState.history.length - 1}
isFirst={index === 0}
<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={
false ? (
<CodeBracketSquareIcon
width="16px"
height="16px"
/>
) : false ? (
<ExclamationTriangleIcon
width="16px"
height="16px"
color="red"
/>
) : (
<ChatBubbleOvalLeftIcon
width="16px"
height="16px"
/>
)
}
open={
typeof stepsOpen[index] === "undefined"
? true
? false
? false
: true
: stepsOpen[index]!
}
key={index}
onUserInput={(input: string) => {}}
item={item}
onReverse={() => {}}
onRetry={() => {
streamResponse(
state.history[index - 1].editorState,
state.history[index - 1].modifiers ??
defaultInputModifiers,
ideMessenger,
index - 1,
);
}}
onContinueGeneration={() => {
window.postMessage(
{
messageType: "userInput",
data: {
input:
"Continue your response exactly where you left off:",
onToggle={() => {}}
>
<StepContainer
index={index}
isLast={index === sessionState.history.length - 1}
isFirst={index === 0}
open={
typeof stepsOpen[index] === "undefined"
? true
: stepsOpen[index]!
}
key={index}
onUserInput={(input: string) => {}}
item={item}
onReverse={() => {}}
onRetry={() => {
streamResponse(
state.history[index - 1].editorState,
state.history[index - 1].modifiers ??
defaultInputModifiers,
ideMessenger,
index - 1,
);
}}
onContinueGeneration={() => {
window.postMessage(
{
messageType: "userInput",
data: {
input:
"Continue your response exactly where you left off:",
},
},
},
"*",
);
}}
onDelete={() => {}}
/>
</TimelineItem>
"*",
);
}}
onDelete={() => {}}
/>
</TimelineItem>
</div>
)}
</ErrorBoundary>
</Fragment>