Skip to content

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

:sparkles: 编辑器式反链面板 https://github.com/siyuan-note/siyuan/issues/3565

Liang Dingfd01ab84e2f4
diff --git a/kernel/api/ref.go b/kernel/api/ref.go
index 53d9267a9a..16dcaa86c9 100644
--- a/kernel/api/ref.go
+++ b/kernel/api/ref.go
@@ -38,6 +38,23 @@ func refreshBacklink(c *gin.Context) {
model.RefreshBacklink(id)
}
+func getBackmentionDoc(c *gin.Context) {
+ ret := gulu.Ret.NewResult()
+ defer c.JSON(http.StatusOK, ret)
+
+ arg, ok := util.JsonArg(c, ret)
+ if !ok {
+ return
+ }
+
+ defID := arg["defID"].(string)
+ keyword := ""
+ backlinks := model.GetBackmentionDoc(defID, keyword)
+ ret.Data = map[string]interface{}{
+ "backmentions": backlinks,
+ }
+}
+
func getBacklinkDoc(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
diff --git a/kernel/api/router.go b/kernel/api/router.go
index 54e4c475ad..666ec4333b 100644
--- a/kernel/api/router.go
+++ b/kernel/api/router.go
@@ -157,6 +157,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/ref/refreshBacklink", model.CheckAuth, refreshBacklink)
ginServer.Handle("POST", "/api/ref/getBacklink", model.CheckAuth, getBacklink)
ginServer.Handle("POST", "/api/ref/getBacklinkDoc", model.CheckAuth, getBacklinkDoc)
+ ginServer.Handle("POST", "/api/ref/getBackmentionDoc", model.CheckAuth, getBackmentionDoc)
ginServer.Handle("POST", "/api/ref/createBacklink", model.CheckAuth, model.CheckReadonly, createBacklink)
ginServer.Handle("POST", "/api/attr/getBookmarkLabels", model.CheckAuth, getBookmarkLabels)