Skip to content

Dev - #11

Merged
theAfish merged 6 commits into
mainfrom
dev
May 25, 2026
Merged

Dev#11
theAfish merged 6 commits into
mainfrom
dev

Conversation

@theAfish

Copy link
Copy Markdown
Owner

No description provided.

theAfish added 3 commits May 22, 2026 16:17
- 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.
Copilot AI review requested due to automatic review settings May 25, 2026 10:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_projection for append-style writes, and new vision tools + vision_model setting.
  • 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 raise ValueError if common is empty (e.g., all duplicate assets have no links after excluding exclude_project_id, especially when there’s only one asset_id). Add an if not common: return None guard before calling min().
    # 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 thread src/mkb/ingest/worker.py Outdated
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(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in commit ce40a4a (plus follow-up docs/test polish in 8b4eb9f): list_project_markdown_files now accepts max_files, caps processing, and returns truncated/total_files/limits metadata so large projects don’t require loading every markdown blob in one call.

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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added four tests in commit bc8e780:

  • test_update_projection_parses_json_string_inputs – verifies JSON-string additions is parsed before use
  • test_update_projection_additions_append_to_existing_list – verifies additions are correctly appended to existing lists
  • test_update_projection_removals_applied_in_descending_index_order – verifies higher indices are removed first so earlier indices stay valid
  • test_update_projection_injects_source_project_id_when_frame_exists – verifies source_project_id is 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``.
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants