feat: Add JWT_SECRET configuration to .env.example and enhance pagination validation in chunk handler
This commit is contained in:
@@ -98,6 +98,15 @@ func (h *ChunkHandler) ListKnowledgeChunks(c *gin.Context) {
|
||||
c.Error(errors.NewBadRequestError(err.Error()))
|
||||
return
|
||||
}
|
||||
if pagination.Page < 1 {
|
||||
pagination.Page = 1
|
||||
}
|
||||
if pagination.PageSize < 1 {
|
||||
pagination.PageSize = 10
|
||||
}
|
||||
if pagination.PageSize > 100 {
|
||||
pagination.PageSize = 100
|
||||
}
|
||||
|
||||
chunkType := []types.ChunkType{types.ChunkTypeText}
|
||||
|
||||
|
||||
@@ -149,12 +149,14 @@ func (h *FAQHandler) DeleteEntries(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
var req faqDeleteRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
logger.Error(ctx, "Failed to bind FAQ delete payload", err)
|
||||
logger.Errorf(ctx, "Failed to bind FAQ delete payload: %s", secutils.SanitizeForLog(err.Error()))
|
||||
c.Error(errors.NewBadRequestError("请求参数不合法").WithDetails(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if err := h.knowledgeService.DeleteFAQEntries(ctx, secutils.SanitizeForLog(c.Param("id")), req.IDs); err != nil {
|
||||
if err := h.knowledgeService.DeleteFAQEntries(ctx,
|
||||
secutils.SanitizeForLog(c.Param("id")),
|
||||
secutils.SanitizeForLogArray(req.IDs)); err != nil {
|
||||
logger.ErrorWithFields(ctx, err, nil)
|
||||
c.Error(err)
|
||||
return
|
||||
|
||||
@@ -123,7 +123,8 @@ func (h *Handler) KnowledgeQA(c *gin.Context) {
|
||||
|
||||
// Use shared function to handle KnowledgeQA request
|
||||
h.handleKnowledgeQARequest(ctx, c, session, secutils.SanitizeForLog(request.Query),
|
||||
knowledgeBaseIDs, assistantMessage, true, secutils.SanitizeForLog(request.SummaryModelID), request.WebSearchEnabled)
|
||||
secutils.SanitizeForLogArray(knowledgeBaseIDs),
|
||||
assistantMessage, true, secutils.SanitizeForLog(request.SummaryModelID), request.WebSearchEnabled)
|
||||
}
|
||||
|
||||
// AgentQA handles agent-based question answering with conversation history and streaming
|
||||
|
||||
Reference in New Issue
Block a user