Skip to content

Commit

Permalink
fix(chat contiols): hiding chatform controls, revealing model and mod…
Browse files Browse the repository at this point in the history
…e info for running chats
  • Loading branch information
alashchev17 committed Jan 13, 2025
1 parent 435c65c commit 5c1676a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
6 changes: 2 additions & 4 deletions src/components/Chat/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
useGetCapsQuery,
useCapsForToolUse,
} from "../../hooks";
import { selectConfig, type Config } from "../../features/Config/configSlice";
import { type Config } from "../../features/Config/configSlice";
import {
enableSend,
selectIsStreaming,
Expand Down Expand Up @@ -44,8 +44,6 @@ export const Chat: React.FC<ChatProps> = ({
const isWaiting = useAppSelector(selectIsWaiting);
const caps = useGetCapsQuery();

const config = useAppSelector(selectConfig);

const chatId = useAppSelector(selectChatId);
const { submit, abort, retryFromIndex } = useSendChatRequest();

Expand Down Expand Up @@ -128,7 +126,7 @@ export const Chat: React.FC<ChatProps> = ({

<Flex justify="between" pl="1" pr="1" pt="1">
{/* Two flexboxes are left for the future UI element on the right side */}
{messages.length > 0 && config.host === "web" && (
{messages.length > 0 && (
<Flex align="center" justify="between" width="100%">
<Flex align="center" gap="1">
<Text size="1">
Expand Down
19 changes: 8 additions & 11 deletions src/components/ChatForm/ChatControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ export const ChatControls: React.FC<ChatControlsProps> = ({
);

const showControls = useMemo(
() => !isStreaming && !isWaiting,
[isStreaming, isWaiting],
() => messages.length === 0 && !isStreaming && !isWaiting,
[isStreaming, isWaiting, messages],
);

return (
Expand Down Expand Up @@ -262,18 +262,15 @@ export const ChatControls: React.FC<ChatControlsProps> = ({
);
})}

{showControls && (
<ToolUseSwitch
ref={(x) => refs.setUseTools(x)}
toolUse={toolUse}
setToolUse={onSetToolUse}
/>
)}

{showControls && (
<Flex gap="2" direction="column">
<ToolUseSwitch
ref={(x) => refs.setUseTools(x)}
toolUse={toolUse}
setToolUse={onSetToolUse}
/>
<CapsSelect />
{messages.length === 0 && <PromptSelect />}
<PromptSelect />
</Flex>
)}
</Flex>
Expand Down

0 comments on commit 5c1676a

Please sign in to comment.