mirror of
https://gitee.com/dify_ai/dify.git
synced 2024-12-03 11:48:08 +08:00
add segment with keyword issue (#3351)
Co-authored-by: StyleZhang <jasonapring2015@outlook.com>
This commit is contained in:
parent
37024afe9c
commit
1f302990c6
@ -48,6 +48,9 @@ class Jieba(BaseKeyword):
|
||||
text = texts[i]
|
||||
if keywords_list:
|
||||
keywords = keywords_list[i]
|
||||
if not keywords:
|
||||
keywords = keyword_table_handler.extract_keywords(text.page_content,
|
||||
self._config.max_keywords_per_chunk)
|
||||
else:
|
||||
keywords = keyword_table_handler.extract_keywords(text.page_content, self._config.max_keywords_per_chunk)
|
||||
self._update_segment_keywords(self.dataset.id, text.metadata['doc_id'], list(keywords))
|
||||
|
@ -1046,6 +1046,8 @@ class SegmentService:
|
||||
credentials=embedding_model.credentials,
|
||||
texts=[content]
|
||||
)
|
||||
lock_name = 'add_segment_lock_document_id_{}'.format(document.id)
|
||||
with redis_client.lock(lock_name, timeout=600):
|
||||
max_position = db.session.query(func.max(DocumentSegment.position)).filter(
|
||||
DocumentSegment.document_id == document.id
|
||||
).scalar()
|
||||
@ -1085,6 +1087,8 @@ class SegmentService:
|
||||
|
||||
@classmethod
|
||||
def multi_create_segment(cls, segments: list, document: Document, dataset: Dataset):
|
||||
lock_name = 'multi_add_segment_lock_document_id_{}'.format(document.id)
|
||||
with redis_client.lock(lock_name, timeout=600):
|
||||
embedding_model = None
|
||||
if dataset.indexing_technique == 'high_quality':
|
||||
model_manager = ModelManager()
|
||||
|
@ -56,7 +56,9 @@ const TagInput: FC<TagInputProps> = ({
|
||||
}
|
||||
|
||||
onChange([...items, valueTrimed])
|
||||
setTimeout(() => {
|
||||
setValue('')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user