✨Feat: Add AIDP search tool https://github.com/ModelEngine-Group/nexent/issues/2788#3241
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an AIDP-backed knowledge base search tool (SDK + backend proxy) and wires it through the frontend so multimodal retrieval results (including images) can be displayed and configured in the agent UI.
Changes:
- Add
AidpSearchToolin the SDK (FusionSearch) and register it for tool discovery/usage. - Add backend AIDP knowledge-base listing proxy (
/aidp/knowledge-bases) + new error codes/messages, and improve image/message handling (dedup + image loading adjustments). - Add frontend support for AIDP KB selection/config, result typing (
search_type), and image display improvements.
Reviewed changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
| test/sdk/core/tools/test_aidp_search_tool.py | Adds unit tests for AidpSearchTool behavior and observer messaging. |
| test/backend/services/test_conversation_management_service.py | Adds a test ensuring PICTURE_WEB URLs are deduplicated before saving. |
| test/backend/services/test_aidp_service.py | Adds tests for backend AIDP KB listing and error mapping. |
| sdk/nexent/utils/http_client_manager.py | Sets base_url on httpx sync/async clients for relative URL support. |
| sdk/nexent/core/utils/tools_common_message.py | Adds AIDP_SEARCH tool sign + mapping entry. |
| sdk/nexent/core/tools/aidp_search_tool.py | New SDK tool integrating AIDP FusionSearch with multimodal output. |
| sdk/nexent/core/tools/init.py | Exports AidpSearchTool from the SDK tools package. |
| frontend/types/chat.ts | Extends SearchResult with optional search_type. |
| frontend/types/agentConfig.ts | Adds AIDP knowledge base response/item types for UI consumption. |
| frontend/services/storageService.ts | Adjusts image URL conversion to avoid proxying localhost URLs. |
| frontend/services/knowledgeBaseService.ts | Adds AIDP KB fetch + mapping to internal KnowledgeBase model. |
| frontend/services/api.ts | Adds API_ENDPOINTS.aidp.knowledgeBases. |
| frontend/public/locales/zh/common.json | Adds zh i18n strings for AIDP selector UI. |
| frontend/public/locales/en/common.json | Adds en i18n strings for AIDP selector UI. |
| frontend/hooks/useKnowledgeBaseSelector.ts | Adds AIDP branch for fetching KBs for tool config and sync. |
| frontend/hooks/useKnowledgeBaseConfigChangeHandler.ts | Adds debounced change tracking for AIDP credentials. |
| frontend/const/agentConfig.ts | Adds AIDP tool param option enums for configuration UI. |
| frontend/components/tool-config/index.ts | Adds AIDP tool type mapping for KB source selection and skill mapping. |
| frontend/components/tool-config/AidpKnowledgeSelectorModal.tsx | New modal UI for selecting AIDP knowledge bases (paged list + filter). |
| frontend/app/[locale]/chat/streaming/taskWindow.tsx | Treats AIDP results as knowledge-base sources in the UI logic. |
| frontend/app/[locale]/chat/streaming/chatStreamHandler.tsx | Propagates search_type; refines PICTURE_WEB parsing. |
| frontend/app/[locale]/chat/internal/chatInterface.tsx | Changes message selection behavior to always open the right panel. |
| frontend/app/[locale]/chat/components/chatRightPanel.tsx | Updates knowledge source labeling + revises image preloading/loading logic. |
| frontend/app/[locale]/agents/components/agentConfig/ToolManagement.tsx | Includes aidp_search in KB-requiring tools + replaces console error with logger. |
| frontend/app/[locale]/agents/components/agentConfig/tool/ToolTestPanel.tsx | Adds AIDP kds_list handling for KB selection in the test panel. |
| frontend/app/[locale]/agents/components/agentConfig/tool/ToolConfigModal.tsx | Adds AIDP config, selector modal integration, and legacy param migration. |
| backend/utils/http_client_utils.py | Adds explicit follow_redirects param and renames kwargs passthrough. |
| backend/utils/auth_utils.py | Forces Supabase client to bypass system proxy via custom httpx client options. |
| backend/services/tool_configuration_service.py | Guards MCP tool description from being None; validates local aidp_search. |
| backend/services/image_service.py | Adds loopback URL handling for image proxying (direct fetch). |
| backend/services/conversation_management_service.py | Deduplicates image URLs when saving and when assembling history. |
| backend/services/aidp_service.py | New service function to fetch AIDP KB list with error-code mapping. |
| backend/database/conversation_db.py | Skips inserting duplicate (message_id, image_url) source image records. |
| backend/consts/error_message.py | Adds iData and AIDP error messages. |
| backend/consts/error_code.py | Adds AIDP error codes + HTTP status mappings. |
| backend/apps/config_app.py | Registers the new AIDP router. |
| backend/apps/aidp_app.py | Adds /aidp/knowledge-bases FastAPI endpoint proxying to AIDP service. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…uctured attributes are preserved during test execution
…nsure compatibility with LLM model retrieval and configuration management
…s.modules The previous stub captured `backend_file_management_module` (the stub itself) in `_stub_get_llm_model`, so `@patch` decorators modifying `sys.modules['backend.services.file_management_service']` were never visible. This caused `TestGetLlmModel` tests to return an unpached MagicMock instead of the expected mock_model_instance. Two changes: 1. `_stub_get_llm_model` now looks up all dependencies from `sys.modules['backend.services.file_management_service']` so that runtime patches from `@patch(...)` decorators are respected. 2. The stub module provides MagicMock defaults for all attributes that `@patch` needs to call `get_original()` on (tenant_config_manager etc.).
…consistent behavior across environments. Simplified test structure by directly patching `get_llm_model` and its dependencies, enhancing clarity and reliability of test cases.
WMC001
approved these changes
Jun 18, 2026
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.
新增AIDP search tool,支持返回多模检索结果并在前端展示



Add AIDP search tool Supports returning multimodal retrieval results and displaying them on the frontend. #2788