Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
4b3982d7
Commit
4b3982d7
authored
Mar 12, 2024
by
crazywoola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: index error
parent
bdc7611d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
clean_dataset_task.py
api/tasks/clean_dataset_task.py
+5
-1
No files found.
api/tasks/clean_dataset_task.py
View file @
4b3982d7
...
...
@@ -15,7 +15,7 @@ from models.dataset import (
DocumentSegment
,
)
# Add import statement for ValueError
@
shared_task
(
queue
=
'dataset'
)
def
clean_dataset_task
(
dataset_id
:
str
,
tenant_id
:
str
,
indexing_technique
:
str
,
index_struct
:
str
,
collection_binding_id
:
str
,
doc_form
:
str
):
...
...
@@ -44,7 +44,11 @@ def clean_dataset_task(dataset_id: str, tenant_id: str, indexing_technique: str,
documents
=
db
.
session
.
query
(
Document
)
.
filter
(
Document
.
dataset_id
==
dataset_id
)
.
all
()
segments
=
db
.
session
.
query
(
DocumentSegment
)
.
filter
(
DocumentSegment
.
dataset_id
==
dataset_id
)
.
all
()
# Specify the index type before initializing the index processor
if
doc_form
is
None
:
raise
ValueError
(
"Index type must be specified."
)
index_processor
=
IndexProcessorFactory
(
doc_form
)
.
init_index_processor
()
index_processor
.
clean
(
dataset
,
None
)
for
document
in
documents
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment