diff --git a/src/app.tsx b/src/app.tsx index 60ea122c..86e4cf6a 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -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; @@ -62,7 +80,7 @@ export async function getInitialState(): Promise<{ if (![loginPath].includes(location.pathname)) { const userInfo = await fetchUserInfo(); - + checkDefaultPage(userInfo); return { fetchUserInfo, currentUser: userInfo diff --git a/src/locales/en-US/models.ts b/src/locales/en-US/models.ts index 8a0521fe..07872fa4 100644 --- a/src/locales/en-US/models.ts +++ b/src/locales/en-US/models.ts @@ -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': 'Get started with DeepSeek-R1-Distill-Qwen-1.5B' diff --git a/src/locales/zh-CN/models.ts b/src/locales/zh-CN/models.ts index ca5bca1b..640e8617 100644 --- a/src/locales/zh-CN/models.ts +++ b/src/locales/zh-CN/models.ts @@ -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': '一键部署DeepSeek-R1-Distill-Qwen-1.5B立即使用!'