revert page column (#8217)

This commit is contained in:
Jyong 2024-09-10 18:21:22 +08:00 committed by GitHub
parent d4dc54447a
commit bb3002b173
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 1 additions and 6 deletions

View File

@ -27,7 +27,7 @@ class AbstractVectorFactory(ABC):
class Vector:
def __init__(self, dataset: Dataset, attributes: list = None):
if attributes is None:
attributes = ["doc_id", "dataset_id", "document_id", "doc_hash", "page"]
attributes = ["doc_id", "dataset_id", "document_id", "doc_hash"]
self._dataset = dataset
self._embeddings = self._get_embeddings()
self._attributes = attributes

View File

@ -163,9 +163,6 @@ class KnowledgeRetrievalNode(BaseNode):
for item in all_documents:
if item.metadata.get("score"):
document_score_list[item.metadata["doc_id"]] = item.metadata["score"]
# both 'page' and 'score' are metadata fields
if item.metadata.get("page"):
page_number_list[item.metadata["doc_id"]] = item.metadata["page"]
index_node_ids = [document.metadata["doc_id"] for document in all_documents]
segments = DocumentSegment.query.filter(
@ -200,7 +197,6 @@ class KnowledgeRetrievalNode(BaseNode):
"document_id": document.id,
"document_name": document.name,
"document_data_source_type": document.data_source_type,
"page": page_number_list.get(segment.index_node_id, None),
"segment_id": segment.id,
"retriever_from": "workflow",
"score": document_score_list.get(segment.index_node_id, None),

View File

@ -451,7 +451,6 @@ class LLMNode(BaseNode):
"segment_position": metadata.get("segment_position"),
"index_node_hash": metadata.get("segment_index_node_hash"),
"content": context_dict.get("content"),
"page": metadata.get("page"),
}
return source