mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-11 04:26:37 +08:00
feat(sidebar): add SIDEBAR_TITLE and SIDEBAR_SUBTITLE config for custom sidebar information
This commit is contained in:
parent
b9d1dca65d
commit
851d2d1c96
@ -61,3 +61,10 @@ ANTHROPIC_URL=
|
|||||||
|
|
||||||
### (optional)
|
### (optional)
|
||||||
WHITE_WEBDEV_ENDPOINTS=
|
WHITE_WEBDEV_ENDPOINTS=
|
||||||
|
|
||||||
|
### custom sidebar title.(optional)
|
||||||
|
SIDEBAR_TITLE=
|
||||||
|
|
||||||
|
### custom sidebar subtitle.(optional)
|
||||||
|
SIDEBAR_SUBTITLE=
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import { Link, useNavigate } from "react-router-dom";
|
|||||||
import { isIOS, useMobileScreen } from "../utils";
|
import { isIOS, useMobileScreen } from "../utils";
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
import { showConfirm, showToast } from "./ui-lib";
|
import { showConfirm, showToast } from "./ui-lib";
|
||||||
|
import { getServerSideConfig } from "../config/server";
|
||||||
|
|
||||||
const ChatList = dynamic(async () => (await import("./chat-list")).ChatList, {
|
const ChatList = dynamic(async () => (await import("./chat-list")).ChatList, {
|
||||||
loading: () => null,
|
loading: () => null,
|
||||||
@ -130,7 +131,6 @@ function useDragSideBar() {
|
|||||||
|
|
||||||
export function SideBar(props: { className?: string }) {
|
export function SideBar(props: { className?: string }) {
|
||||||
const chatStore = useChatStore();
|
const chatStore = useChatStore();
|
||||||
|
|
||||||
// drag side bar
|
// drag side bar
|
||||||
const { onDragStart, shouldNarrow } = useDragSideBar();
|
const { onDragStart, shouldNarrow } = useDragSideBar();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -140,7 +140,7 @@ export function SideBar(props: { className?: string }) {
|
|||||||
() => isIOS() && isMobileScreen,
|
() => isIOS() && isMobileScreen,
|
||||||
[isMobileScreen],
|
[isMobileScreen],
|
||||||
);
|
);
|
||||||
|
const serverConfig = getServerSideConfig();
|
||||||
useHotKey();
|
useHotKey();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -155,10 +155,10 @@ export function SideBar(props: { className?: string }) {
|
|||||||
>
|
>
|
||||||
<div className={styles["sidebar-header"]} data-tauri-drag-region>
|
<div className={styles["sidebar-header"]} data-tauri-drag-region>
|
||||||
<div className={styles["sidebar-title"]} data-tauri-drag-region>
|
<div className={styles["sidebar-title"]} data-tauri-drag-region>
|
||||||
NextChat
|
{serverConfig.sidebarTitle}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles["sidebar-sub-title"]}>
|
<div className={styles["sidebar-sub-title"]}>
|
||||||
Build your own AI assistant.
|
{serverConfig.sidebarSubTitle}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles["sidebar-logo"] + " no-dark"}>
|
<div className={styles["sidebar-logo"] + " no-dark"}>
|
||||||
<ChatGptIcon />
|
<ChatGptIcon />
|
||||||
|
@ -55,13 +55,17 @@ declare global {
|
|||||||
|
|
||||||
// custom template for preprocessing user input
|
// custom template for preprocessing user input
|
||||||
DEFAULT_INPUT_TEMPLATE?: string;
|
DEFAULT_INPUT_TEMPLATE?: string;
|
||||||
|
|
||||||
|
// custom sidebar title
|
||||||
|
SIDEBAR_TITLE?: string;
|
||||||
|
// custom sidebar sub-title
|
||||||
|
SIDEBAR_SUB_TITLE?: string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ACCESS_CODES = (function getAccessCodes(): Set<string> {
|
const ACCESS_CODES = (function getAccessCodes(): Set<string> {
|
||||||
const code = process.env.CODE;
|
const code = process.env.CODE;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const codes = (code?.split(",") ?? [])
|
const codes = (code?.split(",") ?? [])
|
||||||
.filter((v) => !!v)
|
.filter((v) => !!v)
|
||||||
@ -125,7 +129,10 @@ export const getServerSideConfig = () => {
|
|||||||
const allowedWebDevEndpoints = (
|
const allowedWebDevEndpoints = (
|
||||||
process.env.WHITE_WEBDEV_ENDPOINTS ?? ""
|
process.env.WHITE_WEBDEV_ENDPOINTS ?? ""
|
||||||
).split(",");
|
).split(",");
|
||||||
|
// custom title
|
||||||
|
const sidebarTitle = process.env.SIDEBAR_TITLE ?? "NextChat";
|
||||||
|
const sidebarSubTitle =
|
||||||
|
process.env.SIDEBAR_SUB_TITLE ?? "Build your own AI assistant.";
|
||||||
return {
|
return {
|
||||||
baseUrl: process.env.BASE_URL,
|
baseUrl: process.env.BASE_URL,
|
||||||
apiKey: getApiKey(process.env.OPENAI_API_KEY),
|
apiKey: getApiKey(process.env.OPENAI_API_KEY),
|
||||||
@ -174,5 +181,7 @@ export const getServerSideConfig = () => {
|
|||||||
customModels,
|
customModels,
|
||||||
defaultModel,
|
defaultModel,
|
||||||
allowedWebDevEndpoints,
|
allowedWebDevEndpoints,
|
||||||
|
sidebarTitle,
|
||||||
|
sidebarSubTitle,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user