Skip to content

Commit

Permalink
generate button only on User sticky + not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
jackschedel committed Jan 2, 2024
1 parent b602914 commit 127d130
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/Chat/ChatContent/Message/MessageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const MessageContent = ({
setIsEdit={setIsEdit}
messageIndex={messageIndex}
sticky={sticky}
role={role}
/>
) : (
<ContentView
Expand Down
10 changes: 9 additions & 1 deletion src/components/Chat/ChatContent/Message/View/EditView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ const EditView = ({
setIsEdit,
messageIndex,
sticky,
role,
}: {
content: string;
setIsEdit: React.Dispatch<React.SetStateAction<boolean>>;
messageIndex: number;
sticky?: boolean;
role: string;
}) => {
const inputRole = useStore((state) => state.inputRole);
const setChats = useStore((state) => state.setChats);
Expand Down Expand Up @@ -145,6 +147,8 @@ const EditView = ({
cursorPosition={cursorPosition}
_setContent={_setContent}
messageIndex={messageIndex}
role={role}
content={content}
/>
{isModalOpen && (
<PopupModal
Expand All @@ -168,6 +172,8 @@ const EditViewButtons = memo(
cursorPosition,
_setContent,
messageIndex,
role,
content,
}: {
sticky?: boolean;
handleGenerate: () => void;
Expand All @@ -177,6 +183,8 @@ const EditViewButtons = memo(
cursorPosition: number;
_setContent: React.Dispatch<React.SetStateAction<string>>;
messageIndex: number;
role: string;
content: string;
}) => {
const { t } = useTranslation();
const generating = useStore.getState().generating;
Expand Down Expand Up @@ -214,7 +222,7 @@ const EditViewButtons = memo(
</button>
)}

{sticky || (
{!sticky && role === 'user' && content != '' && (
<button
className='btn relative mr-2 btn-primary'
onClick={() => {
Expand Down

0 comments on commit 127d130

Please sign in to comment.