An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: 前端用户界面引入后台任务列表 https://github.com/siyuan-note/siyuan/issues/7117
Liang Dingd95c6bd467aa
diff --git a/kernel/main.go b/kernel/main.goindex d0f6dcc12b..07b943a2f1 100644--- a/kernel/main.go+++ b/kernel/main.go@@ -44,6 +44,7 @@ func main() {model.LoadAssetsTexts()go task.Loop()+ go task.StatusLoop()go model.AutoGenerateDocHistory()go model.AutoSync()diff --git a/kernel/mobile/kernel.go b/kernel/mobile/kernel.goindex 58c3d90196..5a5fa4f839 100644--- a/kernel/mobile/kernel.go+++ b/kernel/mobile/kernel.go@@ -58,6 +58,7 @@ func StartKernel(container, appDir, workspaceBaseDir, timezoneID, localIPs, langmodel.LoadAssetsTexts()go task.Loop()+ go task.StatusLoop()go model.AutoGenerateDocHistory()go model.AutoSync()diff --git a/kernel/task/queue.go b/kernel/task/queue.goindex cab4f41db1..2426fd89e0 100644--- a/kernel/task/queue.go+++ b/kernel/task/queue.go@@ -110,6 +110,29 @@ const (DatabaseIndexEmbedBlock = "task.database.index.embedBlock" // 数据库索引嵌入块)+func StatusLoop() {+ for {+ time.Sleep(1000 * time.Millisecond)+ tasks := taskQueue+ data := map[string]interface{}{}+ var items []map[string]interface{}+ for _, task := range tasks {+ if OCRImage == task.Action || DatabaseIndexEmbedBlock == task.Action {+ continue+ }++ item := map[string]interface{}{+ "action": task.Action,+ }+ items = append(items, item)+ }+ util.PushBackgroundTask(data)+ if 0 < len(tasks) {+ time.Sleep(1000 * time.Millisecond)+ }+ }+}+func Loop() {for {time.Sleep(10 * time.Millisecond)diff --git a/kernel/util/websocket.go b/kernel/util/websocket.goindex ef1f056917..8892f2bb75 100644--- a/kernel/util/websocket.go+++ b/kernel/util/websocket.go@@ -151,6 +151,10 @@ func PushStatusBar(msg string) {BroadcastByType("main", "statusbar", 0, msg, nil)}+func PushBackgroundTask(data map[string]interface{}) {+ BroadcastByType("main", "backgroundtask", 0, "", data)+}+type BlockStatResult struct {RuneCount int `json:"runeCount"`WordCount int `json:"wordCount"`