feat: Enhance knowledge base functionality by adding document search capability and updating related API and UI components
This commit is contained in:
@@ -232,7 +232,7 @@ func (h *InitializationHandler) UpdateKBConfig(c *gin.Context) {
|
||||
kbIdStr, &types.Pagination{
|
||||
Page: 1,
|
||||
PageSize: 1,
|
||||
}, "")
|
||||
}, "", "")
|
||||
if err == nil && knowledgeList != nil && knowledgeList.Total > 0 {
|
||||
logger.Error(ctx, "Cannot change embedding model when files exist")
|
||||
c.Error(errors.NewBadRequestError("知识库中已有文件,无法修改Embedding模型"))
|
||||
@@ -1176,7 +1176,7 @@ func (h *InitializationHandler) GetCurrentConfigByKB(c *gin.Context) {
|
||||
kbIdStr, &types.Pagination{
|
||||
Page: 1,
|
||||
PageSize: 1,
|
||||
}, "")
|
||||
}, "", "")
|
||||
hasFiles := err == nil && knowledgeList != nil && knowledgeList.Total > 0
|
||||
|
||||
// 构建配置响应
|
||||
|
||||
@@ -318,18 +318,20 @@ func (h *KnowledgeHandler) ListKnowledge(c *gin.Context) {
|
||||
}
|
||||
|
||||
tagID := c.Query("tag_id")
|
||||
keyword := c.Query("keyword")
|
||||
|
||||
logger.Infof(
|
||||
ctx,
|
||||
"Retrieving knowledge list under knowledge base, knowledge base ID: %s, tag_id: %s, page: %d, page size: %d",
|
||||
"Retrieving knowledge list under knowledge base, knowledge base ID: %s, tag_id: %s, keyword: %s, page: %d, page size: %d",
|
||||
secutils.SanitizeForLog(kbID),
|
||||
secutils.SanitizeForLog(tagID),
|
||||
secutils.SanitizeForLog(keyword),
|
||||
pagination.Page,
|
||||
pagination.PageSize,
|
||||
)
|
||||
|
||||
// Retrieve paginated knowledge entries
|
||||
result, err := h.kgService.ListPagedKnowledgeByKnowledgeBaseID(ctx, kbID, &pagination, tagID)
|
||||
result, err := h.kgService.ListPagedKnowledgeByKnowledgeBaseID(ctx, kbID, &pagination, tagID, keyword)
|
||||
if err != nil {
|
||||
logger.ErrorWithFields(ctx, err, nil)
|
||||
c.Error(errors.NewInternalServerError(err.Error()))
|
||||
|
||||
Reference in New Issue
Block a user