feat: 百科知识库存入向量

This commit is contained in:
Blizzard
2026-04-21 17:32:26 +08:00
parent ae0020aa71
commit b2e6e511cd
21 changed files with 802 additions and 35 deletions
+42
View File
@@ -139,6 +139,48 @@ func (a *WikiApi) DeleteWiki(c *gin.Context) {
response.OkWithMsg("删除成功", c)
}
// SyncWikiQdrant 单条百科同步到 Qdrant
// @Tags 百科
// @Summary 百科同步到Qdrant
// @Security BearerAuth
// @Produce application/json
// @Param data body common.GetById true "单条百科"
// @Router /wiki/sync-qdrant [post]
func (a *WikiApi) SyncWikiQdrant(c *gin.Context) {
var req common.GetById
if err := c.ShouldBindJSON(&req); err != nil {
response.FailWithMsg("请求参数错误", c)
return
}
if err := aiRagService.SyncSingleWiki(req.ID); err != nil {
global.Logger.Error("同步 Qdrant 失败", zap.Error(err))
response.FailWithMsg("同步失败: "+err.Error(), c)
return
}
response.OkWithMsg("同步成功", c)
}
// DeleteWikiQdrant 从 Qdrant 移除单条百科向量
// @Tags 百科
// @Summary 百科移除Qdrant
// @Security BearerAuth
// @Produce application/json
// @Param data body common.GetById true "单条百科"
// @Router /wiki/delete-qdrant [post]
func (a *WikiApi) DeleteWikiQdrant(c *gin.Context) {
var req common.GetById
if err := c.ShouldBindJSON(&req); err != nil {
response.FailWithMsg("请求参数错误", c)
return
}
if err := aiRagService.DeleteFromQdrant(req.ID); err != nil {
global.Logger.Error("从 Qdrant 删除向量失败", zap.Error(err))
response.FailWithMsg("移除失败: "+err.Error(), c)
return
}
response.OkWithMsg("移除成功", c)
}
// StarWiki 收藏百科
// @Tags 百科
// @Summary 收藏百科