deepcode-hku 1.0.9__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. {deepcode_hku-1.0.9/deepcode_hku.egg-info → deepcode_hku-1.2.0}/PKG-INFO +334 -139
  2. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/README.md +333 -138
  3. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/__init__.py +1 -1
  4. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/deepcode.py +171 -3
  5. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0/deepcode_hku.egg-info}/PKG-INFO +334 -139
  6. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/mcp_agent.secrets.yaml +2 -2
  7. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/code_implementation_workflow.py +4 -2
  8. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/.pre-commit-config.yaml +0 -0
  9. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/LICENSE +0 -0
  10. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/MANIFEST.in +0 -0
  11. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/cli/__init__.py +0 -0
  12. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/cli/cli_app.py +0 -0
  13. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/cli/cli_interface.py +0 -0
  14. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/cli/cli_launcher.py +0 -0
  15. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/cli/main_cli.py +0 -0
  16. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/cli/workflows/__init__.py +0 -0
  17. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/cli/workflows/cli_workflow_adapter.py +0 -0
  18. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/deepcode_hku.egg-info/SOURCES.txt +0 -0
  19. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/deepcode_hku.egg-info/dependency_links.txt +0 -0
  20. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/deepcode_hku.egg-info/entry_points.txt +0 -0
  21. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/deepcode_hku.egg-info/requires.txt +0 -0
  22. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/deepcode_hku.egg-info/top_level.txt +0 -0
  23. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/mcp_agent.config.yaml +0 -0
  24. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/prompts/code_prompts.py +0 -0
  25. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/requirements.txt +0 -0
  26. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/schema/mcp-agent.config.schema.json +0 -0
  27. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/setup.cfg +0 -0
  28. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/setup.py +0 -0
  29. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/tools/__init__.py +0 -0
  30. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/tools/bocha_search_server.py +0 -0
  31. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/tools/code_implementation_server.py +0 -0
  32. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/tools/code_indexer.py +0 -0
  33. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/tools/code_reference_indexer.py +0 -0
  34. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/tools/command_executor.py +0 -0
  35. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/tools/document_segmentation_server.py +0 -0
  36. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/tools/git_command.py +0 -0
  37. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/tools/pdf_converter.py +0 -0
  38. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/tools/pdf_downloader.py +0 -0
  39. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/tools/pdf_utils.py +0 -0
  40. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/ui/__init__.py +0 -0
  41. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/ui/app.py +0 -0
  42. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/ui/components.py +0 -0
  43. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/ui/handlers.py +0 -0
  44. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/ui/layout.py +0 -0
  45. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/ui/sidebar_feed.py +0 -0
  46. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/ui/streamlit_app.py +0 -0
  47. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/ui/styles.py +0 -0
  48. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/utils/__init__.py +0 -0
  49. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/utils/cli_interface.py +0 -0
  50. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/utils/cross_platform_file_handler.py +0 -0
  51. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/utils/dialogue_logger.py +0 -0
  52. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/utils/file_processor.py +0 -0
  53. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/utils/llm_utils.py +0 -0
  54. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/utils/simple_llm_logger.py +0 -0
  55. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/__init__.py +0 -0
  56. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/agent_orchestration_engine.py +0 -0
  57. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/agents/__init__.py +0 -0
  58. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/agents/code_implementation_agent.py +0 -0
  59. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/agents/document_segmentation_agent.py +0 -0
  60. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/agents/memory_agent_concise.py +0 -0
  61. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/agents/memory_agent_concise_index.py +0 -0
  62. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/agents/memory_agent_concise_multi.py +0 -0
  63. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/agents/requirement_analysis_agent.py +0 -0
  64. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/code_implementation_workflow_index.py +0 -0
  65. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/codebase_index_workflow.py +0 -0
  66. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/plugins/__init__.py +0 -0
  67. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/plugins/base.py +0 -0
  68. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/plugins/integration.py +0 -0
  69. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/plugins/plan_review.py +0 -0
  70. {deepcode_hku-1.0.9 → deepcode_hku-1.2.0}/workflows/plugins/requirement_analysis.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepcode-hku
3
- Version: 1.0.9
3
+ Version: 1.2.0
4
4
  Summary: AI Research Engine - Transform research papers into working code automatically
5
5
  Home-page: https://github.com/HKUDS/DeepCode
6
6
  Author: DeepCodeTeam
@@ -200,6 +200,7 @@ Dynamic: summary
200
200
  - [🏗️ Architecture](#️-architecture)
201
201
  - [📊 Experimental Results](#-experimental-results)
202
202
  - [🚀 Quick Start](#-quick-start)
203
+ - [🤖 nanobot Integration (Feishu Chatbot)](#-nanobot-integration-feishu-chatbot)
203
204
  - [💡 Examples](#-examples)
204
205
  - [🎬 Live Demonstrations](#-live-demonstrations)
205
206
  - [⭐ Star History](#-star-history)
@@ -210,7 +211,35 @@ Dynamic: summary
210
211
 
211
212
  ## 📰 News
212
213
 
213
- 🎨 **[2025-02] New Web UI Experience Upgrade!**
214
+ 🎉 **[2025-02] DeepCode + nanobot Integration — Chat with DeepCode via Feishu Bot!**
215
+
216
+ <div align="center">
217
+ <table><tr>
218
+ <td align="center"><a href="https://github.com/HKUDS/DeepCode"><img src="./assets/logo.png" alt="DeepCode" height="60"/></a></td>
219
+ <td align="center"><h2>✦</h2></td>
220
+ <td align="center"><a href="https://github.com/HKUDS/nanobot"><img src="./assets/nanobot.png" alt="nanobot" height="60"/></a></td>
221
+ </tr></table>
222
+ </div>
223
+
224
+ - [nanobot](https://github.com/HKUDS/nanobot) now connects to DeepCode — send messages in **Feishu** and get auto-generated code back
225
+ - Supports **Paper-to-Code** and **Chat-to-Code**, plus real-time task tracking, all from your chat app
226
+ - One-command deploy: `./nanobot/run_nanobot.sh` → **[Setup Guide →](#-nanobot-integration-feishu-chatbot)**
227
+
228
+ <div align="center">
229
+ <table width="100%"><tr>
230
+ <td width="50%" align="center">
231
+ <img src="./assets/IMG_8098.jpeg" alt="Feishu Chat Example 1" width="95%" style="border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.2);"/>
232
+ </td>
233
+ <td width="50%" align="center">
234
+ <img src="./assets/IMG_8099.jpeg" alt="Feishu Chat Example 2" width="95%" style="border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.2);"/>
235
+ </td>
236
+ </tr></table>
237
+ <sub><em>Feishu Bot in Action — Natural language → Full code generation with setup instructions</em></sub>
238
+ </div>
239
+
240
+ ---
241
+
242
+ 🎉 **[2025-02] New Web UI Experience Upgrade!**
214
243
 
215
244
  - 🔄 **User-in-Loop Interaction**: Support real-time user interaction during workflows - AI asks clarifying questions directly in the chat
216
245
  - 💬 **Inline Interaction Design**: Interaction prompts appear naturally within the chat flow for a seamless experience
@@ -226,7 +255,7 @@ Dynamic: summary
226
255
 
227
256
  ---
228
257
 
229
- 🎉 **[2025-10] 🎉 [2025-10-28] DeepCode Achieves SOTA on PaperBench!**
258
+ 🎉 **[2025-10-28] DeepCode Achieves SOTA on PaperBench!**
230
259
 
231
260
  DeepCode sets new benchmarks on OpenAI's PaperBench Code-Dev across all categories:
232
261
 
@@ -629,6 +658,8 @@ sudo apt-get install -y nodejs
629
658
 
630
659
  ### 📦 **Step 1: Installation**
631
660
 
661
+ Choose one of the following installation methods:
662
+
632
663
  #### ⚡ **Direct Installation (Recommended)**
633
664
 
634
665
  ```bash
@@ -638,29 +669,6 @@ pip install deepcode-hku
638
669
  # 🔑 Download configuration files
639
670
  curl -O https://raw.githubusercontent.com/HKUDS/DeepCode/main/mcp_agent.config.yaml
640
671
  curl -O https://raw.githubusercontent.com/HKUDS/DeepCode/main/mcp_agent.secrets.yaml
641
-
642
- # 🔑 Configure API keys (required)
643
- # Edit mcp_agent.secrets.yaml with your API keys and base_url:
644
- # - openai: api_key, base_url (for OpenAI/custom endpoints)
645
- # - anthropic: api_key (for Claude models)
646
- # - google: api_key (for Gemini models)
647
-
648
- # 🤖 Select your preferred LLM provider (optional)
649
- # Edit mcp_agent.config.yaml to choose your LLM (line ~106):
650
- # - llm_provider: "google" # Use Google Gemini models
651
- # - llm_provider: "anthropic" # Use Anthropic Claude models
652
- # - llm_provider: "openai" # Use OpenAI/compatible models
653
- # Note: If not set or unavailable, will automatically fallback to first available provider
654
-
655
- # 🔑 Configure search API keys for web search (optional)
656
- # Edit mcp_agent.config.yaml to set your API keys:
657
- # - For Brave Search: Set BRAVE_API_KEY: "your_key_here" in brave.env section (line ~28)
658
- # - For Bocha-MCP: Set BOCHA_API_KEY: "your_key_here" in bocha-mcp.env section (line ~74)
659
-
660
- # 📄 Configure document segmentation (optional)
661
- # Edit mcp_agent.config.yaml to control document processing:
662
- # - enabled: true/false (whether to use intelligent document segmentation)
663
- # - size_threshold_chars: 50000 (document size threshold to trigger segmentation)
664
672
  ```
665
673
 
666
674
  #### 🔧 **Development Installation (From Source)**
@@ -671,79 +679,91 @@ curl -O https://raw.githubusercontent.com/HKUDS/DeepCode/main/mcp_agent.secrets.
671
679
  ##### 🔥 **Using UV (Recommended for Development)**
672
680
 
673
681
  ```bash
674
- # 🔽 Clone the repository
675
682
  git clone https://github.com/HKUDS/DeepCode.git
676
683
  cd DeepCode/
677
684
 
678
- # 📦 Install UV package manager
679
685
  curl -LsSf https://astral.sh/uv/install.sh | sh
680
-
681
- # 🔧 Install dependencies with UV
682
686
  uv venv --python=3.13
683
687
  source .venv/bin/activate # On Windows: .venv\Scripts\activate
684
688
  uv pip install -r requirements.txt
685
689
 
686
- # 🔑 Configure API keys (required)
687
- # Edit mcp_agent.secrets.yaml with your API keys and base_url:
688
- # - openai: api_key, base_url (for OpenAI/custom endpoints)
689
- # - anthropic: api_key (for Claude models)
690
- # - google: api_key (for Gemini models)
691
-
692
- # 🤖 Select your preferred LLM provider (optional)
693
- # Edit mcp_agent.config.yaml to choose your LLM (line ~106):
694
- # - llm_provider: "google" # Use Google Gemini models
695
- # - llm_provider: "anthropic" # Use Anthropic Claude models
696
- # - llm_provider: "openai" # Use OpenAI/compatible models
697
- # Note: If not set or unavailable, will automatically fallback to first available provider
698
-
699
- # 🔑 Configure search API keys for web search (optional)
700
- # Edit mcp_agent.config.yaml to set your API keys:
701
- # - For Brave Search: Set BRAVE_API_KEY: "your_key_here" in brave.env section (line ~28)
702
- # - For Bocha-MCP: Set BOCHA_API_KEY: "your_key_here" in bocha-mcp.env section (line ~74)
703
-
704
- # 📄 Configure document segmentation (optional)
705
- # Edit mcp_agent.config.yaml to control document processing:
706
- # - enabled: true/false (whether to use intelligent document segmentation)
707
- # - size_threshold_chars: 50000 (document size threshold to trigger segmentation)
690
+ # Install frontend dependencies
691
+ npm install --prefix new_ui/frontend
708
692
  ```
709
693
 
710
694
  ##### 🐍 **Using Traditional pip**
711
695
 
712
696
  ```bash
713
- # 🔽 Clone the repository
714
697
  git clone https://github.com/HKUDS/DeepCode.git
715
698
  cd DeepCode/
716
699
 
717
- # 📦 Install dependencies
718
700
  pip install -r requirements.txt
719
701
 
720
- # 🔑 Configure API keys (required)
721
- # Edit mcp_agent.secrets.yaml with your API keys and base_url:
722
- # - openai: api_key, base_url (for OpenAI/custom endpoints)
723
- # - anthropic: api_key (for Claude models)
724
- # - google: api_key (for Gemini models)
725
-
726
- # 🤖 Select your preferred LLM provider (optional)
727
- # Edit mcp_agent.config.yaml to choose your LLM (line ~106):
728
- # - llm_provider: "google" # Use Google Gemini models
729
- # - llm_provider: "anthropic" # Use Anthropic Claude models
730
- # - llm_provider: "openai" # Use OpenAI/compatible models
731
- # Note: If not set or unavailable, will automatically fallback to first available provider
732
-
733
- # 🔑 Configure search API keys for web search (optional)
734
- # Edit mcp_agent.config.yaml to set your API keys:
735
- # - For Brave Search: Set BRAVE_API_KEY: "your_key_here" in brave.env section (line ~28)
736
- # - For Bocha-MCP: Set BOCHA_API_KEY: "your_key_here" in bocha-mcp.env section (line ~74)
737
-
738
- # 📄 Configure document segmentation (optional)
739
- # Edit mcp_agent.config.yaml to control document processing:
740
- # - enabled: true/false (whether to use intelligent document segmentation)
741
- # - size_threshold_chars: 50000 (document size threshold to trigger segmentation)
702
+ # Install frontend dependencies
703
+ npm install --prefix new_ui/frontend
742
704
  ```
743
705
 
744
706
  </details>
745
707
 
746
- #### 🪟 **Windows Users: Additional MCP Server Configuration**
708
+ ### 🔧 **Step 2: Configuration**
709
+
710
+ > The following configuration applies to **all installation methods** (pip, UV, source, and Docker).
711
+
712
+ #### 🔑 API Keys *(required)*
713
+
714
+ Edit `mcp_agent.secrets.yaml` with your API keys:
715
+
716
+ ```yaml
717
+ # At least ONE provider API key is required
718
+ openai:
719
+ api_key: "your_openai_api_key"
720
+ base_url: "https://openrouter.ai/api/v1" # Optional: for OpenRouter or custom endpoints
721
+
722
+ anthropic:
723
+ api_key: "your_anthropic_api_key" # For Claude models
724
+
725
+ google:
726
+ api_key: "your_google_api_key" # For Gemini models
727
+ ```
728
+
729
+ #### 🤖 LLM Provider *(optional)*
730
+
731
+ Edit `mcp_agent.config.yaml` to choose your preferred LLM provider (line ~106):
732
+
733
+ ```yaml
734
+ # Options: "google", "anthropic", "openai"
735
+ # If not set or unavailable, will automatically fallback to first available provider
736
+ llm_provider: "google"
737
+ ```
738
+
739
+ #### 🔍 Search API Keys *(optional)*
740
+
741
+ Configure web search in `mcp_agent.config.yaml`:
742
+
743
+ ```yaml
744
+ # For Brave Search (default) — set in brave.env section (line ~28)
745
+ brave:
746
+ env:
747
+ BRAVE_API_KEY: "your_brave_api_key_here"
748
+
749
+ # For Bocha-MCP (alternative) — set in bocha-mcp.env section (line ~74)
750
+ bocha-mcp:
751
+ env:
752
+ BOCHA_API_KEY: "your_bocha_api_key_here"
753
+ ```
754
+
755
+ #### 📄 Document Segmentation *(optional)*
756
+
757
+ Control document processing in `mcp_agent.config.yaml`:
758
+
759
+ ```yaml
760
+ document_segmentation:
761
+ enabled: true # true/false — whether to use intelligent document segmentation
762
+ size_threshold_chars: 50000 # Document size threshold to trigger segmentation
763
+ ```
764
+
765
+ <details>
766
+ <summary><strong>🪟 Windows Users: Additional MCP Server Configuration</strong></summary>
747
767
 
748
768
  If you're using Windows, you may need to configure MCP servers manually in `mcp_agent.config.yaml`:
749
769
 
@@ -771,7 +791,10 @@ mcp:
771
791
 
772
792
  > **Note**: Replace the path with your actual global node_modules path from step 2.
773
793
 
774
- #### 🔍 **Search Server Configuration (Optional)**
794
+ </details>
795
+
796
+ <details>
797
+ <summary><strong>🔍 Search Server Configuration (Optional)</strong></summary>
775
798
 
776
799
  DeepCode supports multiple search servers for web search functionality. You can configure your preferred option in `mcp_agent.config.yaml`:
777
800
 
@@ -782,17 +805,10 @@ default_search_server: "brave"
782
805
  ```
783
806
 
784
807
  **Available Options:**
785
- - **🔍 Brave Search** (`"brave"`):
786
- - Default option with high-quality search results
787
- - Requires BRAVE_API_KEY configuration
788
- - Recommended for most users
789
-
790
- - **🌐 Bocha-MCP** (`"bocha-mcp"`):
791
- - Alternative search server option
792
- - Requires BOCHA_API_KEY configuration
793
- - Uses local Python server implementation
808
+ - **🔍 Brave Search** (`"brave"`): Default option with high-quality search results. Requires `BRAVE_API_KEY`. Recommended for most users.
809
+ - **🌐 Bocha-MCP** (`"bocha-mcp"`): Alternative search server. Requires `BOCHA_API_KEY`. Uses local Python server implementation.
794
810
 
795
- **API Key Configuration in mcp_agent.config.yaml:**
811
+ **Full MCP server configuration in mcp_agent.config.yaml:**
796
812
  ```yaml
797
813
  # For Brave Search (default) - around line 28
798
814
  brave:
@@ -812,87 +828,266 @@ bocha-mcp:
812
828
 
813
829
  > **💡 Tip**: Both search servers require API key configuration. Choose the one that best fits your API access and requirements.
814
830
 
815
- ### ⚡ **Step 2: Launch Application**
831
+ </details>
832
+
833
+ ### ⚡ **Step 3: Launch Application**
834
+
835
+ Choose your preferred launch method:
836
+
837
+ <table width="100%">
838
+ <tr>
839
+ <th width="33%">🐳 Docker (Recommended)</th>
840
+ <th width="33%">🚀 Local (<code>deepcode</code> command)</th>
841
+ <th width="33%">🛠️ Other Methods</th>
842
+ </tr>
843
+ <tr><td>
816
844
 
817
- #### 🚀 **Using `deepcode` Command (Recommended)**
845
+ No Python/Node needed — everything in container.
818
846
 
819
847
  ```bash
820
- # 🌐 Launch the new React-based web interface
821
- deepcode
848
+ git clone https://github.com/HKUDS/DeepCode.git
849
+ cd DeepCode/
850
+ cp mcp_agent.secrets.yaml.example \
851
+ mcp_agent.secrets.yaml
852
+ # Edit secrets with your API keys
822
853
 
823
- # Frontend: http://localhost:5173
824
- # Backend API: http://localhost:8000
825
- # Press Ctrl+C to stop all services
854
+ ./deepcode_docker/run_docker.sh
855
+ # Access → http://localhost:8000
826
856
  ```
827
- <div align="center">
828
- <img src="https://img.shields.io/badge/Frontend-localhost:5173-00d4ff?style=flat-square&logo=react&logoColor=white" alt="Frontend" />
829
- <img src="https://img.shields.io/badge/Backend-localhost:8000-4ecdc4?style=flat-square&logo=fastapi&logoColor=white" alt="Backend" />
830
- </div>
831
857
 
832
- > **📦 Auto Install**: On first run, dependencies are automatically installed (`pip install` for backend, `npm install` for frontend)
858
+ </td><td>
833
859
 
834
- > **✨ Features**: User-in-Loop interaction, real-time progress tracking, inline chat interaction
860
+ Auto-installs deps on first run.
835
861
 
836
- #### 🛠️ **Alternative Launch Methods**
862
+ ```bash
863
+ deepcode
864
+ # Frontend → http://localhost:5173
865
+ # Backend → http://localhost:8000
866
+ # Ctrl+C to stop
867
+ ```
837
868
 
838
- <table>
839
- <tr>
840
- <td><strong>🍎 macOS / 🐧 Linux</strong></td>
841
- <td><strong>🪟 Windows</strong></td>
842
- </tr>
843
- <tr>
844
- <td>
869
+ Features: User-in-Loop, real-time progress, inline chat.
870
+
871
+ </td><td>
845
872
 
846
873
  ```bash
847
- # Using run.sh
874
+ # macOS / Linux
848
875
  ./run.sh
876
+ # or: python deepcode.py
849
877
 
850
- # Or using Python directly
851
- python deepcode.py
852
- ```
853
-
854
- </td>
855
- <td>
856
-
857
- ```cmd
858
- # Using run.bat
878
+ # Windows
859
879
  run.bat
880
+ # or: python deepcode.py
860
881
 
861
- # Or using Python directly
862
- python deepcode.py
882
+ # Classic Streamlit UI
883
+ deepcode --classic
884
+
885
+ # CLI mode
886
+ deepcode --cli
887
+ # or: python cli/main_cli.py
863
888
  ```
864
889
 
865
- </td>
866
- </tr>
890
+ </td></tr>
867
891
  </table>
868
892
 
893
+ <details>
894
+ <summary><strong>🐳 Docker Management Commands</strong></summary>
895
+
869
896
  ```bash
870
- # Classic Streamlit UI (all platforms)
871
- deepcode --classic
897
+ ./deepcode_docker/run_docker.sh stop # Stop
898
+ ./deepcode_docker/run_docker.sh restart # Restart (no rebuild needed for config changes)
899
+ ./deepcode_docker/run_docker.sh --build # Force rebuild
900
+ ./deepcode_docker/run_docker.sh logs # Real-time logs
901
+ ./deepcode_docker/run_docker.sh status # Health check
902
+ ./deepcode_docker/run_docker.sh clean # Remove containers & images
872
903
  ```
873
- <div align="center">
874
- <img src="https://img.shields.io/badge/Classic_UI-localhost:8501-00d4ff?style=flat-square&logo=streamlit&logoColor=white" alt="Classic UI" />
875
- </div>
876
904
 
877
- ##### 🖥️ **CLI Interface** (Advanced Users)
905
+ Or with Docker Compose directly:
878
906
  ```bash
879
- # Using UV
880
- uv run python cli/main_cli.py
881
- # Or using traditional Python
882
- python cli/main_cli.py
907
+ docker compose -f deepcode_docker/docker-compose.yml up --build # Build & start
908
+ docker compose -f deepcode_docker/docker-compose.yml down # Stop
909
+ docker compose -f deepcode_docker/docker-compose.yml logs -f # Logs
883
910
  ```
911
+
912
+ > **💡** Config files are mounted as volumes — edit and restart, no rebuild needed.
913
+ > **💡** Windows users: run `docker compose` commands directly if shell scripts aren't available.
914
+
915
+ </details>
916
+
917
+ ### 🎯 **Step 4: Generate Code**
918
+
919
+ 1. **📄 Input** — Upload a research paper, type requirements, or paste a URL
920
+ 2. **🤖 Processing** — The multi-agent system analyzes, plans, and generates
921
+ 3. **⚡ Output** — Receive production-ready code with tests and documentation
922
+
923
+ ---
924
+
925
+ ### 🔧 **Troubleshooting**
926
+
927
+ <details>
928
+ <summary><strong>❓ Common Issues & Solutions</strong></summary>
929
+
930
+ | Problem | Cause | Fix |
931
+ |---|---|---|
932
+ | Docker build fails with `tsc: not found` | Corrupted build cache | `docker builder prune -f` then rebuild with `--no-cache` |
933
+ | `error during connect` / `cannot find the file` | Docker Desktop not running | Start Docker Desktop, wait until ready, retry |
934
+ | Frontend blank page | Corrupted `node_modules` | `cd new_ui/frontend && rm -rf node_modules && npm install` |
935
+ | `ERR_CONNECTION_REFUSED` | Wrong port / backend not running | Docker: `http://localhost:8000`. Local: `http://localhost:5173` |
936
+ | `npm install` → `Could not read package.json` | Wrong directory | Use `npm install --prefix new_ui/frontend` |
937
+ | Windows: MCP servers not working | Need absolute paths | See [Windows MCP Configuration](#-step-2-configuration) above |
938
+
939
+ </details>
940
+
941
+ ---
942
+
943
+ ## 🤖 nanobot Integration (Feishu Chatbot)
944
+
945
+ > Chat with DeepCode from **Feishu** — powered by [nanobot](https://github.com/HKUDS/nanobot).
946
+
947
+ <div align="center">
948
+
949
+ ```mermaid
950
+ flowchart LR
951
+ subgraph Clients["💬 Chat Platforms"]
952
+ direction TB
953
+ F["<b>Feishu</b><br/>WebSocket"]
954
+ T["<b>Telegram</b><br/>Polling"]
955
+ D["<b>Discord</b><br/>Gateway"]
956
+ end
957
+
958
+ subgraph Gateway["🐈 nanobot Gateway"]
959
+ direction TB
960
+ A["Agent Loop<br/><i>LLM + Tool Calls</i>"]
961
+ end
962
+
963
+ subgraph Engine["🧠 DeepCode Engine"]
964
+ direction TB
965
+ P2C["Paper → Code"]
966
+ C2C["Chat → Code"]
967
+ TRK["Task Tracking"]
968
+ end
969
+
970
+ F & T & D <-->|"messages"| A
971
+ A -->|"HTTP API"| P2C & C2C & TRK
972
+ A -.->|"LLM API"| LLM["☁️ OpenRouter"]
973
+
974
+ style Clients fill:#1a1a2e,stroke:#00d9ff,color:#fff
975
+ style Gateway fill:#1a1a2e,stroke:#4ecdc4,color:#fff
976
+ style Engine fill:#1a1a2e,stroke:#ff6b6b,color:#fff
977
+ style LLM fill:#1a1a2e,stroke:#9b59b6,color:#fff
978
+ ```
979
+
980
+ </div>
981
+
884
982
  <div align="center">
885
- <img src="https://img.shields.io/badge/Mode-Interactive_Terminal-9b59b6?style=flat-square&logo=terminal&logoColor=white" alt="CLI Mode" />
983
+ <table><tr>
984
+ <td align="center"><a href="https://github.com/HKUDS/DeepCode"><img src="./assets/logo.png" alt="DeepCode" height="55"/></a></td>
985
+ <td align="center"><h2>✦</h2></td>
986
+ <td align="center"><a href="https://github.com/HKUDS/nanobot"><img src="./assets/nanobot.png" alt="nanobot" height="55"/></a></td>
987
+ </tr></table>
886
988
  </div>
887
989
 
888
- ### 🎯 **Step 3: Generate Code**
990
+ Both services run inside the same **Docker Compose** network. Prerequisites: **Docker Desktop** + **OpenRouter API Key** ([get one](https://openrouter.ai/keys)) + **Feishu App**.
991
+
992
+ ---
889
993
 
890
- 1. **📄 Input**: Upload your research paper, provide requirements, or paste a URL
891
- 2. **🤖 Processing**: Watch the multi-agent system analyze and plan
892
- 3. **⚡ Output**: Receive production-ready code with tests and documentation
994
+ ### Step 1 · Create a Feishu Bot
893
995
 
996
+ <details open>
997
+ <summary><b>Feishu / Lark</b> (Recommended — WebSocket, no public IP needed)</summary>
894
998
 
895
- ---
999
+ 1. Go to [Feishu Open Platform](https://open.feishu.cn/app) → **Create Custom App**
1000
+ 2. Enable **Bot** capability in App Features
1001
+ 3. Add permissions: `im:message` · `im:message:send_as_bot`
1002
+ 4. Event Subscription → select **Long Connection** → add `im.message.receive_v1`
1003
+ 5. Note your **App ID** (`cli_xxx`) and **App Secret** → Publish the app
1004
+
1005
+ > **Note**: Feishu requires an active WebSocket connection before you can save "Long Connection" mode. Start nanobot first (Step 3), then come back to configure Event Subscription.
1006
+
1007
+ </details>
1008
+
1009
+ ### Step 2 · Configure
1010
+
1011
+ ```bash
1012
+ cp nanobot_config.json.example nanobot_config.json
1013
+ ```
1014
+
1015
+ Edit `nanobot_config.json` — fill in the 3 required fields:
1016
+
1017
+ ```jsonc
1018
+ {
1019
+ "channels": {
1020
+ "feishu": {
1021
+ "enabled": true,
1022
+ "appId": "cli_xxx", // ← Feishu App ID
1023
+ "appSecret": "xxx", // ← Feishu App Secret
1024
+ "allowFrom": [] // [] = allow all users
1025
+ }
1026
+ },
1027
+ "providers": {
1028
+ "openrouter": {
1029
+ "apiKey": "sk-or-v1-xxx" // ← OpenRouter API Key
1030
+ }
1031
+ },
1032
+ "agents": {
1033
+ "defaults": {
1034
+ "model": "anthropic/claude-sonnet-4-20250514"
1035
+ }
1036
+ }
1037
+ }
1038
+ ```
1039
+
1040
+ > **Model choice**: Any model on [openrouter.ai/models](https://openrouter.ai/models). Use `anthropic/claude-sonnet-4-20250514` for English, `minimax/minimax-m2.1` for Chinese.
1041
+
1042
+ ---
1043
+
1044
+ ### Step 3 · Launch
1045
+
1046
+ Make sure `mcp_agent.secrets.yaml` has your DeepCode API keys (see [Configuration](#-step-2-configuration)), then:
1047
+
1048
+ ```bash
1049
+ ./nanobot/run_nanobot.sh -d # Start both DeepCode + nanobot in background
1050
+ ```
1051
+
1052
+ The script checks Docker, validates configs, builds images (first run only), and starts both containers.
1053
+
1054
+ ```
1055
+ ✓ DeepCode API: http://localhost:8000
1056
+ ✓ Nanobot: http://localhost:18790
1057
+ ```
1058
+
1059
+ Now open Feishu → find your bot → send a message!
1060
+
1061
+ <details>
1062
+ <summary><b>Management Commands</b></summary>
1063
+
1064
+ ```bash
1065
+ ./nanobot/run_nanobot.sh # Start (foreground)
1066
+ ./nanobot/run_nanobot.sh -d # Start (background)
1067
+ ./nanobot/run_nanobot.sh stop # Stop all services
1068
+ ./nanobot/run_nanobot.sh restart # Restart (config changes take effect immediately)
1069
+ ./nanobot/run_nanobot.sh --build # Force rebuild Docker images
1070
+ ./nanobot/run_nanobot.sh logs # View real-time logs
1071
+ ./nanobot/run_nanobot.sh status # Health check
1072
+ ./nanobot/run_nanobot.sh clean # Remove containers & images
1073
+ ```
1074
+
1075
+ </details>
1076
+
1077
+ <details>
1078
+ <summary><b>Troubleshooting</b></summary>
1079
+
1080
+ | Problem | Fix |
1081
+ |---|---|
1082
+ | Feishu bot doesn't respond | Check logs (`./nanobot/run_nanobot.sh logs`), verify `appId`/`appSecret`, ensure app is published with Long Connection mode |
1083
+ | Can't connect to DeepCode | Verify `deepcode` container is healthy: `curl http://localhost:8000/health` |
1084
+ | Wrong language output | Switch model — `minimax-m2.1` defaults to Chinese, use Claude/GPT for English |
1085
+ | Config not taking effect | Just restart: `./nanobot/run_nanobot.sh restart` (no rebuild needed) |
1086
+ | Clear chat history | Send `/clear` in chat, or: `docker exec nanobot sh -c 'rm -rf /root/.nanobot/sessions/*.jsonl'` |
1087
+
1088
+ </details>
1089
+
1090
+ ---
896
1091
 
897
1092
  ## 💡 Examples
898
1093