From de9f9a0ce81a89cde87a89b66bc7e35626b73a9f Mon Sep 17 00:00:00 2001 From: Timothy Carambat Date: Wed, 11 Sep 2024 13:17:29 -0700 Subject: [PATCH] UI Cleanup (#2270) Remove FineTuningBanner remove AgentAlert for first time users --- .../src/components/SettingsSidebar/index.jsx | 2 - .../PromptInput/AgentMenu/index.jsx | 73 +------------------ frontend/src/index.css | 28 ------- .../src/pages/FineTuning/Banner/index.jsx | 66 ----------------- frontend/src/pages/Main/index.jsx | 2 - frontend/src/pages/WorkspaceChat/index.jsx | 2 - 6 files changed, 1 insertion(+), 172 deletions(-) delete mode 100644 frontend/src/pages/FineTuning/Banner/index.jsx diff --git a/frontend/src/components/SettingsSidebar/index.jsx b/frontend/src/components/SettingsSidebar/index.jsx index 54cf9b4a1..97b088eca 100644 --- a/frontend/src/components/SettingsSidebar/index.jsx +++ b/frontend/src/components/SettingsSidebar/index.jsx @@ -21,7 +21,6 @@ import { useTranslation } from "react-i18next"; import showToast from "@/utils/toast"; import System from "@/models/system"; import Option from "./MenuOption"; -import { FineTuningAlert } from "@/pages/FineTuning/Banner"; export default function SettingsSidebar() { const { t } = useTranslation(); @@ -178,7 +177,6 @@ export default function SettingsSidebar() { - ); } diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/AgentMenu/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/AgentMenu/index.jsx index bc98b45b4..e0121e1d5 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/AgentMenu/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/AgentMenu/index.jsx @@ -1,8 +1,6 @@ import { useEffect, useRef, useState } from "react"; import { Tooltip } from "react-tooltip"; -import { At, Flask, X } from "@phosphor-icons/react"; -import ModalWrapper from "@/components/ModalWrapper"; -import { useModal } from "@/hooks/useModal"; +import { At } from "@phosphor-icons/react"; import { useIsAgentSessionActive } from "@/utils/chat/agent"; export default function AvailableAgentsButton({ showing, setShowAgents }) { @@ -107,7 +105,6 @@ export function AvailableAgents({ - {showing && } ); } @@ -116,71 +113,3 @@ export function useAvailableAgents() { const [showAgents, setShowAgents] = useState(false); return { showAgents, setShowAgents }; } - -const SEEN_FT_AGENT_MODAL = "anythingllm_seen_first_time_agent_modal"; -function FirstTimeAgentUser() { - const { isOpen, openModal, closeModal } = useModal(); - useEffect(() => { - function firstTimeShow() { - if (!window) return; - if (!window.localStorage.getItem(SEEN_FT_AGENT_MODAL)) openModal(); - } - firstTimeShow(); - }, []); - - const dismiss = () => { - closeModal(); - window.localStorage.setItem(SEEN_FT_AGENT_MODAL, 1); - }; - - return ( - -
-
-
- -

- You just discovered Agents! -

- -
-
-
-

- Agents are your LLM, but with special abilities that{" "} - do something beyond chatting with your documents. -
-
- Now you can use agents for real-time web search and scraping, - saving documents to your browser, summarizing documents, and - more. -

-

- This feature is currently early access and fully custom agents - with custom integrations & code execution will be in a future - update. -

-
-
-
-
- -
-
-
- - ); -} diff --git a/frontend/src/index.css b/frontend/src/index.css index 25504d0d0..29dd658a3 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -767,34 +767,6 @@ does not extend the close button beyond the viewport. */ } } -.top-banner { - animation: popTop 500ms forwards; -} - -@keyframes popTop { - 0% { - top: -3.5rem; - } - - 100% { - top: 0px; - } -} - -.rm-top-banner { - animation: rmPopTop 500ms forwards; -} - -@keyframes rmPopTop { - 0% { - top: 0px; - } - - 100% { - top: -3.5rem; - } -} - /* Math/Katex formatting to prevent duplication of content on screen */ .katex-html[aria-hidden="true"] { display: none; diff --git a/frontend/src/pages/FineTuning/Banner/index.jsx b/frontend/src/pages/FineTuning/Banner/index.jsx deleted file mode 100644 index cab896d61..000000000 --- a/frontend/src/pages/FineTuning/Banner/index.jsx +++ /dev/null @@ -1,66 +0,0 @@ -import { useEffect, useState } from "react"; -import useUser from "@/hooks/useUser"; -import FineTuning from "@/models/experimental/fineTuning"; -import { createPortal } from "react-dom"; -import { Sparkle } from "@phosphor-icons/react"; -import { Link, useLocation } from "react-router-dom"; -import paths from "@/utils/paths"; - -export function FineTuningAlert() { - const { user } = useUser(); - const location = useLocation(); - const [className, setClassName] = useState("top-banner"); - const [isEligible, setIsEligible] = useState(false); - - function dismissAlert() { - setClassName("rm-top-banner"); - window?.localStorage?.setItem(FineTuning.cacheKeys.dismissed_cta, "1"); - setTimeout(() => { - setIsEligible(false); - }, 550); - } - - useEffect(() => { - if (!FineTuning.canAlert(user)) return; - if ( - location.pathname === paths.orderFineTune() || - location.pathname === paths.settings.chats() - ) - return; - FineTuning.checkEligibility() - .then((eligible) => setIsEligible(eligible)) - .catch(() => null); - }, [user]); - - if (!isEligible) return null; - return createPortal( -
- -
-
- -

- You have enough data for a fine-tune! -

-
-

click to learn more →

-
- -
- -
-
, - document.getElementById("root") - ); -} diff --git a/frontend/src/pages/Main/index.jsx b/frontend/src/pages/Main/index.jsx index 757b78c07..36c7a8607 100644 --- a/frontend/src/pages/Main/index.jsx +++ b/frontend/src/pages/Main/index.jsx @@ -5,7 +5,6 @@ import PasswordModal, { usePasswordModal } from "@/components/Modals/Password"; import { isMobile } from "react-device-detect"; import { FullScreenLoader } from "@/components/Preloader"; import UserMenu from "@/components/UserMenu"; -import { FineTuningAlert } from "../FineTuning/Banner"; export default function Main() { const { loading, requiresAuth, mode } = usePasswordModal(); @@ -23,7 +22,6 @@ export default function Main() {
- ); } diff --git a/frontend/src/pages/WorkspaceChat/index.jsx b/frontend/src/pages/WorkspaceChat/index.jsx index 4f249eedf..6c5fcfb13 100644 --- a/frontend/src/pages/WorkspaceChat/index.jsx +++ b/frontend/src/pages/WorkspaceChat/index.jsx @@ -6,7 +6,6 @@ import Workspace from "@/models/workspace"; import PasswordModal, { usePasswordModal } from "@/components/Modals/Password"; import { isMobile } from "react-device-detect"; import { FullScreenLoader } from "@/components/Preloader"; -import { FineTuningAlert } from "../FineTuning/Banner"; export default function WorkspaceChat() { const { loading, requiresAuth, mode } = usePasswordModal(); @@ -50,7 +49,6 @@ function ShowWorkspaceChat() { {!isMobile && } - ); }