Merge branch 'main' into login_page

This commit is contained in:
lyingbug
2025-09-16 10:24:05 +08:00
committed by GitHub
18 changed files with 526 additions and 46 deletions
+8
View File
@@ -8,6 +8,7 @@ import (
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/types"
"github.com/Tencent/WeKnora/internal/types/interfaces"
secutils "github.com/Tencent/WeKnora/internal/utils"
"github.com/gin-gonic/gin"
)
@@ -52,6 +53,13 @@ func (h *ChunkHandler) ListKnowledgeChunks(c *gin.Context) {
return
}
// 对 chunk 内容进行安全清理
for _, chunk := range result.Data.([]*types.Chunk) {
if chunk.Content != "" {
chunk.Content = secutils.SanitizeForDisplay(chunk.Content)
}
}
logger.Infof(
ctx, "Successfully retrieved knowledge chunks list, knowledge ID: %s, total: %d",
knowledgeID, result.Total,
+4
View File
@@ -180,6 +180,10 @@ func (h *InitializationHandler) CheckStatus(c *gin.Context) {
})
return
}
// ignore api key in response for security
for _, model := range models {
model.Parameters.APIKey = ""
}
logger.Info(ctx, "System is already initialized")
c.JSON(http.StatusOK, gin.H{
+1 -1
View File
@@ -87,7 +87,7 @@ type CreateSessionRequest struct {
func (h *SessionHandler) CreateSession(c *gin.Context) {
ctx := c.Request.Context()
logger.Info(ctx, "Start creating session")
logger.Infof(ctx, "Start creating session, config: %+v", h.config.Conversation)
// Parse and validate the request body
var request CreateSessionRequest