Skip to content

Commit

Permalink
revert page column (langgenius#8217)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnJyong authored and lau-td committed Oct 23, 2024
1 parent 61fedf3 commit 66f08ec
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
2 changes: 1 addition & 1 deletion api/core/rag/datasource/vdb/vector_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def gen_index_struct_dict(vector_type: VectorType, collection_name: str) -> dict
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,6 @@ def _fetch_dataset_retriever(self, node_data: KnowledgeRetrievalNodeData, query:
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(
Expand Down Expand Up @@ -200,7 +197,6 @@ def _fetch_dataset_retriever(self, node_data: KnowledgeRetrievalNodeData, query:
"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),
Expand Down
1 change: 0 additions & 1 deletion api/core/workflow/nodes/llm/llm_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ def _convert_to_original_retriever_resource(self, context_dict: dict) -> Optiona
"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
Expand Down

0 comments on commit 66f08ec

Please sign in to comment.