Conversation
…jection clarifications limit
- Introduced a comprehensive QA prompt for reviewing projection runs, ensuring high-quality question generation. - Enhanced projection tools with incremental reading and writing capabilities for processed Markdown files. - Implemented new vision tools for image processing, including OCR and multimodal LLM interactions. - Improved project ingestion logic to detect and handle duplicate projects effectively. - Updated API and UI components to reflect changes in project metadata, including duplicate project identification. - Refactored review agent initialization to streamline LLM configuration.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the ingestion + agent workflows to better handle duplicate projects, enables incremental/paged projection extraction (including optional multimodal “vision” inspection of figures), and improves the frontend UX for running jobs and managing projections.
Changes:
- Detect and surface “duplicate projects” (all files already exist and belong to an earlier project) across backend APIs and both UIs.
- Add incremental projection workflows: per-file Markdown listing/reading,
update_projectionfor append-style writes, and new vision tools +vision_modelsetting. - Improve frontend projection management (column controls, selection + batch delete) and refresh job-driven views automatically when background jobs complete.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/mkb/ui/pages/projects.py | Displays duplicate-project indicators/warnings in the Streamlit project list/search/detail views. |
| src/mkb/processors/pdf_mineru_api.py | Changes MinerU data_id to a SHA256 of filename for upload requests. |
| src/mkb/ingest/worker.py | Adds duplicate-project detection and stores metadata_["duplicate_of"]. |
| src/mkb/config.py | Adds vision_model setting (fallback to extraction_model). |
| src/mkb/api.py | Exposes duplicate_of in list_projects; plumbs progress_callback into graph review. |
| src/mkb/agents/tools/vision.py | Introduces image listing + OCR + multimodal vision inspection tools for projection agents. |
| src/mkb/agents/tools/reading.py | Adds get_markdown_length and registers it in the reading tools list. |
| src/mkb/agents/tools/projection.py | Shifts toward incremental reading/writing: new Markdown file listing/reading helpers and update_projection. |
| src/mkb/agents/tools/frames.py | Uses deepcopy to avoid mutating stored JSON content in-place. |
| src/mkb/agents/runner.py | Adds RunConfig(max_llm_calls=...) support via AgentRunner. |
| src/mkb/agents/review.py | Switches agent model construction to shared create_llm. |
| src/mkb/agents/prompts/projection.py | Updates projection instructions for per-file paging, incremental writes, and vision-tool usage. |
| src/mkb/agents/prompts/projection_review.py | Adds a dedicated QA-benchmark projection review prompt. |
| src/mkb/agents/prompts/kb_extraction.py | Updates extraction prompt to “seed once, then incremental updates” workflow. |
| src/mkb/agents/projection.py | Supplies vision tools to the projection agent and updates run instructions accordingly. |
| src/mkb/agents/projection_reviewer.py | Selects reviewer prompt based on space.purpose (QA benchmark vs generic). |
| src/mkb/agents/feedback_reviewer.py | Switches agent model construction to shared create_llm. |
| src/mkb/agents/extraction.py | Switches agent model construction to shared create_llm; updates extraction run instructions. |
| src/mkb/agents/clarification.py | Lowers clarification agent max_llm_calls to 15. |
| frontend/src/pages/ProjectsPage.tsx | Adds “project from frame vs markdown” selector; refreshes parent list on job completion. |
| frontend/src/pages/ProjectionsPage.tsx | Adds per-section column prefs, floating horizontal scrollbar, row selection, and batch projection deletion. |
| frontend/src/pages/FramesPage.tsx | Forces tab refetches after job completion via a refreshKey and refreshes feedback count. |
Comments suppressed due to low confidence (1)
src/mkb/ingest/worker.py:121
return min(common)can raiseValueErrorifcommonis empty (e.g., all duplicate assets have no links after excludingexclude_project_id, especially when there’s only oneasset_id). Add anif not common: return Noneguard before callingmin().
# Return any single matching project (prefer the oldest / smallest UUID).
return min(common)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+102
to
+106
| for aid in asset_ids: | ||
| links = ( | ||
| session.query(ProjectAsset) | ||
| .filter( | ||
| ProjectAsset.asset_id == aid, |
Comment on lines
+913
to
+917
| try: | ||
| data = download_bytes(processed.s3_bucket, processed.s3_key) | ||
| text = data.decode("utf-8", errors="replace") | ||
| entry["total_chars"] = len(text) | ||
| entry["heading_count"] = sum( |
Contributor
There was a problem hiding this comment.
Comment on lines
+954
to
+958
| def update_projection( | ||
| projection_id: str, | ||
| additions: dict | str | None = None, | ||
| modifications: list | str | None = None, | ||
| removals: list | str | None = None, |
Contributor
There was a problem hiding this comment.
Added four tests in commit bc8e780:
test_update_projection_parses_json_string_inputs– verifies JSON-stringadditionsis parsed before usetest_update_projection_additions_append_to_existing_list– verifies additions are correctly appended to existing liststest_update_projection_removals_applied_in_descending_index_order– verifies higher indices are removed first so earlier indices stay validtest_update_projection_injects_source_project_id_when_frame_exists– verifiessource_project_idis injected into added items when a frame is present
Comment on lines
+152
to
+156
| Returns: | ||
| Dict with ``images`` (list of {image_ref, source_filename, | ||
| processed_asset_id, size_bytes_known}), ``total``, and | ||
| ``truncated``. | ||
| """ |
Agent-Logs-Url: https://github.com/theAfish/mat_know_base/sessions/ec3a4c43-5dca-44d3-9b8b-e32bde77e71c Co-authored-by: theAfish <85424334+theAfish@users.noreply.github.com>
Agent-Logs-Url: https://github.com/theAfish/mat_know_base/sessions/fccf3349-e42d-4ed7-8d1b-74591e864600 Co-authored-by: theAfish <85424334+theAfish@users.noreply.github.com>
Agent-Logs-Url: https://github.com/theAfish/mat_know_base/sessions/e6b543c1-c190-4c3c-b935-4dba3d4c2f77 Co-authored-by: theAfish <85424334+theAfish@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.