Skip to content

Commit

Permalink
fix: adjust chat ui
Browse files Browse the repository at this point in the history
  • Loading branch information
vaayne committed Sep 4, 2024
1 parent bb1ba94 commit ef024ea
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
33 changes: 20 additions & 13 deletions web/src/components/thread-chat-windows.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { Icon } from "@iconify/react/dist/iconify.js";
import {
Avatar,
Badge,
Box,
Container,
em,
Flex,
Group,
Image,
Modal,
Paper,
ScrollArea,
SimpleGrid,
Stack,
Text,
em,
} from "@mantine/core";
import { useMediaQuery } from "@mantine/hooks";
import { useEffect, useRef, useState } from "react";
Expand Down Expand Up @@ -43,19 +44,15 @@ export function ThreadChatWindows() {
justify={isSender ? "flex-end" : "flex-start"}
align="flex-start"
direction="row"
gap="2"
gap="xs"
key={message.id}
>
{!isSender && (
<Avatar size="sm" radius="lg" color="cyan" variant="filled">
<Icon icon="tabler:robot" />
<Avatar size="md" radius="md" color="cyan" variant="filled">
<Icon icon="tabler:brand-android" />
</Avatar>
)}
<Flex align={isSender ? "flex-end" : "flex-start"} direction="column">
<Text size="lg" variant="gradient">
{isSender ? "You" : message.model}
</Text>

<Paper
shadow="md"
px="xs"
Expand Down Expand Up @@ -101,12 +98,22 @@ export function ThreadChatWindows() {
)}
<MarkdownRenderer content={message.text} />
</Paper>

{CopyBtn({ data: message.text })}
<Group preventGrowOverflow={false} grow gap="2">
{!isSender && (
<Badge
variant="gradient"
gradient={{ from: "blue", to: "cyan", deg: 90 }}
size="xs"
>
{message.model}
</Badge>
)}
{CopyBtn({ data: message.text })}
</Group>
</Flex>
{isSender && (
<Avatar size="sm" radius="lg" color="cyan" variant="filled">
<Icon icon="tabler:mood-crazy-happy" />
<Avatar size="md" radius="md" color="cyan" variant="filled">
<Icon icon="tabler:user" />
</Avatar>
)}
</Flex>
Expand Down
12 changes: 7 additions & 5 deletions web/src/components/thread-input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ export function ThreadChatInput() {
const validSendKeys = [
{
value: "mod+enter",
label: "⌘ + ↵ Send",
label: "⌘ + ↵",
},
{
value: "shift+enter",
label: "⇧ + ↵ Send",
label: "⇧ + ↵",
},
{
value: "enter",
label: "↵ Send",
label: "↵",
},
];
const [sendKey, setSendKey] = useState("enter");
Expand Down Expand Up @@ -156,7 +156,7 @@ export function ThreadChatInput() {
const selectSendHotKey = () => {
return (
<Popover
width="150"
width="100"
position="bottom"
trapFocus
withArrow
Expand Down Expand Up @@ -272,7 +272,9 @@ export function ThreadChatInput() {
<Flex align="flex-end" gap="xs">
<FocusTrap>
<Textarea
placeholder="Shift + Enter to send"
placeholder={`use ${
validSendKeys.find((key) => key.value === sendKey).label
} to send`}
radius="lg"
minRows={1}
maxRows={5}
Expand Down

0 comments on commit ef024ea

Please sign in to comment.