Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
fix(handler): /knowledge/search · accept ?query= and reject empty keyword
toy0116e76210a69566
diff --git a/internal/handler/knowledge.go b/internal/handler/knowledge.goindex 378738066..c424a5e79 100644--- a/internal/handler/knowledge.go+++ b/internal/handler/knowledge.go@@ -1793,7 +1793,19 @@ func (h *KnowledgeHandler) SearchKnowledge(c *gin.Context) {if userID, ok := c.Get(types.UserIDContextKey.String()); ok {ctx = context.WithValue(ctx, types.UserIDContextKey, userID)}+ // Accept both ?keyword= (legacy / upstream name) and ?query= (what most+ // MCP / agent integrations send). Falling silently back to an unsorted+ // listing when both are empty caused the "all queries return the same 5+ // newest cards" footgun — return 400 instead so the caller gets a clear+ // signal that the search wasn't query-driven.keyword := c.Query("keyword")+ if keyword == "" {+ keyword = c.Query("query")+ }+ if strings.TrimSpace(keyword) == "" {+ c.Error(errors.NewBadRequestError("missing search keyword: pass ?keyword=... or ?query=..."))+ return+ }offset, _ := strconv.Atoi(c.DefaultQuery("offset", "0"))limit, _ := strconv.Atoi(c.DefaultQuery("limit", "20"))