How internlm/mindsearch works
Project Type and Purpose
• MindSearch is a full-stack AI search application that exposes a FastAPI backend (“mindsearch.app”) running an LLM-based agent pipeline, offers multiple frontend interfaces (React SPA, Gradio, Streamlit), and provides a CLI Docker helper (“docker/msdl”) to scaffold and manage containerized deployments. Its core function is to accept user queries, perform concurrent sub-searches via external web-search APIs, feed results into an LLM agent, and render structured “mind-map” answers.
File Structure
─ Top-level files & dirs:
• mindsearch/ – Python package with agent modules, FastAPI app, terminal interface
• frontend/React – React + Vite SPA implementing the primary GUI
• frontend/gradio_agentchatbot & mindsearch_gradio.py – Gradio interface
• frontend/mindsearch_streamlit.py – Streamlit interface
• docker/msdl – CLI tool to generate Dockerfiles, docker‐compose templates, and manage container lifecycles
• backend_example.py – Script showing how to call the FastAPI backend directly
• Dockerfile, .dockerignore, docker/** – Root Docker setup and advanced Docker-template engine
• requirements.txt, .env.example – Python dependencies and environment setup
─ Patterns & choices:
• “agent” subfolder implements the pipeline: graph building, prompt templates, streaming
• Separation between UI clients (HTTP/JS) and Python backend (FastAPI + Pydantic)
• Plugin-style support for different search engines and LLM formats
README for Additional Insights
• Backend startup flags control language, model format (internlm_server, gpt4), search‐engine plugin, and async agent deployment.
• Frontend options: React SPA via Vite proxy, Gradio server script, Streamlit script.
• Docker CLI (“msdl”) is documented under docker/README.md—for generating end‐to‐end container stacks.