SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
feat: add hideScrollButton functionality to improve chat session management
Salman-Ahamed4dc51ce98f66
diff --git a/packages/app/src/react/features/ai-chat/components/footer/scroll-to-bottom-button.tsx b/packages/app/src/react/features/ai-chat/components/footer/scroll-to-bottom-button.tsxindex a2d592b9..dc64b07a 100644--- a/packages/app/src/react/features/ai-chat/components/footer/scroll-to-bottom-button.tsx+++ b/packages/app/src/react/features/ai-chat/components/footer/scroll-to-bottom-button.tsx@@ -4,9 +4,9 @@ import { FaArrowDown } from 'react-icons/fa6';type IProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;export const ScrollToBottomButton: FC<IProps> = ({ onClick }) => (- <div className="w-full max-w-4xl flex justify-center items-center absolute -top-5 z-10">+ <div className="w-full max-w-4xl flex justify-center items-center absolute -top-5 z-20"><button- className="bg-white border border-solid border-black border-opacity-10 text-gray-900 rounded-full p-2 shadow-lg hover:bg-gray-50 transition-colors duration-200"+ className="bg-white border border-solid border-black border-opacity-10 text-gray-900 rounded-full p-2 shadow-lg hover:bg-slate-100 transition-colors duration-200 active:scale-95"onClick={onClick}aria-label="Scroll to bottom">diff --git a/packages/app/src/react/features/ai-chat/contexts/chat.provider.tsx b/packages/app/src/react/features/ai-chat/contexts/chat.provider.tsxindex 483447bc..0c34b519 100644--- a/packages/app/src/react/features/ai-chat/contexts/chat.provider.tsx+++ b/packages/app/src/react/features/ai-chat/contexts/chat.provider.tsx@@ -107,13 +107,14 @@ export const ChatContextProvider: FC<TChildren> = ({ children }) => {stopStreaming();setMessages([]);fileUpload.clear();+ scroll.hideScrollButton();await createSession();inputRef.current?.focus();Observability.observeInteraction(EVENTS.CHAT_EVENTS.SESSION_END);Observability.observeInteraction(EVENTS.CHAT_EVENTS.SESSION_START);- }, [createSession, setMessages, fileUpload, stopStreaming]);+ }, [createSession, setMessages, fileUpload, stopStreaming, scroll]);// Display informational message when chatbot is disableduseEffect(() => {diff --git a/packages/app/src/react/features/ai-chat/contexts/chat.ts b/packages/app/src/react/features/ai-chat/contexts/chat.tsindex 4713f255..a8b10d35 100644--- a/packages/app/src/react/features/ai-chat/contexts/chat.ts+++ b/packages/app/src/react/features/ai-chat/contexts/chat.ts@@ -28,6 +28,7 @@ export interface IChatContext {handleScroll: () => void;scrollToBottom: (smooth?: boolean) => void;smartScrollToBottom: (smooth?: boolean) => void;+ hideScrollButton: () => void;};modelOverride: string | null;setModelOverride: (model: string | null) => void;@@ -60,6 +61,7 @@ export const ChatContext = createContext<IChatContext>({handleScroll: () => {},scrollToBottom: () => {},smartScrollToBottom: () => {},+ hideScrollButton: () => {},},modelOverride: null,setModelOverride: () => {},diff --git a/packages/app/src/react/features/ai-chat/hooks/use-scroll.ts b/packages/app/src/react/features/ai-chat/hooks/use-scroll.tsindex a821279d..46c178d5 100644--- a/packages/app/src/react/features/ai-chat/hooks/use-scroll.ts+++ b/packages/app/src/react/features/ai-chat/hooks/use-scroll.ts@@ -53,6 +53,12 @@ export const useScrollToBottom = (ref: RefObject<HTMLElement>) => {scrollManager.smartScrollToBottom({ behavior: smooth ? 'smooth' : 'auto', delay: 0 });}, []);+ /**+ * Hides the scroll button+ * Used when resetting chat session+ */+ const hideScrollButton = useCallback(() => setShowScrollButton(false), []);+// Attach scroll event listeneruseEffect(() => {const container = ref.current;@@ -67,5 +73,6 @@ export const useScrollToBottom = (ref: RefObject<HTMLElement>) => {handleScroll,scrollToBottom,smartScrollToBottom,+ hideScrollButton,};};