From 6065037c724442262af93ab60997df26b4af56f4 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Thu, 23 Oct 2025 18:27:13 -0300 Subject: [PATCH] Changed page to add files by regex and hide messages --- frontend/src/app/chat/page.tsx | 69 +++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 22 deletions(-) diff --git a/frontend/src/app/chat/page.tsx b/frontend/src/app/chat/page.tsx index dc85f43e..a9bf3ddf 100644 --- a/frontend/src/app/chat/page.tsx +++ b/frontend/src/app/chat/page.tsx @@ -9,6 +9,7 @@ import { type EndpointType, useChat } from "@/contexts/chat-context"; import { useKnowledgeFilter } from "@/contexts/knowledge-filter-context"; import { useTask } from "@/contexts/task-context"; import { useChatStreaming } from "@/hooks/useChatStreaming"; +import { FILES_REGEX } from "@/lib/constants"; import { useLoadingStore } from "@/stores/loadingStore"; import { useGetNudgesQuery } from "../api/queries/useGetNudgesQuery"; import { AssistantMessage } from "./components/assistant-message"; @@ -1176,29 +1177,53 @@ function ChatPage() { ) : ( <> {messages.map((message, index) => ( -
- {message.role === "user" && ( - - )} + <> + {message.role === "user" && + (messages[index]?.content.match(FILES_REGEX)?.[0] ?? + null) === null && ( +
+ = 2 + ? (messages[index - 2]?.content.match( + FILES_REGEX, + )?.[0] ?? undefined) + : undefined + } + /> +
+ )} - {message.role === "assistant" && ( - handleForkConversation(index, e)} - animate={false} - /> - )} -
+ {message.role === "assistant" && + (index < 1 || + (messages[index - 1]?.content.match(FILES_REGEX)?.[0] ?? + null) === null) && ( +
+ handleForkConversation(index, e)} + animate={false} + /> +
+ )} + ))} {/* Streaming Message Display */}