Skip to content

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

:art: Add ial for building embed block

Daniel80b68e6eb96c
diff --git a/kernel/model/block.go b/kernel/model/block.go
index 73eda0c126..3309d1e741 100644
--- a/kernel/model/block.go
+++ b/kernel/model/block.go
@@ -20,6 +20,7 @@ import (
"errors"
"fmt"
"strconv"
+ "strings"
"time"
"github.com/88250/lute/ast"
@@ -647,6 +648,16 @@ func getEmbeddedBlock(trees map[string]*parse.Tree, sqlBlock *sql.Block, heading
content := renderBlockContentByNodes(nodes)
block = &Block{Box: def.Box, Path: def.Path, HPath: b.HPath, ID: def.ID, Type: def.Type.String(), Content: dom, Markdown: content /* 这里使用 Markdown 字段来临时存储 content */}
+ if "" != sqlBlock.IAL {
+ block.IAL = map[string]string{}
+ ialStr := strings.TrimPrefix(sqlBlock.IAL, "{:")
+ ialStr = strings.TrimSuffix(ialStr, "}")
+ ial := parse.Tokens2IAL([]byte(ialStr))
+ for _, kv := range ial {
+ block.IAL[kv[0]] = kv[1]
+ }
+ }
+
if breadcrumb {
blockPaths = buildBlockBreadcrumb(def, nil)
}