mirror of
https://github.com/Tencent/WeKnora.git
synced 2026-09-24 16:29:01 +08:00
Merge remote-tracking branch 'wizard/master'
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 14 MiB |
@@ -198,7 +198,7 @@ type InitializationRequest struct {
|
||||
// UpdateKBConfig 根据知识库ID和模型ID更新配置(简化版)
|
||||
func (h *InitializationHandler) UpdateKBConfig(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
kbIdStr := c.Param("kbId")
|
||||
kbIdStr := secutils.SanitizeForLog(c.Param("kbId"))
|
||||
|
||||
var req KBModelConfigRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
@@ -350,7 +350,7 @@ func (h *InitializationHandler) UpdateKBConfig(c *gin.Context) {
|
||||
// InitializeByKB 根据知识库ID执行配置更新
|
||||
func (h *InitializationHandler) InitializeByKB(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
kbIdStr := c.Param("kbId")
|
||||
kbIdStr := secutils.SanitizeForLog(c.Param("kbId"))
|
||||
|
||||
var req InitializationRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
@@ -1057,7 +1057,7 @@ func (h *InitializationHandler) updateTaskStatus(
|
||||
// GetCurrentConfigByKB 根据知识库ID获取配置信息
|
||||
func (h *InitializationHandler) GetCurrentConfigByKB(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
kbIdStr := c.Param("kbId")
|
||||
kbIdStr := secutils.SanitizeForLog(c.Param("kbId"))
|
||||
|
||||
logger.Info(ctx, "Getting configuration for knowledge base")
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ func (h *MessageHandler) LoadMessages(c *gin.Context) {
|
||||
logger.Info(ctx, "Start loading messages")
|
||||
|
||||
// Get path parameters and query parameters
|
||||
sessionID := c.Param("session_id")
|
||||
sessionID := secutils.SanitizeForLog(c.Param("session_id"))
|
||||
limit := secutils.SanitizeForLog(c.DefaultQuery("limit", "20"))
|
||||
beforeTimeStr := secutils.SanitizeForLog(c.DefaultQuery("before_time", ""))
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ func (h *ModelHandler) CreateModel(c *gin.Context) {
|
||||
model := &types.Model{
|
||||
TenantID: tenantID,
|
||||
Name: secutils.SanitizeForLog(req.Name),
|
||||
Type: req.Type,
|
||||
Type: types.ModelType(secutils.SanitizeForLog(string(req.Type))),
|
||||
Source: req.Source,
|
||||
Description: secutils.SanitizeForLog(req.Description),
|
||||
Parameters: req.Parameters,
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/Tencent/WeKnora/internal/errors"
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
secutils "github.com/Tencent/WeKnora/internal/utils"
|
||||
)
|
||||
|
||||
// TagHandler handles knowledge base tag operations.
|
||||
@@ -23,7 +24,7 @@ func NewTagHandler(tagService interfaces.KnowledgeTagService) *TagHandler {
|
||||
// ListTags returns all tags under a knowledge base with statistics.
|
||||
func (h *TagHandler) ListTags(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
kbID := c.Param("id")
|
||||
kbID := secutils.SanitizeForLog(c.Param("id"))
|
||||
|
||||
tags, err := h.tagService.ListTags(ctx, kbID)
|
||||
if err != nil {
|
||||
@@ -47,7 +48,7 @@ type createTagRequest struct {
|
||||
// CreateTag creates a new tag.
|
||||
func (h *TagHandler) CreateTag(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
kbID := c.Param("id")
|
||||
kbID := secutils.SanitizeForLog(c.Param("id"))
|
||||
|
||||
var req createTagRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
@@ -56,7 +57,8 @@ func (h *TagHandler) CreateTag(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
tag, err := h.tagService.CreateTag(ctx, kbID, req.Name, req.Color, req.SortOrder)
|
||||
tag, err := h.tagService.CreateTag(ctx, kbID,
|
||||
secutils.SanitizeForLog(req.Name), secutils.SanitizeForLog(req.Color), req.SortOrder)
|
||||
if err != nil {
|
||||
logger.ErrorWithFields(ctx, err, map[string]interface{}{
|
||||
"kb_id": kbID,
|
||||
@@ -81,7 +83,7 @@ type updateTagRequest struct {
|
||||
func (h *TagHandler) UpdateTag(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
|
||||
tagID := c.Param("tag_id")
|
||||
tagID := secutils.SanitizeForLog(c.Param("tag_id"))
|
||||
var req updateTagRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
logger.Error(ctx, "Failed to bind update tag payload", err)
|
||||
@@ -107,7 +109,7 @@ func (h *TagHandler) UpdateTag(c *gin.Context) {
|
||||
// DeleteTag deletes a tag. Use query param force=true to force delete even if referenced.
|
||||
func (h *TagHandler) DeleteTag(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
tagID := c.Param("tag_id")
|
||||
tagID := secutils.SanitizeForLog(c.Param("tag_id"))
|
||||
|
||||
force := c.Query("force") == "true"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user