fixed design of chat

This commit is contained in:
Lucas Oliveira 2025-10-27 11:21:09 -03:00
parent 64ae8211d3
commit 3d53edeaf7

View file

@ -128,7 +128,8 @@ function ChatPage() {
// Copy all computed styles to the hidden div // Copy all computed styles to the hidden div
for (const style of computedStyle) { for (const style of computedStyle) {
(div.style as unknown as Record<string, string>)[style] = computedStyle.getPropertyValue(style); (div.style as unknown as Record<string, string>)[style] =
computedStyle.getPropertyValue(style);
} }
// Set the div to be hidden but not un-rendered // Set the div to be hidden but not un-rendered
@ -707,7 +708,9 @@ function ChatPage() {
useEffect(() => { useEffect(() => {
const checkOnboarding = () => { const checkOnboarding = () => {
if (typeof window !== "undefined") { if (typeof window !== "undefined") {
setIsOnboardingComplete(localStorage.getItem("onboarding-step") === null); setIsOnboardingComplete(
localStorage.getItem("onboarding-step") === null,
);
} }
}; };
@ -724,7 +727,10 @@ function ChatPage() {
}, },
); );
const handleSSEStream = async (userMessage: Message, previousResponseId?: string) => { const handleSSEStream = async (
userMessage: Message,
previousResponseId?: string,
) => {
// Prepare filters // Prepare filters
const processedFilters = parsedFilterData?.filters const processedFilters = parsedFilterData?.filters
? (() => { ? (() => {
@ -767,7 +773,10 @@ function ChatPage() {
}); });
}; };
const handleSendMessage = async (inputMessage: string, previousResponseId?: string) => { const handleSendMessage = async (
inputMessage: string,
previousResponseId?: string,
) => {
if (!inputMessage.trim() || loading) return; if (!inputMessage.trim() || loading) return;
const userMessage: Message = { const userMessage: Message = {
@ -1223,10 +1232,9 @@ function ChatPage() {
</div> </div>
) : ( ) : (
<> <>
{messages.map((message, index) => ( {messages.map((message, index) =>
<div key={`message-${index}-${message.timestamp?.getTime()}`}> message.role === "user"
{message.role === "user" && ? (messages[index]?.content.match(FILES_REGEX)?.[0] ??
(messages[index]?.content.match(FILES_REGEX)?.[0] ??
null) === null && ( null) === null && (
<div <div
key={`${ key={`${
@ -1235,20 +1243,23 @@ function ChatPage() {
className="space-y-6 group" className="space-y-6 group"
> >
<UserMessage <UserMessage
animate={message.source ? message.source !== "langflow" : false} animate={
message.source
? message.source !== "langflow"
: false
}
content={message.content} content={message.content}
files={ files={
index >= 2 index >= 2
? (messages[index - 2]?.content.match( ? messages[index - 2]?.content.match(
FILES_REGEX, FILES_REGEX,
)?.[0] ?? undefined) )?.[0] ?? undefined
: undefined : undefined
} }
/> />
</div> </div>
)} )
: message.role === "assistant" &&
{message.role === "assistant" &&
(index < 1 || (index < 1 ||
(messages[index - 1]?.content.match(FILES_REGEX)?.[0] ?? (messages[index - 1]?.content.match(FILES_REGEX)?.[0] ??
null) === null) && ( null) === null) && (
@ -1270,9 +1281,8 @@ function ChatPage() {
isInactive={index < messages.length - 1} isInactive={index < messages.length - 1}
/> />
</div> </div>
),
)} )}
</div>
))}
{/* Streaming Message Display */} {/* Streaming Message Display */}
{streamingMessage && ( {streamingMessage && (