qinling0210
2026-07-08 19:54:29 +08:00
committed by GitHub
parent 0f08dc070d
commit 8e3bbad4da
5 changed files with 220 additions and 84 deletions

View File

@@ -789,6 +789,10 @@ func (h *MemoryHandler) SearchMessage(c *gin.Context) {
similarityThreshold, _ := strconv.ParseFloat(c.DefaultQuery("similarity_threshold", "0.2"), 64)
keywordsSimilarityWeight, _ := strconv.ParseFloat(c.DefaultQuery("keywords_similarity_weight", "0.7"), 64)
topN, _ := strconv.Atoi(c.DefaultQuery("top_n", "5"))
if topN <= 0 || topN > 100 {
common.ResponseWithCodeData(c, common.CodeArgumentError, nil, "top_n must be between 1 and 100")
return
}
agentID := c.DefaultQuery("agent_id", "")
sessionID := c.DefaultQuery("session_id", "")
@@ -856,6 +860,10 @@ func (h *MemoryHandler) GetMessages(c *gin.Context) {
agentID := c.DefaultQuery("agent_id", "")
sessionID := c.DefaultQuery("session_id", "")
limit, _ := strconv.Atoi(c.DefaultQuery("limit", "10"))
if limit <= 0 || limit > 100 {
common.ResponseWithCodeData(c, common.CodeArgumentError, nil, "limit must be between 1 and 100")
return
}
if len(memoryIDs) == 0 {
common.ResponseWithCodeData(c, common.CodeArgumentError, nil, "memory_ids is required.")
return