Skip to content

Commit

Permalink
fix: remove tag filter in knowledgebase
Browse files Browse the repository at this point in the history
Signed-off-by: bjwswang <[email protected]>
  • Loading branch information
bjwswang committed Mar 14, 2024
1 parent 4a1e38e commit 4c04c87
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions controllers/base/knowledgebase_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,15 +499,6 @@ func (r *KnowledgeBaseReconciler) reconcileFileGroup(ctx context.Context, log lo

func (r *KnowledgeBaseReconciler) handleFile(ctx context.Context, log logr.Logger, file io.ReadCloser, fileName string, tags map[string]string, kb *arcadiav1alpha1.KnowledgeBase, store *arcadiav1alpha1.VectorStore, embedder *arcadiav1alpha1.Embedder) (err error) {
log = log.WithValues("fileName", fileName, "tags", tags)
if tags == nil {
log.Info("file tags is nil, ignore")
return fmt.Errorf("file tags is nil, %w", errFileSkipped)
}
v, ok := tags[arcadiav1alpha1.ObjectTypeTag]
if !ok {
log.Info("file tags object type not found, ignore")
return fmt.Errorf("file tags object type not found, %w", errFileSkipped)
}
if !embedder.Status.IsReady() {
return errEmbedderNotReady
}
Expand All @@ -530,7 +521,8 @@ func (r *KnowledgeBaseReconciler) handleFile(ctx context.Context, log logr.Logge
case ".txt":
loader = documentloaders.NewText(dataReader)
case ".csv":
if v == arcadiav1alpha1.ObjectTypeQA {
v, ok := tags[arcadiav1alpha1.ObjectTypeTag]
if ok && v == arcadiav1alpha1.ObjectTypeQA {
// for qa csv,we skip the text splitter
loader = pkgdocumentloaders.NewQACSV(dataReader, fileName)
} else {
Expand Down

0 comments on commit 4c04c87

Please sign in to comment.