Skip to content
This repository was archived by the owner on Nov 23, 2025. It is now read-only.

Commit c6c5a1c

Browse files
authored
Merge pull request #198 from AprilNEA/v3-dev
v3.2.4-alpha
2 parents bb1051b + 9aef736 commit c6c5a1c

File tree

17 files changed

+132
-38
lines changed

17 files changed

+132
-38
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chatgpt-admin-web",
3-
"version": "3.2.3",
3+
"version": "3.2.4",
44
"description": "ChatGPT Admin Web",
55
"license": "MIT",
66
"author": "AprilNEA <[email protected]> (https://sku.moe)",

packages/frontend/next.config.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,17 @@ const config = fs.existsSync(CONFIG_FILE)
99
/** @type {import('next').NextConfig} */
1010
const nextConfig = {
1111
env: {
12-
NEXT_PUBLIC_TITLE: config?.title ?? 'ChatGPT Admin Web',
13-
NEXT_PUBLIC_DESCRIPTION:
14-
config?.description ?? 'Your personal ChatGPT Bot.',
12+
TITLE: config?.brand?.title ?? config?.title ?? 'ChatGPT Admin Web',
13+
DESCRIPTION:
14+
config?.brand?.description ??
15+
config?.description ??
16+
'Your personal ChatGPT Bot.',
17+
LOGO: config?.brand?.logo?.index,
18+
LOGO_BOT: config?.brand?.logo?.bot,
19+
LOGO_LOGIN: config?.brand?.logo?.login,
20+
LOGO_LOADING: config?.brand?.logo?.loading,
21+
LOGO_SIDEBAR: config?.brand?.logo?.sidebar,
22+
ONBOARDING: config?.brand?.onboarding,
1523
},
1624
transpilePackages: ['shared'],
1725
webpack(config) {

packages/frontend/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@
3737
"sass": "^1.59.2",
3838
"shared": "workspace:*",
3939
"swr": "^2.2.4",
40+
"uuid": "^9.0.1",
4041
"zustand": "^4.3.6"
4142
},
4243
"devDependencies": {
4344
"@types/react": "^18.0.28",
4445
"@types/react-dom": "^18.0.11",
4546
"@types/react-katex": "^3.0.0",
47+
"@types/uuid": "^9.0.7",
4648
"autoprefixer": "^10.4.16",
4749
"postcss": "^8.4.31",
4850
"tailwindcss": "^3.3.5",

packages/frontend/src/app/(user-end)/chat/new/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
移除将会导致在客户端未刷新的情况下 randomUUID 永远相同 */
55
import { RedirectType, redirect } from 'next/navigation';
66

7+
import { randomUUID } from '@/utils/client-utils';
8+
79
export default function NewChatPage() {
8-
redirect(`/chat/${crypto.randomUUID()}?new=true`, RedirectType.replace);
10+
redirect(`/chat/${randomUUID()}?new=true`, RedirectType.replace);
911
}

packages/frontend/src/app/(user-end)/page.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { useRouter } from 'next/navigation';
55
import { IconButton } from '@/components/button';
66
import Chat from '@/components/chat';
77
import AddIcon from '@/icons/add.svg';
8-
import ReturnIcon from '@/icons/return.svg';
98
import ChatGptIcon from '@/icons/bot.svg';
9+
import ReturnIcon from '@/icons/return.svg';
1010
import Locale from '@/locales';
1111
import { useStore } from '@/store';
1212
import styles from '@/styles/module/welcome.module.scss';
@@ -26,10 +26,11 @@ export default function ChatPage() {
2626
className={styles['return-btn']}
2727
></IconButton>
2828
<div className={styles['welcome-container']}>
29-
<div className={styles['logo']}>
30-
</div>
29+
<div className={styles['logo']}></div>
3130
<div className={styles['title']}>{Locale.Index.Title}</div>
32-
<div className={styles['message']}>{Locale.Index.WelcomeCaption}</div>
31+
<div className={styles['message']}>
32+
{process.env.DESCRIPTION ?? Locale.Index.WelcomeCaption}
33+
</div>
3334
<IconButton
3435
text={Locale.Home.NewChat}
3536
icon={<AddIcon />}

packages/frontend/src/app/auth/page.tsx

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,18 @@ export default function AuthPage() {
270270
return (
271271
<div className={styles['auth-page']}>
272272
<div className={`no-dark ${styles['auth-logo']}`}>
273-
<BotIcon />
274-
</div>
275-
<div className={styles['auth-title']}>
276-
{process.env.NEXT_PUBLIC_TITLE}
273+
{!!process.env.LOGO_LOGIN ? (
274+
<Image
275+
src={process.env.LOGO_LOGIN}
276+
alt="Logo"
277+
width={100}
278+
height={100}
279+
/>
280+
) : (
281+
<BotIcon />
282+
)}
277283
</div>
284+
<div className={styles['auth-title']}>{Locales.Index.Title}</div>
278285
<div className={styles['auth-tips']}></div>
279286
<div className={styles['auth-container']}>
280287
{tab === 'code' ? (
@@ -289,20 +296,22 @@ export default function AuthPage() {
289296
<div className={styles['divider-text']}>OR</div>
290297
<div className={styles['divider-line']} />
291298
</div>
292-
<div className={styles['third-part-login-options']}>
293-
<div
294-
className={styles['third-part-option']}
295-
onClick={() => {
296-
setTab(() => {
297-
if (tab != 'wechat') return 'wechat';
298-
else return 'code';
299-
});
300-
}}
301-
>
302-
{tab == 'wechat' ? <VerificationCodeIcon /> : <WechatLogo />}
303-
<div>使用{tab == 'wechat' ? '验证码' : '微信'}登陆</div>
299+
{process.env.WECHAT && (
300+
<div className={styles['third-part-login-options']}>
301+
<div
302+
className={styles['third-part-option']}
303+
onClick={() => {
304+
setTab(() => {
305+
if (tab != 'wechat') return 'wechat';
306+
else return 'code';
307+
});
308+
}}
309+
>
310+
{tab == 'wechat' ? <VerificationCodeIcon /> : <WechatLogo />}
311+
<div>使用{tab == 'wechat' ? '验证码' : '微信'}登陆</div>
312+
</div>
304313
</div>
305-
</div>
314+
)}
306315
<div className={styles['third-part-login-options']}>
307316
<div
308317
className={styles['third-part-option']}

packages/frontend/src/app/layout.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import { SWRProvider } from '@/app/provider';
33

44
export const metadata = {
5-
title: process.env.NEXT_PUBLIC_TITLE,
6-
description: process.env.NEXT_PUBLIC_DESCRIPTION,
5+
title: process.env.TITLE,
6+
description: process.env.DESCRIPTION,
77
};
88

99
export default function RootLayout({
@@ -18,6 +18,9 @@ export default function RootLayout({
1818
name="viewport"
1919
content="width=device-width, userRef-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
2020
/>
21+
{process.env.LOGO && (
22+
<link rel="icon" type="image/svg+xml" href={process.env.LOGO} />
23+
)}
2124
<link rel="preconnect" href="https://fonts.googleapis.com"></link>
2225
<link rel="preconnect" href="https://fonts.gstatic.com"></link>
2326
<link

packages/frontend/src/components/avatar/index.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import dynamic from 'next/dynamic';
2+
import Image from 'next/image';
23

34
import BotIcon from '@/icons/bot.svg';
45
import LoadingIcon from '@/icons/three-dots.svg';
@@ -19,8 +20,18 @@ const Emoji = dynamic(async () => (await import('emoji-picker-react')).Emoji, {
1920
export function Avatar(props: { role: ChatMessage['role'] }) {
2021
const config = useStore((state) => state.config);
2122

22-
if (props.role === 'assistant') {
23-
return <BotIcon className={styles['user-avtar']} />;
23+
if (props.role !== 'user') {
24+
return process.env.LOGO_BOT ? (
25+
<Image
26+
src={process.env.LOGO_BOT}
27+
alt="Logo"
28+
className={styles['user-avtar']}
29+
width="30"
30+
height="30"
31+
/>
32+
) : (
33+
<BotIcon className={styles['user-avtar']} />
34+
);
2435
}
2536

2637
return (

packages/frontend/src/components/loading/index.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
1+
import Image from 'next/image';
2+
13
import BotIcon from '@/icons/bot.svg';
24
import LoadingIcon from '@/icons/three-dots.svg';
35
import styles from '@/styles/module/home.module.scss';
46

57
export function Loading(props: { noLogo?: boolean }) {
68
return (
79
<div className={styles['loading-content']}>
8-
{!props.noLogo && <BotIcon />}
10+
{!props.noLogo &&
11+
(process.env.LOGO_LOADING ? (
12+
<Image
13+
src={process.env.LOGO_LOADING}
14+
alt="logo"
15+
width="100"
16+
height="100"
17+
/>
18+
) : (
19+
<BotIcon />
20+
))}
921
<LoadingIcon />
1022
</div>
1123
);

packages/frontend/src/components/sidebar/index.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client';
22

33
import clsx from 'clsx';
4+
import Image from 'next/image';
45
import Link from 'next/link';
56
import { useRouter } from 'next/navigation';
67
import { useEffect, useState } from 'react';
@@ -198,7 +199,16 @@ export function Sidebar({ children }: { children: React.ReactNode }) {
198199
</div>
199200
)}
200201
<div className={styles['sidebar-logo']}>
201-
<ChatGptIcon />
202+
{process.env.LOGO_SIDEBAR ? (
203+
<Image
204+
src={process.env.LOGO_SIDEBAR}
205+
alt="Logo"
206+
width="48"
207+
height="48"
208+
/>
209+
) : (
210+
<ChatGptIcon />
211+
)}
202212
</div>
203213
</div>
204214
<div className={styles['sidebar-newbtn']}>

0 commit comments

Comments
 (0)