Skip to content

Improve chatbot#116

Open
zhangdjr wants to merge 20 commits intomainfrom
improve-chatbot
Open

Improve chatbot#116
zhangdjr wants to merge 20 commits intomainfrom
improve-chatbot

Conversation

@zhangdjr
Copy link
Collaborator

Fixed the issue with crappy RAG retrievals by using a better embeddings model while reindexing everything. Also added a keyword search fallback and made the documentation more relevant for users asking for help navigating the UI. Set a limit for number of search documentation calls. Improved Chatbot prompts to reduce hallucination tendencies. Also allowed for things like copy/pasting in the chatbot panel

Tian-hao Zhang added 2 commits February 10, 2026 12:56
…owed for things like copy/pasting in the chatbot panel
…gs model while reindexing everything. Also added a keyword search fallback and made the documentation more relevant for users asking for help navigating the UI. Set a limit for number of search documentation calls
@akgohain
Copy link
Collaborator

I vote @samcraftt review cuz he has worked more recently with the agent implementation...

@zhangdjr zhangdjr requested a review from Tonnthe1 February 10, 2026 20:50
Copy link

Copilot AI left a comment

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 improves the in-app chatbot’s retrieval quality and grounding by reindexing documentation with a stronger embedding model + chunking, adding a keyword-search fallback, and tightening prompt/tooling rules to reduce hallucinations. It also expands file-management capabilities in the UI/backend (mount/unmount project directories, image previews, OS “reveal in folder”) and updates the chatbot’s documentation corpus to be end-user page guides rather than source-file summaries.

Changes:

  • Rebuild RAG indexing (chunked documents, new embedding model), add keyword fallback, and cap documentation tool calls per user question.
  • Replace code-oriented “file summaries” with end-user-focused page/workflow documentation used by the chatbot.
  • Add File Manager mounting/unmounting + preview endpoints and corresponding UI/Electron integrations; adjust workflow selection modal behavior.

Reviewed changes

Copilot reviewed 53 out of 55 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
server_api/main.py Uses a reset callback from build_chain() before chat queries/clears (replacing prior memory clearing behavior).
server_api/chatbot/update_faiss.py Reindexes docs with chunking and a new embeddings model; saves updated FAISS index.
server_api/chatbot/chatbot.py Updates prompts/routing rules, limits doc search calls, adds keyword fallback, changes embedding model default, and returns a reset function.
server_api/chatbot/faiss_index/index.pkl Updated/added serialized FAISS docstore artifact committed to repo.
server_api/auth/router.py Adds file preview endpoint, mount/unmount project directory endpoints, and safer recursive delete behavior.
server_api/auth/models.py Adds MountDirectoryRequest schema for mount endpoint.
client/src/views/Views.js Removes workflow preference persistence/polling and defaults workflow selector modal to open on startup.
client/src/views/FilesManager.js Adds mounted project UX (mount/unmount, reveal-in-folder, mounted badges), image thumbnails via preview endpoint, and properties enhancements.
client/src/components/UnifiedFileInput.js Simplifies browse flow to use mounted-storage picker (removes source selection modal).
client/src/components/FileTreeSidebar.js Improves tree rendering/ellipsis styling for long names.
client/src/components/FilePickerModal.js Adds upload-from-local, image-only filtering, and thumbnail previews in picker.
client/main.js Adds standard Edit menu roles (cut/copy/paste/etc.) and IPC handler to reveal files in OS file explorer.
server_api/chatbot/file_summaries/views/ehtool/UnifiedImageEditor.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/views/ehtool/ProofreadingEditor.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/views/ehtool/ProgressTracker.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/views/ehtool/LayerGrid.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/views/ehtool/DetectionWorkflow.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/views/ehtool/DatasetLoader.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/views/ehtool/ClassificationPanel.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/views/WormErrorHandling.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/views/Visualization.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/views/Views.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/views/ProofReading.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/views/Monitoring.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/views/ModelTraining.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/views/ModelInference.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/views/FilesManager.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/views/EHTool.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/main.md Removed legacy server main summary from RAG corpus.
server_api/chatbot/file_summaries/contexts/YamlContext.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/contexts/GlobalContext.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/components/YamlFileUploader.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/components/YamlFileEditor.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/components/WorkflowSelector.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/components/UnifiedFileInput.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/components/SynapseList.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/components/ProofreadingControls.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/components/NeuroglancerViewer.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/components/InputSelector.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/components/FileTreeSidebar.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/components/FilePickerModal.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/components/Configurator.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/components/Chatbot.md Removed legacy code-oriented summary (replaced by end-user docs).
server_api/chatbot/file_summaries/api.md Removed legacy API-client summary from RAG corpus.
server_api/chatbot/file_summaries/App.md Removed legacy app root summary from RAG corpus.
server_api/chatbot/file_summaries/GettingStarted.md Adds end-user “Getting Started” guide for overall app navigation.
server_api/chatbot/file_summaries/FileManager.md Adds end-user File Manager workflow guide.
server_api/chatbot/file_summaries/Visualization.md Adds end-user Visualization (Neuroglancer) workflow guide.
server_api/chatbot/file_summaries/ModelTraining.md Adds end-user Model Training wizard/workflow guide.
server_api/chatbot/file_summaries/ModelInference.md Adds end-user Model Inference wizard/workflow guide.
server_api/chatbot/file_summaries/Monitoring.md Adds end-user TensorBoard Monitoring guide.
server_api/chatbot/file_summaries/Proofreading.md Adds end-user SynAnno proofreading guide.
server_api/chatbot/file_summaries/ErrorHandlingTool.md Adds end-user Error Handling Tool (EHT) workflow guide.
server_api/chatbot/file_summaries/WormErrorHandling.md Adds end-user Worm Error Handling page guide.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

zhangdjr and others added 2 commits February 10, 2026 15:56
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

Copilot AI commented Feb 10, 2026

@zhangdjr I've opened a new pull request, #117, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

Copilot AI commented Feb 10, 2026

@zhangdjr I've opened a new pull request, #118, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 6 commits February 10, 2026 21:06
Co-authored-by: zhangdjr <123129802+zhangdjr@users.noreply.github.com>
Co-authored-by: zhangdjr <123129802+zhangdjr@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: zhangdjr <123129802+zhangdjr@users.noreply.github.com>
Co-authored-by: zhangdjr <123129802+zhangdjr@users.noreply.github.com>
Copy link

Copilot AI commented Feb 10, 2026

@zhangdjr I've opened a new pull request, #119, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 6 commits February 10, 2026 21:10
Co-authored-by: zhangdjr <123129802+zhangdjr@users.noreply.github.com>
[WIP] Update based on feedback for chatbot improvement PR
Co-authored-by: zhangdjr <123129802+zhangdjr@users.noreply.github.com>
…nother-one

[WIP] Update to improve chatbot functionality based on feedback
…gain

Add input validation to /chat/query endpoint

oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token", auto_error=False)

# Mount operation guardrails to prevent self-DoS
Copy link
Collaborator

Choose a reason for hiding this comment

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

These changes seem unrelated to the chatbot and have to do with the file management functionality, right? If so, why are they necessary? @akgohain any thoughts on this since you were doing file management?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I concur.....I'll pull in a bit and see if it's just an extra guardrail (then sure...fine) or if it's breaking

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was something suggested by copilot during review, I think we could still move on without it but it's still good to have. Let me know what you think

@samcraftt
Copy link
Collaborator

Also, you can follow the formatting steps in README.md to appease the linter errors.

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.

4 participants