BodyMaps AI assistant: streaming chat, organ segmentation & measurement, screenshot vision - #119
Merged
Conversation
| return jsonify(manifest) | ||
| except Exception as exc: | ||
| print(f"[mesh] manifest generation failed for {display_id}: {exc}") | ||
| return jsonify({"error": f"Error generating mesh manifest: {exc}"}), 500 |
| def get_mesh_file(display_id, filename): | ||
| # Both segments come straight from the URL and are joined into a path; | ||
| # apply the same id-guard + secure_filename barrier as the other routes. | ||
| if not _is_safe_id(display_id): |
| return (job.get("status") or "").lower() if job else "" | ||
| Returns None when the session is genuinely unknown. A job found only on | ||
| disk was started by a *previous* process (a job from this process would | ||
| still be in memory); if that disk copy is still "running" its worker |
| reporting a phantom "running" that would poll forever. | ||
| """ | ||
| job = inference_jobs.get(session_id) | ||
| if job: |
| @@ -948,15 +1009,9 @@ def _uploaded_file_candidate(session_id, uploaded_filename): | |||
| return candidate if os.path.exists(candidate) else None | |||
| @@ -948,15 +1009,9 @@ def _uploaded_file_candidate(session_id, uploaded_filename): | |||
| return candidate if os.path.exists(candidate) else None | |||
Collaborator
Author
|
The CodeQL alerts here are all pre-existing repo issues, not introduced by this PR, the critical SSRF is the existing /proxy-image route, and several are in services/inference_job_queue.py, which this PR doesn't touch. They surface as "new" only because main has no CodeQL baseline (the repo already lists 88 alerts). All new file paths in this PR validate case IDs as integers before any file access. Happy to open a separate hardening PR for the pre-existing findings if useful. |
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.
Summary
Adds a conversational AI assistant embedded in the CT viewer. Users can segment
and measure organs, read the CT views, and ask general medical questions. It runs
entirely on local models via Ollama, so no external API is required.
What's included
volume computed from the segmentation mask (voxel count × voxel size → cm³).
so the assistant can identify each mask color.
scripts/precompute_meshes.pycan pre-bake meshes.How to run
Backend: set
flask-server/.env(see.env.example) and runpython app.py.Frontend:
npm install && npm run dev. Models: Ollama with llama3.1, qwen3-vl, qwen3.