Skip to content

Commit abaa160

Browse files
committed
feat: Add temporaryChat prop to multiple components for improved chat functionality
1 parent 888d3a2 commit abaa160

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

src/components/Common/Playground/Message.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ type Props = {
5959
documents?: ChatDocuments
6060
actionInfo?: string | null
6161
onNewBranch?: () => void
62+
temporaryChat?: boolean
6263
}
6364

6465
export const PlaygroundMessage = (props: Props) => {
@@ -411,7 +412,7 @@ export const PlaygroundMessage = (props: Props) => {
411412
</Tooltip>
412413
)}
413414

414-
{props?.onNewBranch && (
415+
{props?.onNewBranch && !props?.temporaryChat && (
415416
<Tooltip title={t("newBranch")}>
416417
<button
417418
aria-label={t("newBranch")}

src/components/Layouts/Header.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const Header: React.FC<Props> = ({
5959
queryKey: ["fetchModel"],
6060
queryFn: () => fetchChatModels({ returnEmpty: true }),
6161
refetchIntervalInBackground: false,
62-
staleTime: 1000 * 60 *1,
62+
staleTime: 1000 * 60 * 1
6363
})
6464

6565
const { data: prompts, isLoading: isPromptLoading } = useQuery({
@@ -90,9 +90,8 @@ export const Header: React.FC<Props> = ({
9090

9191
return (
9292
<div
93-
className={`absolute top-0 z-10 flex h-14 w-full flex-row items-center justify-center p-3 overflow-x-auto lg:overflow-x-visible bg-gray-50 border-b dark:bg-[#171717] dark:border-gray-600 ${
94-
temporaryChat && "!bg-gray-200 dark:!bg-black"
95-
}`}>
93+
data-istemporary-chat={temporaryChat}
94+
className={`absolute top-0 z-10 flex h-14 w-full flex-row items-center justify-center p-3 overflow-x-auto lg:overflow-x-visible bg-gray-50 border-b dark:bg-[#171717] dark:border-gray-600 data-[istemporary-chat='true']:bg-gray-200 data-[istemporary-chat='true']:dark:bg-black`}>
9695
<div className="flex gap-2 items-center">
9796
{pathname !== "/" && (
9897
<div>

src/components/Layouts/NewChat.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const NewChat: React.FC<Props> = ({ clearChat }) => {
3131
}
3232
}}
3333
className="inline-flex dark:bg-transparent bg-white items-center rounded-lg border-s-0 rounded-s-none border dark:border-gray-700 bg-transparent px-3 py-2.5 text-xs lg:text-sm font-medium leading-4 text-gray-800 dark:text-white disabled:opacity-50 ease-in-out transition-colors duration-200 hover:bg-gray-100 dark:hover:bg-gray-800 dark:hover:text-white data-[istemporary-chat='true']:bg-gray-100 data-[istemporary-chat='true']:dark:bg-gray-800">
34-
<BsIncognito className="size-4 sm:size-5 text-gray-600 dark:text-gray-300" />
34+
<BsIncognito className="size-4 sm:size-5 text-gray-500 dark:text-gray-400" />
3535
</button>
3636
</Tooltip>
3737
{/* </Dropdown> */}

src/components/Option/Playground/PlaygroundChat.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export const PlaygroundChat = () => {
1515
ttsEnabled,
1616
onSubmit,
1717
actionInfo,
18-
createChatBranch
18+
createChatBranch,
19+
temporaryChat
1920
} = useMessageOption()
2021
const [isSourceOpen, setIsSourceOpen] = React.useState(false)
2122
const [source, setSource] = React.useState<any>(null)
@@ -59,6 +60,7 @@ export const PlaygroundChat = () => {
5960
openReasoning={openReasoning}
6061
modelImage={message?.modelImage}
6162
modelName={message?.modelName}
63+
temporaryChat={temporaryChat}
6264
onContinue={() => {
6365
onSubmit({
6466
image: "",

src/components/Sidepanel/Chat/body.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export const SidePanelBody = () => {
1212
regenerateLastMessage,
1313
editMessage,
1414
isSearchingInternet,
15-
createChatBranch
15+
createChatBranch,
16+
temporaryChat
1617
} = useMessage()
1718
const [isSourceOpen, setIsSourceOpen] = React.useState(false)
1819
const [source, setSource] = React.useState<any>(null)
@@ -52,6 +53,7 @@ export const SidePanelBody = () => {
5253
reasoningTimeTaken={message?.reasoning_time_taken}
5354
modelImage={message?.modelImage}
5455
modelName={message?.modelName}
56+
temporaryChat={temporaryChat}
5557
/>
5658
))}
5759
</div>

0 commit comments

Comments
 (0)