feat: return data_source_info and data_source_detail_dict - #32
Conversation
🤖 Augment PR SummarySummary: This PR updates the document-detail API to return both the raw data-source payload and a richer “detail” representation, including better support for Changes:
Technical Notes: The detailed representation for 🤖 Was this summary useful? React with 👍 or 👎 |
| } | ||
| } | ||
| elif self.data_source_type in {"notion_import", "website_crawl"}: | ||
| elif self.data_source_type in {"notion_import", "website_crawl", "local_file"}: |
There was a problem hiding this comment.
data_source_detail_dict now parses JSON for local_file; unlike data_source_info_dict, this path doesn’t catch JSONDecodeError, so malformed data_source_info could raise and turn the document-detail API into a 500. Consider handling decode failures consistently (e.g., returning {}) to match data_source_info_dict’s behavior.
🤖 Was this useful? React with 👍 or 👎
| "position": document.position, | ||
| "data_source_type": document.data_source_type, | ||
| "data_source_info": data_source_info, | ||
| "data_source_info": document.data_source_detail_dict, |
There was a problem hiding this comment.
After this change, data_source_info is raw JSON for the default response but remains data_source_detail_dict for metadata=without, so the response shape for the same key depends on the query param. If clients expect a stable meaning for data_source_info, it may be worth aligning semantics between branches (also applies to the else branch below).
🤖 Was this useful? React with 👍 or 👎
|
|
||
|
|
||
| # ERROR: Expected LocalFileInfo, but got WebsiteCrawlInfo | ||
| case_2: LocalFileCase = { |
There was a problem hiding this comment.
| assert detail_result == website_data | ||
|
|
||
| def test_local_file_data_source_detail_dict_without_db(self): | ||
| """Test that local_file returns empty data_source_detail_dict (this doesn't need DB context).""" |
There was a problem hiding this comment.
This docstring/comments say local_file returns an empty dict / returns {} early, but the assertion expects parsed JSON ({"file_path": ...}), which matches the updated model behavior. Updating the description would prevent future confusion about intended semantics.
🤖 Was this useful? React with 👍 or 👎
Benchmark PR from qodo-benchmark#179