Add Recursive Self Aggregation (RSA) algorithm - #190
Closed
shashankk42 wants to merge 24 commits into
Closed
Conversation
added 24 commits
April 1, 2026 21:59
- Add RSA parameters (useRsa, rsaMode, rsaN, rsaK, rsaT) to sendMessageToServer - Add RSA parameters to handleComputeFlaskAI for compute-reaction-from action - Include RSA settings in dependency arrays for React hooks - Ensures RSA mode is sent when clicking 'How do I make this?' on nodes
- Route to AI-based retrosynthesis when RSA enabled or config file missing - Create root node for AI-based path (matching template-based behavior) - Support both standard one-shot and RSA modes from initial compute action - Maintain backward compatibility with template-based when config exists - Fix import for smiles_to_html from correct module (molecule_naming)
- Add os import at module level in both ai.py and template.py - Check if config file exists before attempting template expansion - Gracefully skip template search with info message when config unavailable - Prevent FileNotFoundError when /data/config.yml doesn't exist - Allow AI-based retrosynthesis to complete without template dependency - Production-ready: works with or without AiZynthFinder config
- Auto-detect WebSocket URL from request host header and protocol - Use wss:// for HTTPS requests, ws:// for HTTP requests - Support VS Code port forwarding (e.g., localhost:8003 -> ws://localhost:8003/ws) - Remove hardcoded localhost:8001 default - Maintain backward compatibility with WS_SERVER environment variable - Production-ready: works for local dev, port forwarding, and HTTPS hosting
…osals, inject into all prompts - Update system prompt to prevent redundant database queries
Bug: Proposals were using user_prompt instead of user_prompt_with_rag Result: Database queried N times instead of 1 (once per proposal) Fix: Use user_prompt_with_rag for proposal tasks (safe for standalone/RAG/non-RSA)
RAG mode: Query once, inject results, then remove tool (1 query total) Standalone mode: Remove tool entirely (0 queries) Non-RSA: Unaffected (tool remains available) Changes only within RSA block (lines 144-404)
Show summary of retrieved reactions in reasoning panel: - First 5 reactions with names and components - Reactants and products for each - Confirmation that results are injected into prompts
Created rsa_algorithm.py with run_rsa_loop() and refactored retrosynthesis to use it.
- Implement parallel execution for Stage 1 proposals using asyncio.gather() - Add runner_factory parameter to create independent runner instances - Add validation to filter proposals/aggregations with empty reactants - Default to parallel mode (parallel=True) with fallback to sequential - Retrosynthesis now creates independent runners for parallel execution
Aggregations within each stage run in parallel. Barriers enforce sequential stage progression.
This was referenced Apr 3, 2026
Author
|
Closing to create fresh PR with generic RSA implementation in ChARGe repo. |
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
Implement parallel Recursive Self-Aggregation (RSA) algorithm for retrosynthesis with AI-based/template-based routing and UI controls
File-by-file changes:
Related PRs
This PR depends on:
All three PRs must be merged together for RSA functionality to work.