refactor: streamline document and FAQ index removal methods and enhance knowledge base deletion logic
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
package repositories
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"agent-desk/internal/models"
|
||||
"agent-desk/internal/pkg/enums"
|
||||
|
||||
"agent-desk/internal/pkg/httpx/params"
|
||||
|
||||
@@ -109,3 +112,16 @@ func (r *aIAgentRepository) FindByIds(db *gorm.DB, ids []int64) []models.AIAgent
|
||||
db.Where("id IN ?", ids).Find(&list)
|
||||
return list
|
||||
}
|
||||
|
||||
func (r *aIAgentRepository) FindByKnowledgeBaseID(db *gorm.DB, knowledgeBaseID int64) (list []models.AIAgent) {
|
||||
id := strconv.FormatInt(knowledgeBaseID, 10)
|
||||
db.Where(
|
||||
"(knowledge_ids = ? OR knowledge_ids LIKE ? OR knowledge_ids LIKE ? OR knowledge_ids LIKE ?) AND status <> ?",
|
||||
id,
|
||||
id+",%",
|
||||
"%,"+id,
|
||||
"%,"+id+",%",
|
||||
enums.StatusDeleted,
|
||||
).Find(&list)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user