chore: first login to default page by localhost
This commit is contained in:
+19
-1
@@ -6,10 +6,28 @@ import {
|
|||||||
queryVersionInfo,
|
queryVersionInfo,
|
||||||
updateCheck
|
updateCheck
|
||||||
} from '@/services/profile/apis';
|
} from '@/services/profile/apis';
|
||||||
|
import { isOnline } from '@/utils';
|
||||||
|
import {
|
||||||
|
IS_FIRST_LOGIN,
|
||||||
|
readState,
|
||||||
|
writeState
|
||||||
|
} from '@/utils/localstore/index';
|
||||||
import { RequestConfig, history } from '@umijs/max';
|
import { RequestConfig, history } from '@umijs/max';
|
||||||
|
|
||||||
const loginPath = '/login';
|
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
|
// runtime configuration
|
||||||
export async function getInitialState(): Promise<{
|
export async function getInitialState(): Promise<{
|
||||||
fetchUserInfo: () => Promise<Global.UserInfo>;
|
fetchUserInfo: () => Promise<Global.UserInfo>;
|
||||||
@@ -62,7 +80,7 @@ export async function getInitialState(): Promise<{
|
|||||||
|
|
||||||
if (![loginPath].includes(location.pathname)) {
|
if (![loginPath].includes(location.pathname)) {
|
||||||
const userInfo = await fetchUserInfo();
|
const userInfo = await fetchUserInfo();
|
||||||
|
checkDefaultPage(userInfo);
|
||||||
return {
|
return {
|
||||||
fetchUserInfo,
|
fetchUserInfo,
|
||||||
currentUser: userInfo
|
currentUser: userInfo
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export default {
|
|||||||
'Specify the model directory that contains .safetensors and config.json files, e.g., /usr/local/models/model/.',
|
'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.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':
|
'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.empty': 'No Models yet!',
|
||||||
'models.table.list.getStart':
|
'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>'
|
'<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>'
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ export default {
|
|||||||
'指向包含 .safetensors, config.json 文件的模型目录,例如 /usr/local/models/model/',
|
'指向包含 .safetensors, config.json 文件的模型目录,例如 /usr/local/models/model/',
|
||||||
'models.localpath.chunks.tips':
|
'models.localpath.chunks.tips':
|
||||||
'指向模型第一个分片文件,例如 /usr/local/models/model-00001-of-00004.gguf',
|
'指向模型第一个分片文件,例如 /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.empty': '暂无已部署模型',
|
||||||
'models.table.list.getStart':
|
'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>'
|
'<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>'
|
||||||
|
|||||||
Reference in New Issue
Block a user