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
2d604d93
Unverified
Commit
2d604d93
authored
Aug 25, 2023
by
Jyong
Committed by
GitHub
Aug 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix/filter empty segment (#1004)
Co-authored-by:
jyong
<
jyong@dify.ai
>
parent
e7199826
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
indexing_runner.py
api/core/indexing_runner.py
+6
-5
dataset_service.py
api/services/dataset_service.py
+4
-0
No files found.
api/core/indexing_runner.py
View file @
2d604d93
...
...
@@ -525,11 +525,12 @@ class IndexingRunner:
documents
=
splitter
.
split_documents
([
text_doc
])
split_documents
=
[]
for
document_node
in
documents
:
if
document_node
.
page_content
.
strip
():
doc_id
=
str
(
uuid
.
uuid4
())
hash
=
helper
.
generate_text_hash
(
document_node
.
page_content
)
document_node
.
metadata
[
'doc_id'
]
=
doc_id
document_node
.
metadata
[
'doc_hash'
]
=
hash
split_documents
.
append
(
document_node
)
all_documents
.
extend
(
split_documents
)
# processing qa document
...
...
api/services/dataset_service.py
View file @
2d604d93
...
...
@@ -891,6 +891,10 @@ class SegmentService:
if
document
.
doc_form
==
'qa_model'
:
if
'answer'
not
in
args
or
not
args
[
'answer'
]:
raise
ValueError
(
"Answer is required"
)
if
not
args
[
'answer'
]
.
strip
():
raise
ValueError
(
"Answer is empty"
)
if
'content'
not
in
args
or
not
args
[
'content'
]
or
not
args
[
'content'
]
.
strip
():
raise
ValueError
(
"Content is empty"
)
@
classmethod
def
create_segment
(
cls
,
args
:
dict
,
document
:
Document
,
dataset
:
Dataset
):
...
...
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