Skip to content

Commit

Permalink
fix chat width bugs (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardgill authored Jun 1, 2024
1 parent 2a9ea6c commit 3958ca6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .astro/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"devToolbar": {
"enabled": false
}
}
5 changes: 3 additions & 2 deletions apps/www/src/components/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ const ChatMessage: React.FC<{
)}
<div
className={cn(
"flex flex-1 space-y-2 overflow-x-hidden",
"flex space-y-2 min-w-0", // min-w-0 stops overflows
role === "user" && "bg-background rounded-lg px-4 py-1",
role !== "user" && "flex-1",
)}
>
<MessageComponent
Expand Down Expand Up @@ -162,7 +163,7 @@ export const Chat = () => {
className="flex flex-1 flex-col-reverse overflow-y-auto pt-4 pb-3"
>
{/* This div takes up all the remaining space so the messages start at the top */}
<div className="flex flex-1 flex-col" />
<div className="flex flex-1 flex-col" />{" "}
{reversedMessagesWithoutSystem.map((message, index) => {
const { role } = message;
const isStreamFinished =
Expand Down
3 changes: 2 additions & 1 deletion apps/www/src/components/demo/message/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ export const Message: React.FC<{
isStreamFinished,
});

// min-w-0 stops overflows
return (
<div className="flex flex-1 flex-col">
<div className="flex flex-1 flex-col min-w-0">
{blockMatches.map((blockMatch, index) => {
const Component = blockMatch.block.component;
return <Component key={index} blockMatch={blockMatch} />;
Expand Down

0 comments on commit 3958ca6

Please sign in to comment.