Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type #690

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 101 additions & 2 deletions deploy/all_in_one/init-scripts/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
--
Expand Down
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion frontend/src/components/new_admin/AdminNavbar.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="w-full h-[60px] bg-[#1C7A6C]">
<div class="max-w-[1280px] m-auto h-full flex justify-between items-center">
<p class="font-[700] text-[#D1DDD0]"> OpenCSG Admin Pannel </p>
<p class="font-[700] text-[#D1DDD0]"> OpenCSG Admin Panel </p>
<a href="/" target="_blank" class="font-[500] text-[#D1DDD0] underline"> Open Site </a>
<p class="text-[#D1DDD0]">{{ userName }} ( {{ userRoles }} )</p>
</div>
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/new_admin/sync/AdminSyncSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<h3 class="mb-5">{{ $t('admin.syncSetting.queues') }}</h3>

<el-table
v-if="queues.length > 0"
:data="queues"
style="width: 100%"
>
Expand Down Expand Up @@ -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: {
Expand All @@ -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: {
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/shared/RepoClone.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@
import useFetchApi from '../../packs/useFetchApi'
import { ElMessage } from "element-plus"
import AddToCollections from '../collections/AddToCollections.vue'
import useUserStore from '../../stores/UserStore'

const userStore = useUserStore()
const { cookies } = useCookies()

const props = defineProps({
Expand Down Expand Up @@ -226,7 +228,7 @@ git clone ${httpCloneProtocol.value}//${
const accessToken = ref('')

const showSyncButton = computed(() =>
props.admin &&
userStore.roles.includes('admin') &&
props.repo.source === 'opencsg' &&
['pending', 'inprogress', 'failed'].includes(props.repo.sync_status)
)
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/locales/en_js/admin.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const admin = {
dashboard: {
title: 'Admin Dashboard',
intro: 'This is the admin pannel, admin users can do the system settings here.'
intro: 'This is the admin panel, admin users can do the system settings here.'
},
syncSetting: {
title: 'Sync Setting',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/locales/en_js/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const navbar = {
newOrganization: "New Organization",
logout: "Logout",
register: "Register",
loginRegister: "Login/Registe",
loginRegister: "Login/Register",
login: "Login",
newCollection: "New Collection",
emailMissing: 'Please provide your email address before proceeding',
Expand Down
10 changes: 5 additions & 5 deletions internal/handlers/render/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}

Expand All @@ -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())
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion internal/middleware/auth_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
12 changes: 6 additions & 6 deletions internal/routes/spaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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("")
Expand All @@ -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)
}
}
Loading