Skip to content

✨Feat: Add AIDP search tool https://github.com/ModelEngine-Group/nexent/issues/2788#3241

Merged
WMC001 merged 9 commits into
developfrom
djb_aidp_search_tool
Jun 18, 2026
Merged

✨Feat: Add AIDP search tool https://github.com/ModelEngine-Group/nexent/issues/2788#3241
WMC001 merged 9 commits into
developfrom
djb_aidp_search_tool

Conversation

@DongJiBao2001

Copy link
Copy Markdown
Contributor

新增AIDP search tool,支持返回多模检索结果并在前端展示
Add AIDP search tool Supports returning multimodal retrieval results and displaying them on the frontend. #2788
img_v3_0212n_9fb37c9c-21ee-45e0-8768-1ded4ef7996g
img_v3_0212n_94c841ae-0d30-4c51-a558-20a20adab1eg
img_v3_0212n_8b2c7508-2217-42b2-9a1e-a872bd34a05g

@DongJiBao2001 DongJiBao2001 requested a review from WMC001 as a code owner June 16, 2026 03:52
Copilot AI review requested due to automatic review settings June 16, 2026 03:52
@DongJiBao2001 DongJiBao2001 requested a review from Dallas98 as a code owner June 16, 2026 03:52
Comment thread backend/services/image_service.py Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 AidpSearchTool in 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.

Comment thread test/sdk/core/tools/test_aidp_search_tool.py
Comment thread test/sdk/core/tools/test_aidp_search_tool.py
Comment thread test/sdk/core/tools/test_aidp_search_tool.py Outdated
Comment thread test/sdk/core/tools/test_aidp_search_tool.py
Comment thread test/sdk/core/tools/test_aidp_search_tool.py
Comment thread frontend/app/[locale]/chat/components/chatRightPanel.tsx
Comment thread frontend/app/[locale]/chat/components/chatRightPanel.tsx
Comment thread frontend/components/tool-config/AidpKnowledgeSelectorModal.tsx Outdated
Comment thread frontend/components/tool-config/AidpKnowledgeSelectorModal.tsx
Comment thread backend/services/image_service.py Outdated
…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 WMC001 merged commit 6765940 into develop Jun 18, 2026
14 of 15 checks passed
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