From 8cb2c95899e586e0e575919d7f9ffae7b1b26edf Mon Sep 17 00:00:00 2001 From: zhendi Date: Thu, 26 Sep 2024 20:44:12 +0800 Subject: [PATCH 1/7] check user exists when visit dataset and space detail --- internal/middleware/auth_middleware.go | 2 +- internal/routes/spaces.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/middleware/auth_middleware.go b/internal/middleware/auth_middleware.go index 4ee765715..957cdb2c9 100644 --- a/internal/middleware/auth_middleware.go +++ b/internal/middleware/auth_middleware.go @@ -32,7 +32,7 @@ func CheckCurrentUser() gin.HandlerFunc { return func(ctx *gin.Context) { currentUser := jwt.GetCurrentUser(ctx) if currentUser == nil { - ctx.Redirect(http.StatusFound, "/errors/unauthorized") + ctx.Redirect(http.StatusFound, "/login") ctx.Abort() return } diff --git a/internal/routes/spaces.go b/internal/routes/spaces.go index fcd56cb4e..d07518444 100644 --- a/internal/routes/spaces.go +++ b/internal/routes/spaces.go @@ -11,12 +11,6 @@ func registerSpaceRoutes(engine *gin.Engine, handlers *HandlersRegistry) { spaceRoutes := engine.Group("/spaces") { spaceRoutes.GET("", spaceHandler.List) - spaceRoutes.GET("/:namespace/:space_name", spaceHandler.Detail) - spaceRoutes.GET("/:namespace/:space_name/files/:branch/*path", spaceHandler.Files) - spaceRoutes.GET("/:namespace/:space_name/blob/:branch/*path", spaceHandler.Blob) - spaceRoutes.GET("/:namespace/:space_name/commits", spaceHandler.Commits) - spaceRoutes.GET("/:namespace/:space_name/commit/:commit_id", spaceHandler.Commit) - spaceRoutes.GET("/:namespace/:space_name/community", spaceHandler.Community) } authenticatedRoutes := spaceRoutes.Group("") @@ -28,5 +22,11 @@ func registerSpaceRoutes(engine *gin.Engine, handlers *HandlersRegistry) { authenticatedRoutes.GET("/:namespace/:space_name/edit/:branch/:path", spaceHandler.EditFile) authenticatedRoutes.GET("/:namespace/:space_name/settings", spaceHandler.Settings) authenticatedRoutes.GET("/:namespace/:space_name/billing", spaceHandler.Billing) + authenticatedRoutes.GET("/:namespace/:space_name", spaceHandler.Detail) + authenticatedRoutes.GET("/:namespace/:space_name/files/:branch/*path", spaceHandler.Files) + authenticatedRoutes.GET("/:namespace/:space_name/blob/:branch/*path", spaceHandler.Blob) + authenticatedRoutes.GET("/:namespace/:space_name/commits", spaceHandler.Commits) + authenticatedRoutes.GET("/:namespace/:space_name/commit/:commit_id", spaceHandler.Commit) + authenticatedRoutes.GET("/:namespace/:space_name/community", spaceHandler.Community) } } From b0a75a0096b3bb98ec3ce1b09827889f91f12053 Mon Sep 17 00:00:00 2001 From: SeanHH86 <154984842+SeanHH86@users.noreply.github.com> Date: Thu, 26 Sep 2024 15:56:27 +0800 Subject: [PATCH 2/7] Add init data of runtime arch (#677) --- deploy/all_in_one/init-scripts/init.sql | 103 +++++++++++++++++++++++- 1 file changed, 101 insertions(+), 2 deletions(-) diff --git a/deploy/all_in_one/init-scripts/init.sql b/deploy/all_in_one/init-scripts/init.sql index 0eb47e902..ad637f550 100644 --- a/deploy/all_in_one/init-scripts/init.sql +++ b/deploy/all_in_one/init-scripts/init.sql @@ -57,10 +57,109 @@ ON CONFLICT (name) INSERT INTO runtime_frameworks (id, frame_name, frame_version, frame_image, frame_cpu_image, enabled, container_port, type) VALUES ('1', 'VLLM', '2.7', 'vllm-local:2.7', 'vllm-cpu:2.3', 1, 8000, 1); INSERT INTO runtime_frameworks (id, frame_name, frame_version, frame_image, frame_cpu_image, enabled, container_port, type) VALUES ('3', 'TGI', '2.1', 'tgi:2.1', '', 1, 8000, 1); -INSERT INTO runtime_frameworks (id, frame_name, frame_version, frame_image, frame_cpu_image, enabled, container_port, type) VALUES ('4', 'FastChat', '1.2', ' ', '', 1, 8000, 1); -INSERT INTO runtime_frameworks (id, frame_name, frame_version, frame_image, frame_cpu_image, enabled, container_port, type) VALUES ('6', 'MindIE', '1.0', ' ', '', 1, 8000, 1); INSERT INTO runtime_frameworks (id, frame_name, frame_version, frame_image, frame_cpu_image, enabled, container_port, type) VALUES ('2', 'LLaMA-Factory', '1.11', 'llama-factory:1.18-cuda12.1-devel-ubuntu22.04-py310-torch2.1.2', '', 1, 8000, 2); +-- +-- Init data runtime frameworks architecture +-- + +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'AquilaForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'ArcticForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'BaiChuanForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'BloomForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'ChatGLMModel'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'CohereForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'DbrxForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'DeciLMForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'FalconForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'GemmaForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'Gemma2ForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'GPT2LMHeadModel'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'GPTBigCodeForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'GPTJForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'GPTNeoXForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'InternLMForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'InternLM2ForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'JAISLMHeadModel'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'JambaForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'LlamaForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'MiniCPMForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'MistralForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'MixtralForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'MPTForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'OLMoForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'OPTForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'OrionForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'PhiForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'Phi3ForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'Phi3SmallForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'PersimmonForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'QWenLMHeadModel'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'Qwen2ForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'Qwen2MoeForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'StableLmForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'Starcoder2ForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'XverseForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'ChameleonForConditionalGeneration'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'FuyuForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'LlavaForConditionalGeneration'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'LlavaNextForConditionalGeneration'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'PaliGemmaForConditionalGeneration'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(1, 'Phi3VForCausalLM'); + +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'BaiChuanForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'BloomForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'ChatGLMModel'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'CohereForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'DeepseekV2ForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'FalconForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'Gemma2ForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'GemmaForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'InternLM2ForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'InternLM2ForRewardModel'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'LlamaForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'LlavaForConditionalGeneration'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'LlavaNextForConditionalGeneration'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'MistralForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'MixtralForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'OlmoForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'PaliGemmaForConditionalGeneration'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'PhiForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'Phi3ForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'Qwen2ForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'QWenLMHeadModel'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'Qwen2MoeForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'Starcoder2ForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'XverseForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'LlavaLlamaForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(2, 'YuanForCausalLM'); + +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'DeepseekV2ForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'Idefics2ForConditionalGeneration'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'LlavaNextForConditionalGeneration'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'LlamaForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'Phi3ForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'GemmaForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'PaliGemmaForConditionalGeneration'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'CohereForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'DbrxForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'MistralForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'MixtralForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'GPTBigCodeForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'PhiForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'BaichuanForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'FalconForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'Starcoder2ForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'Qwen2ForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'OPTForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'T5ForConditionalGeneration'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'GPT2LMHeadCustomModel'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'BloomForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'MPTForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'GPT2LMHeadModel'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'GPTNeoXForCausalLM'); +INSERT INTO runtime_architectures (runtime_framework_id, architecture_name) VALUES(3, 'IdeficsForVisionText2Text'); + -- -- Name: runtime_frameworks_id_seq; Type: SEQUENCE SET; Owner: postgres -- From e3f2783003c9549a74a9f188846f4ef0b6d91177 Mon Sep 17 00:00:00 2001 From: rader Date: Thu, 26 Sep 2024 16:07:16 +0800 Subject: [PATCH 3/7] Update CONTRIBUTING_en.md fix issue: https://github.com/OpenCSGs/csghub/issues/682 --- docs/CONTRIBUTING_en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CONTRIBUTING_en.md b/docs/CONTRIBUTING_en.md index 5fd8e8139..cb3f6f590 100644 --- a/docs/CONTRIBUTING_en.md +++ b/docs/CONTRIBUTING_en.md @@ -45,6 +45,6 @@ For an overview of the labeling system we use to tag issues and pull requests, p Local Development ---------------------- -You can develop CSGHub using [Docker Compose](docs/all_in_one_readme_en.md) or your [local environment](docs/setup_en.md). +You can develop CSGHub using [Docker Compose](all_in_one_readme_en.md) or your [local environment](setup_en.md). Thank you for contributing to the CSGHub project! We look forward to your involvement and suggestions. From df04175fb23931159ad21f1d2fc5a0e2b908d36d Mon Sep 17 00:00:00 2001 From: Hiveer Date: Thu, 26 Sep 2024 16:15:45 +0800 Subject: [PATCH 4/7] Bug fix for multi-sync (#685) --- frontend/src/components/new_admin/sync/AdminSyncSetting.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/new_admin/sync/AdminSyncSetting.vue b/frontend/src/components/new_admin/sync/AdminSyncSetting.vue index d15aa0131..b545c5200 100644 --- a/frontend/src/components/new_admin/sync/AdminSyncSetting.vue +++ b/frontend/src/components/new_admin/sync/AdminSyncSetting.vue @@ -51,6 +51,7 @@

{{ $t('admin.syncSetting.queues') }}

@@ -117,7 +118,7 @@ } const createSyncSetting = async () => { - const createEndpoint = '/sync/client_settings' + const createEndpoint = '/sync/client_setting' const {data, error} = await useFetchApi(createEndpoint, { method: 'POST', headers: { @@ -133,7 +134,7 @@ } const fetchSyncSettings = async () => { - const settingsEndpoint = '/sync/client_settings' + const settingsEndpoint = '/sync/client_setting' const {data, _} = await useFetchApi(settingsEndpoint, { method: 'GET', headers: { From a48cda53858bfaaf9bf06edd3f1e7e63ba81bc9c Mon Sep 17 00:00:00 2001 From: "Zhendi.Wang" Date: Thu, 26 Sep 2024 19:09:17 +0800 Subject: [PATCH 5/7] Fix redirect links when session errors (#681) * fix redirect links when session errors * fix set roles bug --- internal/handlers/render/session.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/handlers/render/session.go b/internal/handlers/render/session.go index fd17c3047..f42d6a082 100644 --- a/internal/handlers/render/session.go +++ b/internal/handlers/render/session.go @@ -57,7 +57,7 @@ func (i *SessionHandlerImpl) Create(ctx *gin.Context) { jwtToken := ctx.Query("jwt") if jwtToken == "" { slog.Error("Login Error", "error", "jwt is blank") - ctx.Redirect(http.StatusFound, "/error/login-failed?error_msg='invalid jwt token'") + ctx.Redirect(http.StatusFound, "/errors/login-failed?error_msg='invalid jwt token'") return } userResp, _, err := i.Server.VerifyJWTToken(jwtToken) @@ -70,7 +70,7 @@ func (i *SessionHandlerImpl) Create(ctx *gin.Context) { if userResp == nil { slog.Error("Login Error", "error", "verify jwt token failed", "jwt", jwtToken) - ctx.Redirect(http.StatusFound, "/error/login-failed?error_msg='invalid jwt token'") + ctx.Redirect(http.StatusFound, "/errors/login-failed?error_msg='invalid jwt token'") return } @@ -89,8 +89,6 @@ func (i *SessionHandlerImpl) Create(ctx *gin.Context) { LoginIdentity: userResp.UUID, } - user.SetRoles(userResp.Roles...) - err = i.userModel.Create(ctx, user) if err != nil { stackTrace := string(debug.Stack()) @@ -99,11 +97,13 @@ func (i *SessionHandlerImpl) Create(ctx *gin.Context) { return } } else { - ctx.Redirect(http.StatusFound, "/error/login-failed?error_msg='invalid jwt token'") + ctx.Redirect(http.StatusFound, "/errors/login-failed?error_msg='invalid jwt token'") return } } + user.SetRoles(userResp.Roles...) + ctx.SetCookie("login_identity", user.LoginIdentity, cookieMaxAge, "/", "", false, false) ctx.SetCookie("current_user", user.Name, cookieMaxAge, "/", "", false, false) ctx.SetCookie("admin_user", fmt.Sprintf("%t", user.IsAdmin()), cookieMaxAge, "/", "", false, false) From f2f9fb08f4d09d19db784451db7c2fe91a3ececd Mon Sep 17 00:00:00 2001 From: Hiveer Date: Thu, 26 Sep 2024 20:05:17 +0800 Subject: [PATCH 6/7] Fix multisync button (#688) * Bug fix: check user roles in repo clone * Fix typo --- frontend/src/components/new_admin/AdminNavbar.vue | 2 +- frontend/src/components/shared/RepoClone.vue | 4 +++- frontend/src/locales/en_js/admin.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/new_admin/AdminNavbar.vue b/frontend/src/components/new_admin/AdminNavbar.vue index 20b49104a..3cadc7e2d 100644 --- a/frontend/src/components/new_admin/AdminNavbar.vue +++ b/frontend/src/components/new_admin/AdminNavbar.vue @@ -1,7 +1,7 @@