-
-
-
Add your SSH public key
+
+
+
Add your SSH public key
to clone private repos
# {{ $t('all.lfsTips') }}
@@ -147,16 +213,25 @@
-
-
- Use
-
SDK
- to download
+
+
+ Use
+
+ SDK
+
+ to download
# {{ $t('all.sdkTips') }}
-
+
@@ -170,7 +245,7 @@
import DeployDropdown from './DeployDropdown.vue'
import SvgIcon from './SvgIcon.vue'
import useFetchApi from '../../packs/useFetchApi'
- import { ElMessage } from "element-plus"
+ import { ElMessage } from 'element-plus'
import AddToCollections from '../collections/AddToCollections.vue'
import useUserStore from '../../stores/UserStore'
@@ -183,7 +258,8 @@
repo: Object,
enableEndpoint: Boolean,
enableFinetune: Boolean,
- showAddToCollections: Boolean
+ enableEvaluation: Boolean,
+ showAddToCollections: Boolean,
})
const httpCloneUrl = ref('')
@@ -208,19 +284,20 @@
git lfs install
git clone ${httpCloneUrl.value}
`
- // no space
- sshCloneCode.value = `
+ // no space
+ sshCloneCode.value = `
git lfs install
git clone ${sshCloneUrl.value}
`
- // no space
- httpsCloneCodeWithToken.value = `
+ // no space
+ httpsCloneCodeWithToken.value = `
git lfs install
-git clone ${httpCloneProtocol.value}//${
- userStore.username
- }:${accessToken.value}@${httpCloneUrl.value.replace(`${httpCloneProtocol.value}//`, '')}
+git clone ${httpCloneProtocol.value}//${userStore.username}:${
+ accessToken.value
+ }@${httpCloneUrl.value.replace(`${httpCloneProtocol.value}//`, '')}
`
- })
+ }
+ )
const activeCloneType = ref('https')
const cloneRepositoryVisible = ref(false)
@@ -242,7 +319,9 @@ git clone ${httpCloneProtocol.value}//${
// 同步按钮禁用
const syncInprogress = computed(() => {
- return props.repo.source === 'opencsg' && props.repo.sync_status === 'inprogress'
+ return (
+ props.repo.source === 'opencsg' && props.repo.sync_status === 'inprogress'
+ )
})
const getMarkdownCode = (code, lang, multiline = false) => {
@@ -256,8 +335,11 @@ git clone ${httpCloneProtocol.value}//${
httpsCloneCodeWithToken.value = `
git lfs install
git clone ${httpCloneProtocol.value}//${
- userStore.username
- }:${newAccessToken}@${httpCloneUrl.value.replace(`${httpCloneProtocol.value}//`, '')}
+ userStore.username
+ }:${newAccessToken}@${httpCloneUrl.value.replace(
+ `${httpCloneProtocol.value}//`,
+ ''
+ )}
`
})
@@ -337,7 +419,7 @@ result = snapshot_download(repo_id, cache_dir=cache_dir, endpoint=endpoint, toke
window.location.href = `/finetune/new?model_id=${props.namespacePath}&repoType=${props.repoType}`
}
- const fetchUserToken = async() => {
+ const fetchUserToken = async () => {
if (!userStore.username) return
const { data } = await useFetchApi(
@@ -357,28 +439,30 @@ result = snapshot_download(repo_id, cache_dir=cache_dir, endpoint=endpoint, toke
}
})
- const handleSyncRepo = async () => {
+ const handleSyncRepo = async () => {
const syncUrl = `/${props.repoType}s/${props.namespacePath}/mirror_from_saas`
const { error } = await useFetchApi(syncUrl, {
headers: {
- "Content-Type": "application/json",
- },
- }).post().json()
+ 'Content-Type': 'application/json'
+ }
+ })
+ .post()
+ .json()
if (error.value) {
- ElMessage({message: error.value.msg, type: "warning"})
+ ElMessage({ message: error.value.msg, type: 'warning' })
} else {
- ElMessage({message: 'Sync repo success', type: "success"})
+ ElMessage({ message: 'Sync repo success', type: 'success' })
setTimeout(() => {
location.reload()
}, 2000)
}
}
- const handleButtonClick = () =>{
- if(isLoggedIn.value){
+ const handleButtonClick = () => {
+ if (isLoggedIn.value) {
toFinetunePage()
- }else{
+ } else {
toLoginPage()
}
}
@@ -386,9 +470,29 @@ result = snapshot_download(repo_id, cache_dir=cache_dir, endpoint=endpoint, toke
window.location.href = '/login'
}
+ const toNewEvaluatePage = () => {
+ if (isLoggedIn.value) {
+ window.location.href = `/evaluations/new?model_id=${props.namespacePath}`
+ } else {
+ toLoginPage()
+ }
+ }
+
onMounted(() => {
if (userStore.initialized) {
fetchUserToken()
}
})
+
diff --git a/frontend/src/components/shared/RepoTabs.vue b/frontend/src/components/shared/RepoTabs.vue
index a14e396c8..fc7c77f60 100644
--- a/frontend/src/components/shared/RepoTabs.vue
+++ b/frontend/src/components/shared/RepoTabs.vue
@@ -13,6 +13,7 @@
:repo="repoDetail"
:enableEndpoint="repoDetail.enable_inference"
:enableFinetune="repoDetail.enable_finetune"
+ :enableEvaluation="repoDetail.enable_evaluation"
/>
+
+
+{{ end }}
diff --git a/frontend/src/views/evaluations/show.html b/frontend/src/views/evaluations/show.html
new file mode 100644
index 000000000..f4b1b36e4
--- /dev/null
+++ b/frontend/src/views/evaluations/show.html
@@ -0,0 +1,7 @@
+{{ define "content" }}
+
+
+
+{{ end }}
diff --git a/internal/handlers/render/evaluation.go b/internal/handlers/render/evaluation.go
new file mode 100644
index 000000000..3bfe20b78
--- /dev/null
+++ b/internal/handlers/render/evaluation.go
@@ -0,0 +1,35 @@
+package renderHandlers
+
+import (
+ "github.com/gin-gonic/gin"
+)
+
+type EvaluationHandler interface {
+ New(ctx *gin.Context)
+ Show(ctx *gin.Context)
+}
+
+type EvaluationHandlerImpl struct {
+ isSmallFooter bool
+}
+
+func NewEvaluationHandler() EvaluationHandler {
+ return &EvaluationHandlerImpl{
+ isSmallFooter: true,
+ }
+}
+
+func (i *EvaluationHandlerImpl) New(ctx *gin.Context) {
+ data := map[string]interface{}{
+ "isSmallFooter": i.isSmallFooter,
+ }
+ RenderBaseInstance.RenderTemplate(ctx, "evaluations_new", data)
+}
+
+func (i *EvaluationHandlerImpl) Show(ctx *gin.Context) {
+ data := map[string]interface{}{
+ "evaluationId": ctx.Param("id"),
+ "isSmallFooter": i.isSmallFooter,
+ }
+ RenderBaseInstance.RenderTemplate(ctx, "evaluations_show", data)
+}
diff --git a/internal/handlers/render/registry.go b/internal/handlers/render/registry.go
index f820df15b..735e24866 100644
--- a/internal/handlers/render/registry.go
+++ b/internal/handlers/render/registry.go
@@ -22,6 +22,7 @@ type RenderHandlerRegistry struct {
AdminHandler AdminHandler
ResourceConsoleHandler ResourceConsoleHandler
PromptsHandler PromptsHandler
+ EvaluationHandler EvaluationHandler
}
func NewHandlersRegistry(svcCtx *svc.ServiceContext) (*RenderHandlerRegistry, error) {
@@ -43,6 +44,7 @@ func NewHandlersRegistry(svcCtx *svc.ServiceContext) (*RenderHandlerRegistry, er
profileHandler := NewProfileHandler(svcCtx)
settingHandler := NewSettingHandler(svcCtx)
adminHandler := NewAdminHandler()
+ evaluationHandler := NewEvaluationHandler()
return &RenderHandlerRegistry{
ErrorHandler: errorHandler,
ModelHandler: modelHandler,
@@ -59,5 +61,6 @@ func NewHandlersRegistry(svcCtx *svc.ServiceContext) (*RenderHandlerRegistry, er
AdminHandler: adminHandler,
ResourceConsoleHandler: resourceConsoleHandler,
PromptsHandler: promptsHandler,
+ EvaluationHandler: evaluationHandler,
}, nil
}
diff --git a/internal/routes/evaluation.go b/internal/routes/evaluation.go
new file mode 100644
index 000000000..02b84360a
--- /dev/null
+++ b/internal/routes/evaluation.go
@@ -0,0 +1,13 @@
+package routes
+
+import (
+ "github.com/gin-gonic/gin"
+ "opencsg.com/portal/internal/middleware"
+)
+
+func registerEvaluationRoutes(engine *gin.Engine, handlersRegistry *HandlersRegistry) {
+ evaluationRoutes := engine.Group("/evaluations")
+ evaluationRoutes.Use(middleware.Instance.CheckCurrentUser())
+ evaluationRoutes.GET("/new", handlersRegistry.RenderHandler.EvaluationHandler.New)
+ evaluationRoutes.GET("/:id", handlersRegistry.RenderHandler.EvaluationHandler.Show)
+}
diff --git a/internal/routes/router.go b/internal/routes/router.go
index c94839f42..c7489930b 100644
--- a/internal/routes/router.go
+++ b/internal/routes/router.go
@@ -122,37 +122,41 @@ func createRender() multitemplate.Renderer {
"errors_401": "errors/unauthorized.html",
"errors_login_failed": "errors/login_failed.html",
- "index": "home/index.html",
- "models_index": "models/index.html",
- "models_show": "models/show.html",
- "models_new": "models/new.html",
- "datasets_index": "datasets/index.html",
- "datasets_show": "datasets/show.html",
- "datasets_new": "datasets/new.html",
- "codes_index": "codes/index.html",
- "codes_show": "codes/show.html",
- "codes_new": "codes/new.html",
- "spaces_index": "spaces/index.html",
- "spaces_show": "spaces/show.html",
- "spaces_new": "spaces/new.html",
- "endpoints_show": "endpoints/show.html",
- "endpoints_new": "endpoints/new.html",
- "finetunes_show": "finetunes/show.html",
- "finetunes_new": "finetunes/new.html",
- "resource_console_index": "resource-console/index.html",
- "organizations_show": "organizations/show.html",
- "organizations_new": "organizations/new.html",
- "organizations_settings": "organizations/settings.html",
- "collections_index": "collections/index.html",
- "collections_show": "collections/show.html",
- "collections_new": "collections/new.html",
- "profile": "profile/profile.html",
- "profile_likes": "profile/likes.html",
- "settings_profile": "settings/profile.html",
- "settings_access_token": "settings/access_token.html",
- "settings_ssh_keys": "settings/ssh_keys.html",
- "prompts_index": "prompts/index.html",
- "prompts_assistant": "prompts/assistant.html",
+ "index": "home/index.html",
+ "models_index": "models/index.html",
+ "models_show": "models/show.html",
+ "models_new": "models/new.html",
+ "datasets_index": "datasets/index.html",
+ "datasets_show": "datasets/show.html",
+ "datasets_new": "datasets/new.html",
+ "codes_index": "codes/index.html",
+ "codes_show": "codes/show.html",
+ "codes_new": "codes/new.html",
+ "spaces_index": "spaces/index.html",
+ "spaces_show": "spaces/show.html",
+ "spaces_new": "spaces/new.html",
+ "endpoints_show": "endpoints/show.html",
+ "endpoints_new": "endpoints/new.html",
+ "finetunes_show": "finetunes/show.html",
+ "finetunes_new": "finetunes/new.html",
+ "resource_console_index": "resource-console/index.html",
+ "organizations_show": "organizations/show.html",
+ "organizations_new": "organizations/new.html",
+ "organizations_settings": "organizations/settings.html",
+ "collections_index": "collections/index.html",
+ "collections_show": "collections/show.html",
+ "collections_new": "collections/new.html",
+ "profile": "profile/profile.html",
+ "profile_likes": "profile/likes.html",
+ "settings_profile": "settings/profile.html",
+ "settings_access_token": "settings/access_token.html",
+ "settings_starship_access_token": "settings/starship_access_token.html",
+ "settings_sync_access_token": "settings/sync_access_token.html",
+ "settings_ssh_keys": "settings/ssh_keys.html",
+ "prompts_index": "prompts/index.html",
+ "prompts_assistant": "prompts/assistant.html",
+ "evaluations_new": "evaluations/new.html",
+ "evaluations_show": "evaluations/show.html",
}
for name, page := range pages {
@@ -222,6 +226,7 @@ func setupViewsRouter(engine *gin.Engine, handlersRegistry *HandlersRegistry) {
registerResourceConsoleRoutes(engine, handlersRegistry)
registerAdminRoutes(engine, handlersRegistry)
registerPromptsRoutes(engine, handlersRegistry)
+ registerEvaluationRoutes(engine, handlersRegistry)
}
func setupStaticRouter(engine *gin.Engine) {