refactor: Enhance knowledge base and agent features in documentation
This commit is contained in:
@@ -101,6 +101,7 @@ func (h *AuthHandler) Login(c *gin.Context) {
|
||||
c.Error(appErr)
|
||||
return
|
||||
}
|
||||
email := secutils.SanitizeForLog(req.Email)
|
||||
|
||||
// Validate required fields
|
||||
if req.Email == "" || req.Password == "" {
|
||||
@@ -128,7 +129,7 @@ func (h *AuthHandler) Login(c *gin.Context) {
|
||||
|
||||
// User is already in the correct format from service
|
||||
|
||||
logger.Infof(ctx, "User logged in successfully: %s", req.Email)
|
||||
logger.Infof(ctx, "User logged in successfully, email: %s", email)
|
||||
c.JSON(http.StatusOK, response)
|
||||
}
|
||||
|
||||
|
||||
@@ -58,10 +58,10 @@ func (e *EvaluationHandler) Evaluation(c *gin.Context) {
|
||||
)
|
||||
|
||||
task, err := e.evaluationService.Evaluation(ctx,
|
||||
request.DatasetID,
|
||||
request.KnowledgeBaseID,
|
||||
request.ChatModelID,
|
||||
request.RerankModelID,
|
||||
secutils.SanitizeForLog(request.DatasetID),
|
||||
secutils.SanitizeForLog(request.KnowledgeBaseID),
|
||||
secutils.SanitizeForLog(request.ChatModelID),
|
||||
secutils.SanitizeForLog(request.RerankModelID),
|
||||
)
|
||||
if err != nil {
|
||||
logger.ErrorWithFields(ctx, err, nil)
|
||||
|
||||
@@ -444,18 +444,18 @@ func (h *InitializationHandler) InitializeByKB(c *gin.Context) {
|
||||
}{
|
||||
{
|
||||
modelType: types.ModelTypeKnowledgeQA,
|
||||
name: req.LLM.ModelName,
|
||||
name: secutils.SanitizeForLog(req.LLM.ModelName),
|
||||
source: types.ModelSource(req.LLM.Source),
|
||||
description: "LLM Model for Knowledge QA",
|
||||
baseURL: req.LLM.BaseURL,
|
||||
baseURL: secutils.SanitizeForLog(req.LLM.BaseURL),
|
||||
apiKey: req.LLM.APIKey,
|
||||
},
|
||||
{
|
||||
modelType: types.ModelTypeEmbedding,
|
||||
name: req.Embedding.ModelName,
|
||||
name: secutils.SanitizeForLog(req.Embedding.ModelName),
|
||||
source: types.ModelSource(req.Embedding.Source),
|
||||
description: "Embedding Model",
|
||||
baseURL: req.Embedding.BaseURL,
|
||||
baseURL: secutils.SanitizeForLog(req.Embedding.BaseURL),
|
||||
apiKey: req.Embedding.APIKey,
|
||||
dimension: req.Embedding.Dimension,
|
||||
},
|
||||
@@ -474,10 +474,10 @@ func (h *InitializationHandler) InitializeByKB(c *gin.Context) {
|
||||
interfaceType string
|
||||
}{
|
||||
modelType: types.ModelTypeRerank,
|
||||
name: req.Rerank.ModelName,
|
||||
name: secutils.SanitizeForLog(req.Rerank.ModelName),
|
||||
source: types.ModelSourceRemote,
|
||||
description: "Rerank Model",
|
||||
baseURL: req.Rerank.BaseURL,
|
||||
baseURL: secutils.SanitizeForLog(req.Rerank.BaseURL),
|
||||
apiKey: req.Rerank.APIKey,
|
||||
})
|
||||
}
|
||||
@@ -495,10 +495,10 @@ func (h *InitializationHandler) InitializeByKB(c *gin.Context) {
|
||||
interfaceType string
|
||||
}{
|
||||
modelType: types.ModelTypeVLLM,
|
||||
name: req.Multimodal.VLM.ModelName,
|
||||
name: secutils.SanitizeForLog(req.Multimodal.VLM.ModelName),
|
||||
source: types.ModelSourceRemote,
|
||||
description: "VLM Model",
|
||||
baseURL: req.Multimodal.VLM.BaseURL,
|
||||
baseURL: secutils.SanitizeForLog(req.Multimodal.VLM.BaseURL),
|
||||
apiKey: req.Multimodal.VLM.APIKey,
|
||||
interfaceType: req.Multimodal.VLM.InterfaceType,
|
||||
})
|
||||
|
||||
@@ -404,8 +404,6 @@ type GetKnowledgeBatchRequest struct {
|
||||
func (h *KnowledgeHandler) GetKnowledgeBatch(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
|
||||
logger.Info(ctx, "Start batch retrieving knowledge")
|
||||
|
||||
// Get tenant ID from context
|
||||
tenantID, ok := c.Get(types.TenantIDContextKey.String())
|
||||
if !ok {
|
||||
@@ -451,8 +449,6 @@ func (h *KnowledgeHandler) GetKnowledgeBatch(c *gin.Context) {
|
||||
|
||||
func (h *KnowledgeHandler) UpdateKnowledge(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
logger.Info(ctx, "Start Update knowledge")
|
||||
|
||||
// Get knowledge ID from URL path parameter
|
||||
id := secutils.SanitizeForLog(c.Param("id"))
|
||||
if id == "" {
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
@@ -107,7 +108,7 @@ func (h *KnowledgeBaseHandler) validateAndGetKnowledgeBase(c *gin.Context) (*typ
|
||||
}
|
||||
|
||||
// Get knowledge base ID from URL parameter
|
||||
id := c.Param("id")
|
||||
id := secutils.SanitizeForLog(c.Param("id"))
|
||||
if id == "" {
|
||||
logger.Error(ctx, "Knowledge base ID is empty")
|
||||
return nil, "", errors.NewBadRequestError("Knowledge base ID cannot be empty")
|
||||
|
||||
Reference in New Issue
Block a user