An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:recycle: Rename func
Daniel59da115cc9b3
diff --git a/app/src/history/diff.ts b/app/src/history/diff.tsindex db6d56fe4e..a443ae2419 100644--- a/app/src/history/diff.ts+++ b/app/src/history/diff.ts@@ -76,7 +76,7 @@ const renderCompare = (app: App, element: HTMLElement) => {disabledProtyle(rightEditor.protyle);}- fetchPost("/api/repo/openRepoSnapshotDoc", {id: element.getAttribute("data-id")}, (response) => {+ fetchPost("/api/repo/openRepoSnapshotFile", {id: element.getAttribute("data-id")}, (response) => {leftElement.classList.remove("fn__none");const textElement = leftElement.querySelector("textarea");const type = pathPosix().extname(response.data.content).toLowerCase();@@ -108,7 +108,7 @@ const renderCompare = (app: App, element: HTMLElement) => {const id2 = element.getAttribute("data-id2");if (id2) {rightElement.classList.remove("fn__none");- fetchPost("/api/repo/openRepoSnapshotDoc", {id: id2}, (response) => {+ fetchPost("/api/repo/openRepoSnapshotFile", {id: id2}, (response) => {const textElement = rightElement.querySelector("textarea");const type = pathPosix().extname(response.data.content).toLowerCase();const titleElement = rightElement.querySelector(".protyle-title__input");diff --git a/kernel/api/repo.go b/kernel/api/repo.goindex fc95138cac..86d7bb620d 100644--- a/kernel/api/repo.go+++ b/kernel/api/repo.go@@ -107,7 +107,7 @@ func getRepoFile(c *gin.Context) {c.Data(http.StatusOK, contentType, data)}-func openRepoSnapshotDoc(c *gin.Context) {+func openRepoSnapshotFile(c *gin.Context) {ret := gulu.Ret.NewResult()defer c.JSON(http.StatusOK, ret)@@ -120,7 +120,7 @@ func openRepoSnapshotDoc(c *gin.Context) {if !util.ParseJsonArgs(arg, ret, util.BindJsonArg("id", true, &id)) {return}- title, content, displayInText, updated, err := model.OpenRepoSnapshotDoc(id)+ title, content, displayInText, updated, err := model.OpenRepoSnapshotFile(id)if err != nil {ret.Code = -1ret.Msg = err.Error()diff --git a/kernel/api/router.go b/kernel/api/router.goindex 5bcdc259c0..cd219e36b8 100644--- a/kernel/api/router.go+++ b/kernel/api/router.go@@ -438,7 +438,7 @@ func ServeAPI(ginServer *gin.Engine) {ginServer.Handle("POST", "/api/repo/uploadCloudSnapshot", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, uploadCloudSnapshot)ginServer.Handle("POST", "/api/repo/downloadCloudSnapshot", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, downloadCloudSnapshot)ginServer.Handle("POST", "/api/repo/diffRepoSnapshots", model.CheckAuth, model.CheckAdminRole, diffRepoSnapshots)- ginServer.Handle("POST", "/api/repo/openRepoSnapshotDoc", model.CheckAuth, model.CheckAdminRole, openRepoSnapshotDoc)+ ginServer.Handle("POST", "/api/repo/openRepoSnapshotFile", model.CheckAuth, model.CheckAdminRole, openRepoSnapshotFile)ginServer.Handle("POST", "/api/repo/getRepoFile", model.CheckAuth, model.CheckAdminRole, getRepoFile)ginServer.Handle("POST", "/api/repo/setRepoIndexRetentionDays", model.CheckAuth, model.CheckAdminRole, setRepoIndexRetentionDays)ginServer.Handle("POST", "/api/repo/setRetentionIndexesDaily", model.CheckAuth, model.CheckAdminRole, setRetentionIndexesDaily)diff --git a/kernel/model/repository.go b/kernel/model/repository.goindex b348f8d12a..8d1ef3379e 100644--- a/kernel/model/repository.go+++ b/kernel/model/repository.go@@ -186,7 +186,7 @@ func GetRepoFile(fileID string) (ret []byte, p string, err error) {return}-func OpenRepoSnapshotDoc(fileID string) (title, content string, displayInText bool, updated int64, err error) {+func OpenRepoSnapshotFile(fileID string) (title, content string, displayInText bool, updated int64, err error) {if 1 > len(Conf.Repo.Key) {err = errors.New(Conf.Language(26))return