>>0}(a):"")+")"}(e,e.scopedSlots,t)+","),e.model&&(n+="model:{value:"+e.model.value+",callback:"+e.model.callback+",expression:"+e.model.expression+"},"),e.inlineTemplate){var o=function(e,t){var n=e.children[0];if(n&&1===n.type){var r=Pa(n,t.options);return"inlineTemplate:{render:function(){"+r.render+"},staticRenderFns:["+r.staticRenderFns.map(function(e){return"function(){"+e+"}"}).join(",")+"]}"}}(e,t);o&&(n+=o+",")}return n=n.replace(/,$/,"")+"}",e.dynamicAttrs&&(n="_b("+n+',"'+e.tag+'",'+Ga(e.dynamicAttrs)+")"),e.wrapData&&(n=e.wrapData(n)),e.wrapListeners&&(n=e.wrapListeners(n)),n}function Ka(e){return 1===e.type&&("slot"===e.tag||e.children.some(Ka))}function Ja(e,t){var n=e.attrsMap["slot-scope"];if(e.if&&!e.ifProcessed&&!n)return Ua(e,t,Ja,"null");if(e.for&&!e.forProcessed)return za(e,t,Ja);var r=e.slotScope===ca?"":String(e.slotScope),i="function("+r+"){return "+("template"===e.tag?e.if&&n?"("+e.if+")?"+(qa(e,t)||"undefined")+":undefined":qa(e,t)||"undefined":Ra(e,t))+"}",o=r?"":",proxy:true";return"{key:"+(e.slotTarget||'"default"')+",fn:"+i+o+"}"}function qa(e,t,n,r,i){var o=e.children;if(o.length){var a=o[0];if(1===o.length&&a.for&&"template"!==a.tag&&"slot"!==a.tag){var s=n?t.maybeComponent(a)?",1":",0":"";return""+(r||Ra)(a,t)+s}var c=n?function(e,t){for(var n=0,r=0;r':'',ts.innerHTML.indexOf("
")>0}var os=!!z&&is(!1),as=!!z&&is(!0),ss=g(function(e){var t=Yn(e);return t&&t.innerHTML}),cs=wn.prototype.$mount;return wn.prototype.$mount=function(e,t){if((e=e&&Yn(e))===document.body||e===document.documentElement)return this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&(r=ss(r));else{if(!r.nodeType)return this;r=r.innerHTML}else e&&(r=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(r){var i=rs(r,{outputSourceRange:!1,shouldDecodeNewlines:os,shouldDecodeNewlinesForHref:as,delimiters:n.delimiters,comments:n.comments},this),o=i.render,a=i.staticRenderFns;n.render=o,n.staticRenderFns=a}}return cs.call(this,e,t)},wn.compile=rs,wn});
\ No newline at end of file
diff --git a/models/cloudbrain_static.go b/models/cloudbrain_static.go
new file mode 100644
index 000000000..31f66d4fc
--- /dev/null
+++ b/models/cloudbrain_static.go
@@ -0,0 +1,22 @@
+package models
+
+import "code.gitea.io/gitea/modules/log"
+
+func GetAllStatusCloudBrain() map[string]int {
+ sess := x.NewSession()
+ defer sess.Close()
+ cloudbrains := make([]*CloudbrainInfo, 0)
+ if err := sess.Table(&Cloudbrain{}).Unscoped().
+ Find(&cloudbrains); err != nil {
+ log.Info("find error.")
+ }
+ cloudBrainStatusResult := make(map[string]int)
+ for _, cloudbrain := range cloudbrains {
+ if _, ok := cloudBrainStatusResult[cloudbrain.Status]; !ok {
+ cloudBrainStatusResult[cloudbrain.Status] = 1
+ } else {
+ cloudBrainStatusResult[cloudbrain.Status] += 1
+ }
+ }
+ return cloudBrainStatusResult
+}
diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini
index d62a9f399..ac9de9fed 100755
--- a/options/locale/locale_zh-CN.ini
+++ b/options/locale/locale_zh-CN.ini
@@ -226,7 +226,7 @@ contributors=贡献者
contributor=贡献者
page_title=探索更好的AI
-page_small_title=启智AI开发协作平台
+page_small_title=启智AI协作平台
page_description=面向AI领域的一站式协同开发环境,提供集代码开发、数据管理、模型调试、推理和评测为一体的AI开发流水线
page_use=立即使用
page_only_dynamic=仅展示开源项目动态
diff --git a/public/home/home.js b/public/home/home.js
index 2affefddd..9754de0cb 100755
--- a/public/home/home.js
+++ b/public/home/home.js
@@ -9,7 +9,7 @@ if(isEmpty(token)){
var swiperNewMessage = new Swiper(".newslist", {
direction: "vertical",
- slidesPerView: 10,
+ slidesPerView: 9,
loop: true,
autoplay: {
delay: 2500,
@@ -17,7 +17,7 @@ var swiperNewMessage = new Swiper(".newslist", {
},
});
var swiperEvent = new Swiper(".event-list", {
- slidesPerView: 2,
+ slidesPerView: 3,
spaceBetween: 30,
pagination: {
el: ".swiper-pagination",
@@ -117,6 +117,7 @@ socket.onmessage = function (e) {
continue;
}
}
+ refresh3DInfo(record);
var recordPrefix = getMsg(record);
if(record.OpType == "6" || record.OpType == "10" || record.OpType == "12" || record.OpType == "13"){
html += recordPrefix + actionName;
@@ -200,6 +201,29 @@ function getTaskLink(record){
return re;
}
+function refresh3DInfo(record){
+ if(record.OpType == "25" || record.OpType == "29" || record.OpType == "31"){
+ //cloudbrain one
+ var lines = $('.rotation3D__line');
+ var span = $('.rotation3D__line').find("span")[0];
+ //console.log(span);
+ span.innerText =record.RefName;
+ //$('.rotation3D__line').find("span").eq(0).text(record.RefName)
+ //console.log("cloudbrain one line length=" + lines.length);
+ //lines[0].find("span").text(record.RefName);
+ }else if(record.OpType == "26" || record.OpType == "27" || record.OpType == "28"){
+ //cloudbrain two
+ var lines = $('.rotation3D__line');
+ //console.log("cloudbrain two line length=" + lines.length);
+ var span = $('.rotation3D__line').find("span")[1];
+ //console.log(span);
+ span.innerText =record.RefName;
+ //$('.rotation3D__line').find("span").eq(1).text(record.RefName)
+ //lines[1].find("span").text(record.RefName);
+ }
+
+}
+
function getMsg(record){
var html ="";
html += "";
@@ -425,13 +449,50 @@ function queryRecommendData(){
dataType:"json",
async:false,
success:function(json){
- displayOrg(json.org);
- displayRepo(json.repo);
- displayActivity(json.image)
+ displayOrg(json.org);
+ displayRepo(json.repo);
+ displayActivity(json.image);
+ displayCloudBrain(json.cloudbrain)
},
error:function(response) {
}
});
+
+ // $.ajax({
+ // type:"GET",
+ // url:"/recommend/repo",
+ // headers: {
+ // authorization:token,
+ // },
+ // dataType:"json",
+ // async:false,
+ // success:function(json){
+ // displayRepo(json);
+ // },
+ // error:function(response) {
+ // }
+ // });
+
+ // $.ajax({
+ // type:"GET",
+ // url:"/recommend/imageinfo",
+ // headers: {
+ // authorization:token,
+ // },
+ // dataType:"json",
+ // async:false,
+ // success:function(json){
+ // displayActivity(json);
+ // },
+ // error:function(response) {
+ // }
+ // });
+}
+
+function displayCloudBrain(json){
+ $('#completed_task').text(json.completed_task);
+ $('#running_task').text(json.running_task);
+ $('#wait_task').text(json.wait_task);
}
function displayActivity(json){
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index d6d3b001a..35089f0e7 100755
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -573,6 +573,9 @@ func RegisterRoutes(m *macaron.Macaron) {
//cloudbrain board
m.Group("/cloudbrainboard", func() {
m.Get("/downloadAll", repo.DownloadCloudBrainBoard)
+ m.Group("/cloudbrain", func() {
+ m.Get("/status_analysis", repo.GetCloudbrainsStatusAnalysis)
+ })
}, operationReq)
// Users
m.Group("/users", func() {
diff --git a/routers/api/v1/repo/cloudbrain_dashboard.go b/routers/api/v1/repo/cloudbrain_dashboard.go
index 2090a2cf2..0710a21e4 100644
--- a/routers/api/v1/repo/cloudbrain_dashboard.go
+++ b/routers/api/v1/repo/cloudbrain_dashboard.go
@@ -11,6 +11,16 @@ import (
"github.com/360EntSecGroup-Skylar/excelize/v2"
)
+type CloudbrainsStatusAnalysis struct {
+ JobWaitingCount int64 `json:"jobWaitingCount"`
+ JobRunningCount int64 `json:"jobRunningCount"`
+ JobStoppedCount int64 `json:"jobStoppedCount"`
+ JobCompletedCount int64 `json:"jobCompletedCount"`
+ JobFailedCount int64 `json:"jobFailedCount"`
+ JobKilledCount int64 `json:"jobKilledCount"`
+ JobInitCount int64 `json:"jobInitCount"`
+}
+
func DownloadCloudBrainBoard(ctx *context.Context) {
page := 1
@@ -133,3 +143,9 @@ func getBrainWaitTime(rs *models.CloudbrainInfo) string {
return models.ConvertDurationToStr(int64(waitTime))
}
}
+func GetCloudbrainsStatusAnalysis(ctx *context.Context) {
+ cloudBrainStatusResult := models.GetAllStatusCloudBrain()
+ ctx.JSON(http.StatusOK, map[string]interface{}{
+ "cloudBrainStatusResult": cloudBrainStatusResult,
+ })
+}
diff --git a/routers/home.go b/routers/home.go
index a34302876..e31bed4ff 100755
--- a/routers/home.go
+++ b/routers/home.go
@@ -7,6 +7,7 @@ package routers
import (
"bytes"
+ "fmt"
"net/http"
"strconv"
"strings"
@@ -750,6 +751,15 @@ func GetRankUser(index string) ([]map[string]interface{}, error) {
return resultOrg, nil
}
+// func GetImageInfoFromPromote(ctx *context.Context) {
+// imageInfo, err := GetImageInfo()
+// if err != nil {
+// ctx.ServerError("500", err)
+// return
+// }
+// ctx.JSON(200, imageInfo)
+// }
+
func GetUserRankFromPromote(ctx *context.Context) {
index := ctx.Params("index")
resultUserRank, err := GetRankUser(index)
@@ -773,13 +783,36 @@ func RecommendHomeInfo(ctx *context.Context) {
if err != nil {
log.Info("error." + err.Error())
}
+ resultCloudBrain, err := getCloudbrainNums()
+ if err != nil {
+ log.Info("error." + err.Error())
+ }
mapInterface := make(map[string]interface{})
mapInterface["org"] = resultOrg
mapInterface["repo"] = resultRepo
mapInterface["image"] = resultImage
+ mapInterface["cloudbrain"] = resultCloudBrain
ctx.JSON(http.StatusOK, mapInterface)
}
+func getCloudbrainNums() (map[string]string, error) {
+ result := make(map[string]string)
+ cloudStatusMap := models.GetAllStatusCloudBrain()
+ result["completed_task"] = fmt.Sprint(cloudStatusMap["COMPLETED"])
+ result["running_task"] = fmt.Sprint(cloudStatusMap["RUNNING"])
+ result["wait_task"] = fmt.Sprint(cloudStatusMap["WAITING"])
+ return result, nil
+}
+
+// func RecommendOrgFromPromote(ctx *context.Context) {
+// resultOrg, err := GetRecommendOrg()
+// if err != nil {
+// ctx.ServerError("500", err)
+// return
+// }
+// ctx.JSON(200, resultOrg)
+// }
+
func RecommendRepoFromPromote(ctx *context.Context) {
result, err := repository.GetRecommendRepoFromPromote("projects")
if err != nil {
diff --git a/routers/routes/routes.go b/routers/routes/routes.go
index 278c40204..9effec7df 100755
--- a/routers/routes/routes.go
+++ b/routers/routes/routes.go
@@ -324,7 +324,10 @@ func RegisterRoutes(m *macaron.Macaron) {
go routers.SocketManager.Run()
m.Get("/action/notification", routers.ActionNotification)
m.Get("/recommend/home", routers.RecommendHomeInfo)
+ //m.Get("/recommend/org", routers.RecommendOrgFromPromote)
+ //m.Get("/recommend/repo", routers.RecommendRepoFromPromote)
m.Get("/recommend/userrank/:index", routers.GetUserRankFromPromote)
+ //m.Get("/recommend/imageinfo", routers.GetImageInfoFromPromote)
m.Post("/all/search/", routers.Search)
m.Get("/all/search/", routers.EmptySearch)
m.Get("/all/dosearch/", routers.SearchApi)
diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl
old mode 100644
new mode 100755
index 732f61ea5..802854716
--- a/templates/base/footer.tmpl
+++ b/templates/base/footer.tmpl
@@ -13,6 +13,9 @@
{{template "base/footer_content" .}}
+
+
+
{{if .RequireSimpleMDE}}
@@ -43,5 +46,46 @@
{{template "custom/footer" .}}
+{{if .PageIsHome}}
+
+
+
+
+{{end}}
+