From 851d2d1c96f2790dc267ac4c1c115bd709b09d4b Mon Sep 17 00:00:00 2001 From: chenxc <> Date: Mon, 15 Jul 2024 10:46:26 +0800 Subject: [PATCH] feat(sidebar): add SIDEBAR_TITLE and SIDEBAR_SUBTITLE config for custom sidebar information --- .env.template | 9 ++++++++- app/components/sidebar.tsx | 8 ++++---- app/config/server.ts | 13 +++++++++++-- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.env.template b/.env.template index b2a0438d9d1..4a6fe3fefad 100644 --- a/.env.template +++ b/.env.template @@ -60,4 +60,11 @@ ANTHROPIC_API_VERSION= ANTHROPIC_URL= ### (optional) -WHITE_WEBDEV_ENDPOINTS= \ No newline at end of file +WHITE_WEBDEV_ENDPOINTS= + +### custom sidebar title.(optional) +SIDEBAR_TITLE= + +### custom sidebar subtitle.(optional) +SIDEBAR_SUBTITLE= + diff --git a/app/components/sidebar.tsx b/app/components/sidebar.tsx index 69b2e71f871..c68aacccf6f 100644 --- a/app/components/sidebar.tsx +++ b/app/components/sidebar.tsx @@ -30,6 +30,7 @@ import { Link, useNavigate } from "react-router-dom"; import { isIOS, useMobileScreen } from "../utils"; import dynamic from "next/dynamic"; import { showConfirm, showToast } from "./ui-lib"; +import { getServerSideConfig } from "../config/server"; const ChatList = dynamic(async () => (await import("./chat-list")).ChatList, { loading: () => null, @@ -130,7 +131,6 @@ function useDragSideBar() { export function SideBar(props: { className?: string }) { const chatStore = useChatStore(); - // drag side bar const { onDragStart, shouldNarrow } = useDragSideBar(); const navigate = useNavigate(); @@ -140,7 +140,7 @@ export function SideBar(props: { className?: string }) { () => isIOS() && isMobileScreen, [isMobileScreen], ); - + const serverConfig = getServerSideConfig(); useHotKey(); return ( @@ -155,10 +155,10 @@ export function SideBar(props: { className?: string }) { >