mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-08 16:51:54 +08:00
feat: add app logo and
release workflow
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import { useDebouncedCallback } from "use-debounce";
|
||||
import React, { useState, useRef, useEffect, useLayoutEffect } from "react";
|
||||
import React, {
|
||||
useState,
|
||||
useRef,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useMemo,
|
||||
} from "react";
|
||||
|
||||
import SendWhiteIcon from "../icons/send-white.svg";
|
||||
import BrainIcon from "../icons/brain.svg";
|
||||
@@ -61,6 +67,7 @@ import { useMaskStore } from "../store/mask";
|
||||
import { useCommand } from "../command";
|
||||
import { prettyObject } from "../utils/format";
|
||||
import { ExportMessageModal } from "./exporter";
|
||||
import { getClientConfig } from "../config/client";
|
||||
|
||||
const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
|
||||
loading: () => <LoadingIcon />,
|
||||
@@ -704,9 +711,13 @@ export function Chat() {
|
||||
}
|
||||
};
|
||||
|
||||
const clientConfig = useMemo(() => getClientConfig(), []);
|
||||
|
||||
const location = useLocation();
|
||||
const isChat = location.pathname === Path.Chat;
|
||||
|
||||
const autoFocus = !isMobileScreen || isChat; // only focus in chat page
|
||||
const showMaxIcon = !isMobileScreen && !clientConfig?.isApp;
|
||||
|
||||
useCommand({
|
||||
fill: setUserInput,
|
||||
@@ -755,7 +766,7 @@ export function Chat() {
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{!isMobileScreen && (
|
||||
{showMaxIcon && (
|
||||
<div className="window-action-button">
|
||||
<IconButton
|
||||
icon={config.tightBorder ? <MinIcon /> : <MaxIcon />}
|
||||
|
@@ -286,6 +286,9 @@ export function Settings() {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const clientConfig = useMemo(() => getClientConfig(), []);
|
||||
const showAccessCode = enabledAccessControl && !clientConfig?.isApp;
|
||||
|
||||
return (
|
||||
<ErrorBoundary>
|
||||
<div className="window-header">
|
||||
@@ -485,7 +488,7 @@ export function Settings() {
|
||||
</List>
|
||||
|
||||
<List>
|
||||
{enabledAccessControl ? (
|
||||
{showAccessCode ? (
|
||||
<ListItem
|
||||
title={Locale.Settings.AccessCode.Title}
|
||||
subTitle={Locale.Settings.AccessCode.SubTitle}
|
||||
|
@@ -21,6 +21,7 @@ export const getBuildConfig = () => {
|
||||
return {
|
||||
commitId: COMMIT_ID,
|
||||
buildMode: process.env.BUILD_MODE ?? "standalone",
|
||||
isApp: !!process.env.BUILD_APP,
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -11,6 +11,7 @@ declare global {
|
||||
HIDE_USER_API_KEY?: string; // disable user's api key input
|
||||
DISABLE_GPT4?: string; // allow user to use gpt-4 or not
|
||||
BUILD_MODE?: "standalone" | "export";
|
||||
BUILD_APP?: string; // is building desktop app
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -60,7 +60,7 @@ export const useAccessStore = create<AccessControlStore>()(
|
||||
);
|
||||
},
|
||||
fetch() {
|
||||
if (fetchState > 0) return;
|
||||
if (fetchState > 0 || getClientConfig()?.buildMode === "export") return;
|
||||
fetchState = 1;
|
||||
fetch("/api/config", {
|
||||
method: "post",
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import { create } from "zustand";
|
||||
import { persist } from "zustand/middleware";
|
||||
import { StoreKey } from "../constant";
|
||||
import { getBuildConfig } from "../config/build";
|
||||
|
||||
export enum SubmitKey {
|
||||
Enter = "Enter",
|
||||
@@ -21,7 +22,7 @@ export const DEFAULT_CONFIG = {
|
||||
avatar: "1f603",
|
||||
fontSize: 14,
|
||||
theme: Theme.Auto as Theme,
|
||||
tightBorder: false,
|
||||
tightBorder: !getBuildConfig().isApp,
|
||||
sendPreviewBubble: true,
|
||||
sidebarWidth: 300,
|
||||
|
||||
|
Reference in New Issue
Block a user