Skip to content

Commit ce88b75

Browse files
author
Apple\Apple
committed
🎨 refactor(ui): modernize setup page
- Refactored system initialization page using TailwindCSS 3 and SemiUI components - Changed layout from step navigation to single page display for all configurations - Modified top area from vertical to more compact horizontal layout - Updated gradient color scheme from blue/purple to orange/pink - Fixed form field name duplication issues and optimized Form implementation - Changed usage mode selection from three-column grid to vertical layout - Replaced usage mode card icons from settings to more appropriate Layers icon - Added specific prompts for different database types (SQLite/MySQL/PostgreSQL) - Removed configuration summary section while keeping the initialization button - Fixed useSetupCheck issue by using SetupCheck as a direct component for proper redirection
1 parent 933327b commit ce88b75

File tree

6 files changed

+471
-180
lines changed

6 files changed

+471
-180
lines changed

web/src/App.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import Playground from './pages/Playground/index.js';
2525
import OAuth2Callback from './components/auth/OAuth2Callback.js';
2626
import PersonalSetting from './components/settings/PersonalSetting.js';
2727
import Setup from './pages/Setup/index.js';
28-
import { useSetupCheck } from './hooks/useSetupCheck.js';
28+
import SetupCheck from './components/layout/SetupCheck.js';
2929

3030
const Home = lazy(() => import('./pages/Home'));
3131
const Detail = lazy(() => import('./pages/Detail'));
@@ -35,7 +35,7 @@ function App() {
3535
const location = useLocation();
3636

3737
return (
38-
<useSetupCheck>
38+
<SetupCheck>
3939
<Routes>
4040
<Route
4141
path='/'
@@ -290,7 +290,7 @@ function App() {
290290
/>
291291
<Route path='*' element={<NotFound />} />
292292
</Routes>
293-
</useSetupCheck>
293+
</SetupCheck>
294294
);
295295
}
296296

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React, { useContext, useEffect } from 'react';
2+
import { Navigate, useLocation } from 'react-router-dom';
3+
import { StatusContext } from '../../context/Status';
4+
5+
const SetupCheck = ({ children }) => {
6+
const [statusState] = useContext(StatusContext);
7+
const location = useLocation();
8+
9+
useEffect(() => {
10+
if (statusState?.status?.setup === false && location.pathname !== '/setup') {
11+
window.location.href = '/setup';
12+
}
13+
}, [statusState?.status?.setup, location.pathname]);
14+
15+
return children;
16+
};
17+
18+
export default SetupCheck;

web/src/hooks/useSetupCheck.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

web/src/hooks/useTokenKeys.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function useTokenKeys(id) {
1313
if (fetchedKeys.length === 0) {
1414
showError('当前没有可用的启用令牌,请确认是否有令牌处于启用状态!');
1515
setTimeout(() => {
16-
window.location.href = '/token';
16+
window.location.href = '/console/token';
1717
}, 1500); // 延迟 1.5 秒后跳转
1818
}
1919
setKeys(fetchedKeys);

web/src/i18n/locales/en.json

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,7 @@
13671367
"提示 {{nonCacheInput}} tokens + 缓存 {{cacheInput}} tokens * {{cacheRatio}} / 1M tokens * ${{price}} + 补全 {{completion}} tokens / 1M tokens * ${{compPrice}} * 分组 {{ratio}} = ${{total}}": "Prompt {{nonCacheInput}} tokens + cache {{cacheInput}} tokens * {{cacheRatio}} / 1M tokens * ${{price}} + completion {{completion}} tokens / 1M tokens * ${{compPrice}} * group {{ratio}} = ${{total}}",
13681368
"缓存 Tokens": "Cache Tokens",
13691369
"系统初始化": "System initialization",
1370-
"管理员账号已经初始化过,请继续设置系统参数": "The admin account has already been initialized, please continue to set the system parameters",
1370+
"管理员账号已经初始化过,请继续设置其他参数": "The admin account has already been initialized, please continue to set other parameters",
13711371
"管理员账号": "Admin account",
13721372
"请输入管理员用户名": "Please enter the admin username",
13731373
"请输入管理员密码": "Please enter the admin password",
@@ -1532,5 +1532,24 @@
15321532
"搜索条件": "Search Conditions",
15331533
"加载中...": "Loading...",
15341534
"暂无公告": "No Notice",
1535-
"操练场": "Playground"
1535+
"操练场": "Playground",
1536+
"欢迎使用,请完成以下设置以开始使用系统": "Welcome to use, please complete the following settings to start using the system",
1537+
"数据库信息": "Database Information",
1538+
"您正在使用 MySQL 数据库。MySQL 是一个可靠的关系型数据库管理系统,适合生产环境使用。": "You are using the MySQL database. MySQL is a reliable relational database management system, suitable for production environments.",
1539+
"您正在使用 PostgreSQL 数据库。PostgreSQL 是一个功能强大的开源关系型数据库系统,提供了出色的可靠性和数据完整性,适合生产环境使用。": "You are using the PostgreSQL database. PostgreSQL is a powerful open-source relational database system that provides excellent reliability and data integrity, suitable for production environments.",
1540+
"设置系统管理员的登录信息": "Set the login information for the system administrator",
1541+
"选择适合您使用场景的模式": "Select the mode suitable for your usage scenario",
1542+
"使用模式说明": "Usage mode description",
1543+
"计费模式": "Billing mode",
1544+
"多用户支持": "Multi-user support",
1545+
"个人使用": "Personal use",
1546+
"功能演示": "Function demonstration",
1547+
"体验试用": "Experience trial",
1548+
"默认模式": "Default Mode",
1549+
"无需计费": "No Charge",
1550+
"演示体验": "Demo Experience",
1551+
"提供基础功能演示,方便用户了解系统特性。": "Provide basic feature demonstrations to help users understand the system features.",
1552+
"适用于为多个用户提供服务的场景": "Suitable for scenarios where multiple users are provided.",
1553+
"适用于个人使用的场景,不需要设置模型价格": "Suitable for personal use, no need to set model price.",
1554+
"适用于展示系统功能的场景,提供基础功能演示": "Suitable for scenarios where the system functions are displayed, providing basic feature demonstrations."
15361555
}

0 commit comments

Comments
 (0)