An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Marketplace introduction page https://github.com/siyuan-note/siyuan/issues/8324
Daniel1d5365294f1a
diff --git a/kernel/api/router.go b/kernel/api/router.goindex 8799e207d2..f41165aa4b 100644--- a/kernel/api/router.go+++ b/kernel/api/router.go@@ -282,6 +282,7 @@ func ServeAPI(ginServer *gin.Engine) {ginServer.Handle("POST", "/api/setting/setEmoji", model.CheckAuth, model.CheckReadonly, setEmoji)ginServer.Handle("POST", "/api/setting/setFlashcard", model.CheckAuth, model.CheckReadonly, setFlashcard)ginServer.Handle("POST", "/api/setting/setAI", model.CheckAuth, model.CheckReadonly, setAI)+ ginServer.Handle("POST", "/api/setting/setBazaar", model.CheckAuth, model.CheckReadonly, setBazaar)ginServer.Handle("POST", "/api/graph/resetGraph", model.CheckAuth, model.CheckReadonly, resetGraph)ginServer.Handle("POST", "/api/graph/resetLocalGraph", model.CheckAuth, model.CheckReadonly, resetLocalGraph)diff --git a/kernel/api/setting.go b/kernel/api/setting.goindex ba2e925a99..bd45d7badf 100644--- a/kernel/api/setting.go+++ b/kernel/api/setting.go@@ -29,6 +29,35 @@ import ("github.com/siyuan-note/siyuan/kernel/util")+func setBazaar(c *gin.Context) {+ ret := gulu.Ret.NewResult()+ defer c.JSON(http.StatusOK, ret)++ arg, ok := util.JsonArg(c, ret)+ if !ok {+ return+ }++ param, err := gulu.JSON.MarshalJSON(arg)+ if nil != err {+ ret.Code = -1+ ret.Msg = err.Error()+ return+ }++ bazaar := &conf.Bazaar{}+ if err = gulu.JSON.UnmarshalJSON(param, bazaar); nil != err {+ ret.Code = -1+ ret.Msg = err.Error()+ return+ }++ model.Conf.Bazaar = bazaar+ model.Conf.Save()++ ret.Data = bazaar+}+func setAI(c *gin.Context) {ret := gulu.Ret.NewResult()defer c.JSON(http.StatusOK, ret)diff --git a/kernel/conf/bazaar.go b/kernel/conf/bazaar.gonew file mode 100644index 0000000000..dbd0f43f31--- /dev/null+++ b/kernel/conf/bazaar.go@@ -0,0 +1,27 @@+// SiYuan - Build Your Eternal Digital Garden+// Copyright (c) 2020-present, b3log.org+//+// This program is free software: you can redistribute it and/or modify+// it under the terms of the GNU Affero General Public License as published by+// the Free Software Foundation, either version 3 of the License, or+// (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU Affero General Public License for more details.+//+// You should have received a copy of the GNU Affero General Public License+// along with this program. If not, see <https://www.gnu.org/licenses/>.++package conf++type Bazaar struct {+ Trust bool `json:"bool"`+}++func NewBazaar() *Bazaar {+ return &Bazaar{+ Trust: false,+ }+}diff --git a/kernel/model/conf.go b/kernel/model/conf.goindex 8fe8dc65f9..495274b16f 100644--- a/kernel/model/conf.go+++ b/kernel/model/conf.go@@ -72,6 +72,7 @@ type AppConf struct {Search *conf.Search `json:"search"` // 搜索配置Flashcard *conf.Flashcard `json:"flashcard"` // 闪卡配置AI *conf.AI `json:"ai"` // 人工智能配置+ Bazaar *conf.Bazaar `json:"bazaar"` // 集市配置Stat *conf.Stat `json:"stat"` // 统计Api *conf.API `json:"api"` // APIRepo *conf.Repo `json:"repo"` // 数据仓库@@ -288,6 +289,10 @@ func InitConf() {Conf.Api = conf.NewAPI()}+ if nil == Conf.Bazaar {+ Conf.Bazaar = conf.NewBazaar()+ }+if nil == Conf.Repo {Conf.Repo = conf.NewRepo()}