chore: first login to default page by localhost

This commit is contained in:
jialin
2025-02-25 15:04:05 +08:00
parent 0f7d04e0b9
commit e1959f74aa
3 changed files with 21 additions and 3 deletions
+19 -1
View File
@@ -6,10 +6,28 @@ import {
queryVersionInfo,
updateCheck
} from '@/services/profile/apis';
import { isOnline } from '@/utils';
import {
IS_FIRST_LOGIN,
readState,
writeState
} from '@/utils/localstore/index';
import { RequestConfig, history } from '@umijs/max';
const loginPath = '/login';
// only for the first login and access from http://localhost
const checkDefaultPage = async (userInfo: any) => {
const isFirstLogin = await readState(IS_FIRST_LOGIN);
if (isFirstLogin === null && isOnline()) {
writeState(IS_FIRST_LOGIN, true);
if (userInfo && userInfo?.is_admin) {
history.push('/models/list');
}
}
};
// runtime configuration
export async function getInitialState(): Promise<{
fetchUserInfo: () => Promise<Global.UserInfo>;
@@ -62,7 +80,7 @@ export async function getInitialState(): Promise<{
if (![loginPath].includes(location.pathname)) {
const userInfo = await fetchUserInfo();
checkDefaultPage(userInfo);
return {
fetchUserInfo,
currentUser: userInfo
+1 -1
View File
@@ -103,7 +103,7 @@ export default {
'Specify the model directory that contains .safetensors and config.json files, e.g., /usr/local/models/model/.',
'models.localpath.chunks.tips': `Specify the first shard file of the model, e.g., /usr/local/models/model-00001-of-00004.gguf.`,
'models.form.replicas.tips':
'Multiple replicas enable load balancing for inference requests.',
'Multiple replicas enable load balancing for /v1-openai inference requests.',
'models.table.list.empty': 'No Models yet!',
'models.table.list.getStart':
'<span style="margin-right: 5px;font-size: 13px;">Get started with</span> <span style="font-size: 14px;font-weight: 700">DeepSeek-R1-Distill-Qwen-1.5B</span>'
+1 -1
View File
@@ -99,7 +99,7 @@ export default {
'指向包含 .safetensors, config.json 文件的模型目录,例如 /usr/local/models/model/',
'models.localpath.chunks.tips':
'指向模型第一个分片文件,例如 /usr/local/models/model-00001-of-00004.gguf',
'models.form.replicas.tips': '多副本数实现推理请求的负载均衡',
'models.form.replicas.tips': '多副本数实现 /v1-openai 接口推理请求的负载均衡',
'models.table.list.empty': '暂无已部署模型',
'models.table.list.getStart':
'<span style="margin-right: 5px;font-size: 13px;">一键部署</span><span style="font-size: 14px;font-weight: 700">DeepSeek-R1-Distill-Qwen-1.5B</span><span style="margin-left: 5px;font-size: 13px;">立即使用!</span>'