Skip to content

Commit

Permalink
Fixes 14217: database retrieve api and chat-messages api response doc…
Browse files Browse the repository at this point in the history
…_metadata (#14219)
  • Loading branch information
yuhaowin authored Feb 27, 2025
1 parent 5f692df commit 1e3197a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/core/rag/retrieval/dataset_retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ def retrieve(
"segment_id": segment.id,
"retriever_from": invoke_from.to_source(),
"score": record.score or 0.0,
"doc_metadata": document.doc_metadata,
}

if invoke_from.to_source() == "dev":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def _run(self, query: str) -> str:
"segment_id": segment.id,
"retriever_from": self.retriever_from,
"score": document_score_list.get(segment.index_node_id, None),
"doc_metadata": document.doc_metadata,
}

if self.retriever_from == "dev":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def _run(self, query: str) -> str:
"segment_id": segment.id,
"retriever_from": self.retriever_from,
"score": record.score or 0.0,
"doc_metadata": document.doc_metadat, # type: ignore
}

if self.retriever_from == "dev":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ def _fetch_dataset_retriever(self, node_data: KnowledgeRetrievalNodeData, query:
"segment_word_count": segment.word_count,
"segment_position": segment.position,
"segment_index_node_hash": segment.index_node_hash,
"doc_metadata": document.doc_metadata,
},
"title": document.name,
}
Expand Down
1 change: 1 addition & 0 deletions api/core/workflow/nodes/llm/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ def _convert_to_original_retriever_resource(self, context_dict: dict) -> Optiona
"index_node_hash": metadata.get("segment_index_node_hash"),
"content": context_dict.get("content"),
"page": metadata.get("page"),
"doc_metadata": metadata.get("doc_metadata"),
}

return source
Expand Down
1 change: 1 addition & 0 deletions api/fields/hit_testing_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"data_source_type": fields.String,
"name": fields.String,
"doc_type": fields.String,
"doc_metadata": fields.Raw,
}

segment_fields = {
Expand Down

0 comments on commit 1e3197a

Please sign in to comment.