diff --git a/agent/app/repo/app_launcher.go b/agent/app/repo/app_launcher.go index 8210e832f..b08c0c5ab 100644 --- a/agent/app/repo/app_launcher.go +++ b/agent/app/repo/app_launcher.go @@ -86,7 +86,7 @@ func (u *LauncherRepo) ListQuickJump(withAll bool) []model.QuickJump { } if !withAll && len(quicks) == 0 { return []model.QuickJump{ - {Name: "ModelServices", Title: "aiTools.model.model", Recommend: 0, IsShow: true, Router: "/ai/model"}, + {Name: "ModelServices", Title: "aiTools.model.model", Recommend: 0, IsShow: true, Router: "/ai/model-services"}, {Name: "Agent", Title: "aiTools.agents.agent", Recommend: 1, IsShow: true, Router: "/ai/agents/agent"}, {Name: "Website", Title: "menu.website", Recommend: 10, IsShow: true, Router: "/websites"}, {Name: "Database", Title: "menu.database", Recommend: 30, IsShow: true, Router: "/databases"}, diff --git a/agent/init/migration/migrate.go b/agent/init/migration/migrate.go index 9437be7b8..78bd7c59a 100644 --- a/agent/init/migration/migrate.go +++ b/agent/init/migration/migrate.go @@ -120,6 +120,7 @@ func agentDBMigrations() []*gormigrate.Migration { migrations.AddContainerImageCheckUpdates, migrations.AddModelQuickJump, migrations.MigrateVMDatabase, + migrations.UpdateModelServicesQuickJumpRouter, } } diff --git a/agent/init/migration/migrations/init.go b/agent/init/migration/migrations/init.go index 5d918daf1..dc77ef2b4 100644 --- a/agent/init/migration/migrations/init.go +++ b/agent/init/migration/migrations/init.go @@ -1938,3 +1938,12 @@ var AddModelQuickJump = &gormigrate.Migration{ }).Error }, } + +var UpdateModelServicesQuickJumpRouter = &gormigrate.Migration{ + ID: "20261105-update-model-services-quick-jump-router", + Migrate: func(tx *gorm.DB) error { + return tx.Model(&model.QuickJump{}). + Where("name = ? AND router IN ?", "ModelServices", []string{"/ai/model", "/ai/model/account"}). + Update("router", "/ai/model-services").Error + }, +} diff --git a/core/constant/common.go b/core/constant/common.go index 0e49ca5f2..9157eda3d 100644 --- a/core/constant/common.go +++ b/core/constant/common.go @@ -57,6 +57,11 @@ var WebUrlMap = map[string]struct{}{ "/apps/upgrade": {}, "/apps/setting": {}, + "/ai/ollama": {}, + "/ai/model-services": {}, + "/ai/vllm": {}, + "/ai/vllm/models": {}, + "/ai/vllm/deployments": {}, "/ai": {}, "/ai/ai-proxy": {}, "/ai/ai-proxy/overview": {}, @@ -71,12 +76,6 @@ var WebUrlMap = map[string]struct{}{ "/ai/skills-hub": {}, "/ai/skills-hub/targets": {}, "/ai/benchmark": {}, - "/ai/model": {}, - "/ai/model/account": {}, - "/ai/model/local": {}, - "/ai/model/local/ollama": {}, - "/ai/model/local/templates": {}, - "/ai/model/files": {}, "/ai/gpu": {}, "/ai/gpu/current": {}, "/ai/gpu/history": {}, diff --git a/core/init/migration/helper/menu.go b/core/init/migration/helper/menu.go index 9d3dabe98..4079aa3f0 100644 --- a/core/init/migration/helper/menu.go +++ b/core/init/migration/helper/menu.go @@ -96,14 +96,14 @@ func LoadMenus() string { item := []dto.ShowMenu{ {ID: "1", Disabled: true, Title: "menu.home", IsShow: true, Label: "Home-Menu", Path: "/", Sort: 100}, {ID: "2", Disabled: true, Title: "menu.apps", IsShow: true, Label: "App-Menu", Path: "/apps/all", Sort: 200}, - {ID: "3", Disabled: false, Title: "menu.aiTools", IsShow: true, Label: "AI-Menu", Path: "/ai/model/files", Sort: 300, + {ID: "3", Disabled: false, Title: "menu.aiTools", IsShow: true, Label: "AI-Menu", Path: "/ai/vllm/models", Sort: 300, Children: []dto.ShowMenu{ - {ID: "48", Disabled: false, Title: "aiTools.model.ollamaManagement", IsShow: true, Label: "OllamaModels", Path: "/ai/model/local/ollama", Sort: 25}, - {ID: "41", Disabled: false, Title: "aiTools.model.vllmManagement", IsShow: true, Label: "AIModel", Path: "/ai/model/files", Sort: 50}, - {ID: "49", Disabled: false, Title: "aiTools.model.services", IsShow: true, Label: "ModelServices", Path: "/ai/model/account", Sort: 75}, - {ID: "44", Disabled: false, Title: "aiTools.agents.agent", IsShow: true, Label: "Agents", Path: "/ai/agents/agent", Sort: 100}, + {ID: "43", Disabled: false, Title: "aiTools.gpu.gpu", IsShow: true, Label: "GPU", Path: "/ai/gpu", Sort: 10}, + {ID: "48", Disabled: false, Title: "aiTools.model.ollamaManagement", IsShow: true, Label: "OllamaModels", Path: "/ai/ollama", Sort: 25}, + {ID: "41", Disabled: false, Title: "aiTools.model.vllmManagement", IsShow: true, Label: "AIModel", Path: "/ai/vllm/models", Sort: 50}, + {ID: "49", Disabled: false, Title: "aiTools.model.services", IsShow: true, Label: "ModelServices", Path: "/ai/model-services", Sort: 75}, + {ID: "44", Disabled: false, Title: "aiTools.agents.agent", IsShow: true, Label: "Agents", Path: "/ai/agents/agent", Sort: 150}, {ID: "42", Disabled: false, Title: "menu.mcp", IsShow: true, Label: "MCPServer", Path: "/ai/mcp", Sort: 200}, - {ID: "43", Disabled: false, Title: "aiTools.gpu.gpu", IsShow: true, Label: "GPU", Path: "/ai/gpu", Sort: 300}, }}, {ID: "4", Disabled: false, Title: "menu.website", IsShow: true, Label: "Website-Menu", Path: "/websites", Sort: 400, Children: []dto.ShowMenu{ @@ -151,8 +151,8 @@ func LoadMenus() string { IsShow: true, Label: "AIProxyManagement", Path: "/ai/ai-proxy/model-pool", - Sort: 150, - }, "Agents") + Sort: 125, + }, "ModelServices") item[i].Children = UpsertMenuByLabel(item[i].Children, dto.ShowMenu{ ID: "47", Disabled: false, @@ -161,7 +161,7 @@ func LoadMenus() string { Label: "SkillsHub", Path: "/ai/skills-hub", Sort: 175, - }, "AIProxyManagement") + }, "Agents") item[i].Children = UpsertMenuByLabel(item[i].Children, dto.ShowMenu{ ID: "45", Disabled: false, @@ -169,8 +169,8 @@ func LoadMenus() string { IsShow: true, Label: "AIBenchmark", Path: "/ai/benchmark", - Sort: 350, - }, "GPU") + Sort: 100, + }, "ModelServices") continue } if item[i].Label != "Xpack-Menu" { @@ -206,15 +206,15 @@ func MenuSort() []dto.MenuLabelSort { {Label: "Home-Menu", Sort: 100}, {Label: "App-Menu", Sort: 200}, {Label: "AI-Menu", Sort: 300}, + {Label: "GPU", Sort: 10}, {Label: "OllamaModels", Sort: 25}, {Label: "AIModel", Sort: 50}, {Label: "ModelServices", Sort: 75}, - {Label: "Agents", Sort: 100}, - {Label: "AIProxyManagement", Sort: 150}, + {Label: "AIBenchmark", Sort: 100}, + {Label: "AIProxyManagement", Sort: 125}, + {Label: "Agents", Sort: 150}, {Label: "SkillsHub", Sort: 175}, {Label: "MCPServer", Sort: 200}, - {Label: "GPU", Sort: 300}, - {Label: "AIBenchmark", Sort: 350}, {Label: "Website-Menu", Sort: 400}, {Label: "Website", Sort: 100}, {Label: "SSL", Sort: 200}, diff --git a/core/init/migration/migrate.go b/core/init/migration/migrate.go index a81bc626c..a134fd875 100644 --- a/core/init/migration/migrate.go +++ b/core/init/migration/migrate.go @@ -76,5 +76,6 @@ func coreMigrations() []*gormigrate.Migration { migrations.MoveVirtualMachineMenuToTopLevel, migrations.UpdateAiModelManagementMenus, migrations.AddModelServicesMenu, + migrations.UpdateAiMenus, } } diff --git a/core/init/migration/migrations/init.go b/core/init/migration/migrations/init.go index 13364ff6e..d9ab16ac2 100644 --- a/core/init/migration/migrations/init.go +++ b/core/init/migration/migrations/init.go @@ -1490,3 +1490,47 @@ var UpdateFirewallMenuPath = &gormigrate.Migration{ }) }, } + +var UpdateAiMenus = &gormigrate.Migration{ + ID: "20261105-update-ai-menus", + Migrate: func(tx *gorm.DB) error { + return helper.UpdateHideMenu(tx, func(menus []dto.ShowMenu) []dto.ShowMenu { + sorts := map[string]int{ + "GPU": 10, + "OllamaModels": 25, + "AIModel": 50, + "ModelServices": 75, + "AIBenchmark": 100, + "AIProxyManagement": 125, + "Agents": 150, + "SkillsHub": 175, + "MCPServer": 200, + } + paths := map[string]string{ + "/ai/model": "/ai/vllm", + "/ai/model/files": "/ai/vllm/models", + "/ai/model/local": "/ai/vllm/deployments", + "/ai/model/local/ollama": "/ai/ollama", + "/ai/model/account": "/ai/model-services", + } + for i := range menus { + if menus[i].Label != "AI-Menu" { + continue + } + if path, ok := paths[menus[i].Path]; ok { + menus[i].Path = path + } + for j := range menus[i].Children { + if sort, ok := sorts[menus[i].Children[j].Label]; ok { + menus[i].Children[j].Sort = sort + } + if path, ok := paths[menus[i].Children[j].Path]; ok { + menus[i].Children[j].Path = path + } + } + break + } + return menus + }) + }, +} diff --git a/frontend/src/routers/modules/ai.ts b/frontend/src/routers/modules/ai.ts index b99387335..72765fe8e 100644 --- a/frontend/src/routers/modules/ai.ts +++ b/frontend/src/routers/modules/ai.ts @@ -6,14 +6,25 @@ const aiRouter = { path: '/ai', name: 'AI-Menu', component: Layout, - redirect: '/ai/model/account', + redirect: '/ai/model-services', meta: { icon: 'p-jiqiren2', title: 'menu.aiTools', }, children: [ { - path: '/ai/model/local/ollama', + path: '/ai/gpu/current', + name: 'GPU', + component: () => import('@/views/ai/gpu/current/index.vue'), + meta: { + icon: 'p-gpu-menu', + title: 'aiTools.gpu.gpu', + activeMenu: '/ai/gpu/current', + permission: 'ai_gpu_view', + }, + }, + { + path: '/ai/ollama', name: 'OllamaModels', component: () => import('@/views/ai/ollama/index.vue'), meta: { @@ -23,13 +34,13 @@ const aiRouter = { }, }, { - path: '/ai/model/account', + path: '/ai/model-services', name: 'ModelServices', component: () => import('@/views/ai/model/index.vue'), meta: { icon: 'p-moxing-menu', title: 'aiTools.model.services', - activeMenu: '/ai/model/account', + activeMenu: '/ai/model-services', permission: 'ai_model_view', }, }, @@ -75,17 +86,6 @@ const aiRouter = { permission: 'mcp_access_view', }, }, - { - path: '/ai/gpu/current', - name: 'GPU', - component: () => import('@/views/ai/gpu/current/index.vue'), - meta: { - icon: 'p-gpu-menu', - title: 'aiTools.gpu.gpu', - activeMenu: '/ai/gpu/current', - permission: 'ai_gpu_view', - }, - }, { path: '/ai/gpu/history', name: 'GPUHistory', diff --git a/frontend/src/utils/app.ts b/frontend/src/utils/app.ts index 9a5c6407c..f14b047f5 100644 --- a/frontend/src/utils/app.ts +++ b/frontend/src/utils/app.ts @@ -41,7 +41,7 @@ export const jumpToInstall = (type: string, key: string) => { case 'vllm': if (globalStore.isProductPro && router.hasRoute('LocalModel')) { router.push({ - path: '/ai/model/local', + path: '/ai/vllm/deployments', query: { engine: 'vllm', uncached: 'true', diff --git a/frontend/src/views/ai/model/index.vue b/frontend/src/views/ai/model/index.vue index da34ca689..8d987c3a4 100644 --- a/frontend/src/views/ai/model/index.vue +++ b/frontend/src/views/ai/model/index.vue @@ -1,6 +1,6 @@