Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 后台任务显示当前正在执行的任务

Liang Ding9a7a155ac710
diff --git a/kernel/task/queue.go b/kernel/task/queue.go
index 45c7b2935a..b73601226e 100644
--- a/kernel/task/queue.go
+++ b/kernel/task/queue.go
@@ -121,6 +121,11 @@ func StatusJob() {
item := map[string]interface{}{"action": action}
items = append(items, item)
}
+
+ if "" != currentTaskAction {
+ items = append([]map[string]interface{}{map[string]interface{}{"action": currentTaskAction}}, items...)
+ }
+
if 1 > len(items) {
items = []map[string]interface{}{}
}
@@ -141,6 +146,8 @@ func ExecTaskJob() {
execTask(task)
}
+var currentTaskAction string
+
func popTask() (ret *Task) {
queueLock.Lock()
defer queueLock.Unlock()
@@ -166,6 +173,8 @@ func execTask(task *Task) {
}
}
+ currentTaskAction = task.Action
+
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
defer cancel()
ch := make(chan bool, 1)