Skip to content

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

:art: 支持间隔复习 https://github.com/siyuan-note/siyuan/issues/6710

Liang Ding29f73e1ef9a0
diff --git a/kernel/api/riff.go b/kernel/api/riff.go
index 2f5d4b82c5..6acb1a1306 100644
--- a/kernel/api/riff.go
+++ b/kernel/api/riff.go
@@ -17,14 +17,15 @@
package api
import (
+ "net/http"
+
"github.com/88250/gulu"
"github.com/gin-gonic/gin"
"github.com/siyuan-note/siyuan/kernel/model"
"github.com/siyuan-note/siyuan/kernel/util"
- "net/http"
)
-func createRiffDeck(c *gin.Context) {
+func addRiffCard(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
@@ -33,18 +34,30 @@ func createRiffDeck(c *gin.Context) {
return
}
- id := arg["id"].(string)
- id, rootID, content, isLargeDoc, err := model.OpenRepoSnapshotDoc(id)
+ deckName := arg["deck"].(string)
+ blockID := arg["blockID"].(string)
+ err := model.AddFlashcard(blockID, deckName)
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
+}
+
+func createRiffDeck(c *gin.Context) {
+ ret := gulu.Ret.NewResult()
+ defer c.JSON(http.StatusOK, ret)
+
+ arg, ok := util.JsonArg(c, ret)
+ if !ok {
+ return
+ }
- ret.Data = map[string]interface{}{
- "id": id,
- "rootID": rootID,
- "content": content,
- "isLargeDoc": isLargeDoc,
+ name := arg["name"].(string)
+ err := model.CreateDeck(name)
+ if nil != err {
+ ret.Code = -1
+ ret.Msg = err.Error()
+ return
}
}
diff --git a/kernel/api/router.go b/kernel/api/router.go
index 62fb8b8e14..3234aac245 100644
--- a/kernel/api/router.go
+++ b/kernel/api/router.go
@@ -300,6 +300,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/repo/openRepoSnapshotDoc", model.CheckAuth, openRepoSnapshotDoc)
ginServer.Handle("POST", "/api/riff/createRiffDeck", model.CheckAuth, createRiffDeck)
+ ginServer.Handle("POST", "/api/riff/addRiffCard", model.CheckAuth, addRiffCard)
ginServer.Handle("POST", "/api/notification/pushMsg", model.CheckAuth, pushMsg)
ginServer.Handle("POST", "/api/notification/pushErrMsg", model.CheckAuth, pushErrMsg)