🐛 Bugfix: Fixed the issue of conversation history not being saved correctly.#2928
Merged
Conversation
…rectly. [Specification Detail] 1. For Pydantic data types, directly use item.role to retrieve them.
…rectly. [Specification Detail] 1. Fix test cases.
Dallas98
approved these changes
May 6, 2026
JasonW404
reviewed
Jun 24, 2026
| def save_conversation_user(request: AgentRequest, user_id: str, tenant_id: str): | ||
| user_role_count = sum(1 for item in getattr( | ||
| request, "history", []) if item.get("role") == MESSAGE_ROLE["USER"]) | ||
| request, "history", []) if item.role == MESSAGE_ROLE["USER"]) |
Member
There was a problem hiding this comment.
item.role 替代了 item.get("role"),假设 history 中的元素现在是 Pydantic HistoryItem 对象而非 dict。但如果任何调用方仍然传递 dict 格式的 history(如旧版 API 客户端或测试),会抛出 AttributeError。建议添加类型检查或使用 getattr(item, "role", item.get("role") if isinstance(item, dict) else None) 兼容两种格式。
WMC001
added a commit
that referenced
this pull request
Jun 25, 2026
* Update CODEOWNERS
* 🔧 Bump APP_VERSION to v2.0.2
* ✨ Feat: Personal file uploads support permission isolation. #2836 (#2837)
[Specification Detail]
1. Login authentication verification has been added to all file retrieval-related interfaces.
2. Personally uploaded files are stored in a dedicated directory within minio, and permission checks are performed on each access.
* ✨ Feat: Add presigned URL support for external MCP tool file access and improve agent execution flow (#2839)
* 修复调用多模态工具导致502Bad Gateway问题
* Bugfix: Add tooltip to tab labels in ToolManagement and SkillManagement
Made-with: Cursor
* Feat: Add presigned URL support for external MCP tool file access and improve agent execution flow
* 使用已有的types,而非重复定义
* 针对用户上传的文件进行去重处理,限制文件最大个数
* Update frontend/types/chat.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update frontend/types/chat.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 新增测试用例
* 修复单元测试
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Refactor OAuth implementation and enhance account linking features
* openspec初始化
* oauth spec开发结果
* oauth 单元测试
* oauth 重定向修复
* oauth 重定向修复
* oauth 重定向修复
* oauth 抽象实现
* gde provider
* gde provider
* enhance unlink_account logic to check for password authentication before unlinking
* refactor OAuthAccountsSection to load enabled providers and improve account unlinking logic
* add OAuth linking functionality with state management and error handling
* refactor OAuth account deletion logic to use direct deletion and update related tests
* update GDE OAuth configuration to use environment variables for URLs and client IDs
* add SSL verification configuration for OAuth requests and update context handling
* remove hardcoded OAuth credentials from const.py and update .env.example
* remove avatar_url references from user info handling and update email fallback logic
* refactor user identity handling in OAuth account unlinking logic
* update OAuthAccountsSection to simplify display logic for linked accounts
* refactor OAuth user binding logic to check for existing accounts before creating new users
* 删除冗余文件
* 删除冗余文件
* add user OAuth account table and update trigger for third-party logins
* 修复单元测试
* 删除冗余代码
* k8s同步oauth配置
* 软删除时需添加delete_flag="Y"的筛选条件
* 用户删除的时候将oauth表中delete_flag设置为Y
* 优化import
* 移除无用的rebind_oauth_account函数调用,并在用户已绑定其他账户时抛出OAuthLinkError
* clean code
* 补充ut
* 补充单元测试
* ♻️ File preview: Change the preview style of txt and merge the preview of unsuploaded files (#2840)
* Implementing virtual scrolling with react-virtuoso and support automatic line wrapping
* merge unuploaded file preview logic
* bug fix
* 🐛 Bugfix: fix excessive execution time of test_a2a_client_servic (#2851)
* 修复调用多模态工具导致502Bad Gateway问题
* Bugfix: Add tooltip to tab labels in ToolManagement and SkillManagement
Made-with: Cursor
* Bugfix: fix excessive execution time of test_a2a_client_servic
* Bugfix: agent to save agent before publishing (#2862)
* ✨ Refactor: Improve title generation logic in chat interface and streaming handler (#2842)
- Introduced a local variable to manage title generation state, preventing duplicate calls during new conversations.
- Updated the title generation process to use a captured user message directly, enhancing reliability and performance.
* 🐛 Bugfix: Add display name to index name mapping for KnowledgeBaseSearchTool (#2781)
* ✨ Add display name to index name mapping for KnowledgeBaseSearchTool
- Introduced `get_knowledge_name_map_by_index_names` function to retrieve a mapping of index names to their corresponding display names.
- Updated `create_agent_config` and `create_tool_config_list` to utilize the new mapping for generating user-friendly summaries.
- Enhanced `KnowledgeBaseSearchTool` to support conversion from display names to index names during queries.
- Added tests to verify the functionality of the new mapping and its integration within the tool configuration process.
* ✨ Add display name to index name mapping for KnowledgeBaseSearchTool
* Bugfix: Support viewing whether the agent version has been published as an A2A agent (#2863)
(cherry picked from commit aa13c655876707cab9272654e676c5c8668f104e)
* 🐛 Bugfix: Multi-turn dialogues and file uploads are not working properly. (#2865)
* 🐛 Bugfix: Multi-turn dialogues and file uploads are not working properly. #2864
* 🐛 Bugfix: Multi-turn dialogues and file uploads are not working properly. #2864
[Specification Details]
1. Add test cases.
* 🐛 Bugfix: Implement max steps reached handling in chat system (#2860)
* ✨ Feat: Implement max steps reached handling in chat system
- Added support for processing and displaying max steps reached events in the chat stream.
- Introduced new message type `MAX_STEPS_REACHED` in chatConfig.
- Enhanced chatStreamHandler and taskWindow to manage max steps notifications and content.
- Updated localization files for English and Chinese to include relevant messages.
- Modified chat message extraction logic to handle historical max steps data.
* ✨ Feat: Implement max steps reached handling in chat system
- Added support for processing and displaying max steps reached events in the chat stream.
- Introduced new message type `MAX_STEPS_REACHED` in chatConfig.
- Enhanced chatStreamHandler and taskWindow to manage max steps notifications and content.
- Updated localization files for English and Chinese to include relevant messages.
- Modified chat message extraction logic to handle historical max steps data.
* 🐛 Bugfix: Implement max steps reached handling in chat system
* 🐛 Bugfix: Implement max steps reached handling in chat system
* 🐛 Bugfix: Implement max steps reached handling in chat system
* ✨feat:add model-monitoring (#2841)
* feat:add model-monitoring
* fix: mask base_url in connectivity logs to resolve CodeQL clear-text secret alert
* fix: resolve CI test failures, remove dead code, and fix permission case mismatch
- Remove _filter_by_rbac function and unused imports from monitoring_app
- Fix OpenAIModel.__call__ to accept injected _token_tracker
- Fix LLMTokenTracker to no-op when monitoring is disabled
- Fix OpenAIModel.__init__ to handle missing model_id attribute
- Fix monitor_llm_call decorator IndexError on bare functions
- Fix permission case mismatch (MODEL:CREATE -> model:create)
- Mask base_url in model health connectivity logs (CodeQL)
- Update test assertions for display_name parameter
- Merge SQL migrations into single file
- Add time range selector (24h/7d/30d) to monitoring UI
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* fix: resolve SonarCloud quality gate failures and CI test errors
- Add missing record_model_call import in embedding_model.py (NameError fix)
- Update test assertions to include display_name parameter
- Use Annotated type hints for FastAPI DI, replace unused variables
- Remove unused error variable in _MonitoredClient.create
- Extract renderTextModelMetric helper in ModelList.tsx to eliminate
negated conditions and nested ternaries
- Replace unused loop index and empty pass blocks in tests
* fix: remove explicit return False in __exit__ to resolve SonarCloud R635
* fix: use relative import for record_model_call to fix CI ModuleNotFoundError
* fix: use absolute import in embedding_model and fix test import method
- Revert embedding_model.py to absolute import (compatible with installed package)
- Replace importlib.util direct file loading in test with normal package import
* fix: use absolute import for record_model_call in embedding_model.py
* fix: update test patch targets from embedding_model_under_test to nexent.core.models.embedding_model
* fix: use relative import for record_model_call (consistent with openai_llm.py)
* test: add monitoring integration tests to improve Codecov diff coverage
Covers _MonitoredClient wrapping, display_name context var, token tracker,
set_monitoring_context/operation calls, copy_context propagation, and
monitoring_app error handling paths.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* test: add monitoring integration tests for embedding, agent, conversation and tool services
Add 8 tests covering record_model_call and set_monitoring_context/operation
instrumentation in 4 production files to meet Codecov diff coverage target.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* fix: replace deprecated codecov Python uploader with official GitHub Action
The old pip install codecov CLI is deprecated and silently fails on ARM
runners. Replace the architecture-conditional dual-uploader approach with a
single codecov/codecov-action@v4 step that works on all platforms.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
---------
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* 🐛 Bugfix: Enhance prompt generation with knowledge base display names part2 (#2813)
* ✨ Add display name to index name mapping for KnowledgeBaseSearchTool
- Introduced `get_knowledge_name_map_by_index_names` function to retrieve a mapping of index names to their corresponding display names.
- Updated `create_agent_config` and `create_tool_config_list` to utilize the new mapping for generating user-friendly summaries.
- Enhanced `KnowledgeBaseSearchTool` to support conversion from display names to index names during queries.
- Added tests to verify the functionality of the new mapping and its integration within the tool configuration process.
* ✨ Enhance prompt generation with knowledge base display names
- Added `knowledge_base_display_names` to the `GeneratePromptRequest` model to allow frontend-configured names for knowledge bases.
- Updated backend functions to utilize these display names, improving few-shot example generation without requiring database lookups.
- Modified frontend components to capture and pass knowledge base display names during prompt generation.
- Enhanced tests to cover the new functionality and ensure proper integration of knowledge base display names in the prompt generation process.
* ✨ Enhance prompt generation with knowledge base display names part2
* ✨ Add display name to index name mapping for KnowledgeBaseSearchTool
* 🐛 Bugfix: Enhance prompt generation with knowledge base display names part2
* Enhance ToolTestPanel to support dynamic KB selection based on tool type (#2868)
* Introduced kbSelectionConfig to manage knowledge base selection parameters.
* Updated logic to determine parameter names for different tool types.
* Merged KB selection configuration into final tool parameters to streamline processing.
* 修改oauth登录跳转页 (#2876)
* ✨ Support multi-turn and more complicated NL2Skill (#2871)
* 🐛 Bugfix: skill deletion failed occasionally
* ♻️ Simplify how run_skill_script() receives additional parameters
* 🧪 Add test files
* 🧪 Fix test files
* ♻️ Update system prompt to better support models with lower parameters
* ♻️ Update system prompt to better support models with lower parameters
* ♻️ Remove unnecessary rely on re to reduce the risk of DoS
* ♻️ Remove unnecessary rely on re to reduce the risk of DoS
* ✨ Support multi-turn NL2Skill
* ✨ Support complicated skill generation
* ✨ Support complicated skill generation
* ✨ Support official skills pre-installation
* ✨ Support official skills pre-installation
* 🧪 Add test files
* 🧪 Add test files
* ♻️ Refactor skill_app, skillService and content_classifier_utils according to sonar
* feature: Enhance agent context management with compression and metrics logging (#2875)
* docs: Add design spec for doc-qa-agent MVP
Defines architecture, data flow, file layout, and acceptance criteria
for a standalone document Q&A agent built on the Nexent SDK.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* agent context
* context management for agent
* agent context
* Added get_or_create_context_manager, clear_conversation_context_manager, reference counting in register_agent_run/unregister_agent_run
* Modified prepare_agent_run to mount CM, and stop_agent_tasks analysis (though we didn't modify it, we analyzed it)
* Added cleanup in delete_conversation_service
* Added context_manager field to AgentRunInfo
* Modified agent_run_thread to reuse CM
* add compress_if_needed and quantitative collection
* reuse context_manager; extract and log token usage per step
* add TokenUsage for message to facilitate displaying token usage
* main code for context compression
* add test multi run to understand previous run and current run
* token usage metrics log
* using sdk to conduct end-to-end test for anget_context.py
* reusable functions for testing agent_context
* fix bug: reuse cache and calc effective tokens
* from utils.token_estimation import msg_token_count
* estimate token
* Add test_agent_context unit tests
* update agent_context
* ♻️ Refactor agent_context module for code quality compliance
- Split agent_context.py into smaller modules: summary_cache.py, summary_config.py
- Convert all Chinese comments/docstrings to English (per .cursor/rules/english_comments.mdc)
- Add module-level docstrings for public API documentation
- Update __init__.py exports to include new module classes
- Convert test files' Chinese comments to English for compliance
- Default summary prompts to English with proper documentation
* 🔄 Merge feature/agent_context improvements into refactored codebase
- Add context_manager_config field to AgentConfig
- Create ContextManagerConfig in create_agent_info
- Enhanced step metrics with compression ratio and cache hit tracking
- Add _render_steps_with_truncation for fallback truncation
- Add cache hit logging (previous_cache_hit, current_cache_hit, stable_bypass)
- Add cache_types to compression stats output
- Simplify estimate_tokens to flat message list approach
- Remove auto-clear ContextManager logic (keeps cache valid)
- Stop tracking test scripts (keep locally)
* 🧪 Fix test assertions to align with feature branch standards
- Fix TestM13StepLocalLogCleared: cache hit is recorded in _step_local_log
(count_after_second should be 1, not 0)
- Update summary_json_schema: chars -> words for clearer units
* 🔄 Merge feature/token_indicator: Add token usage indicator with real-time context metrics
- Add TokenUsageIndicator component with circular progress visualization
- Emit TOKEN_COUNT messages via observer for real-time frontend updates
- Include step_number, input/output tokens, estimated context, and threshold
- Preserve context manager and metrics logging from refactor/agent_context
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* Enhance agent context management with token compression logging and dynamic token threshold
* fix: improve token usage tracking with stream_options and fallback estimation
- Add stream_options to request usage info from streaming API
- Handle empty choices in streaming chunks (usage-only chunks)
- Add fallback token estimation when API doesn't return usage
- Add None handling in msg_token_count and _extract_text_from_chat_message
* chore: add *.log to gitignore to exclude runtime log files
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* feat: make ContextManagerConfig.enabled configurable per agent and refactor for cognitive complexity
- Add enable_context_manager field to AgentInfo database model (default False)
- Update create_agent_config to read setting from agent_info instead of hardcoded True
- Add field to API request models (backend and frontend)
- Add database migration for new column
- Refactor _trim_actions_to_budget to reduce cognitive complexity (19 -> 15)
- Refactor _render_steps_with_truncation to reduce cognitive complexity (23 -> 15)
* fix: pin greenlet<3.5.0 for aarch64 Linux compatibility
greenlet 3.5.0 lacks wheels for ARM64 Linux (aarch64), causing CI failures.
Pin to <3.5.0 to ensure compatible version (3.4.0) is resolved.
* fix: update test mocks to support agent_context refactor
- Add enable_context_manager attribute to MockAgent in test_agent_db.py
- Add AgentRunInfo, agent_context, and agent_run_manager stubs in test_conversation_management_service.py
- Add nexent.core.agents.agent_context stub in test_create_agent_info.py
- Add smolagents.memory stub with AgentMemory/MemoryStep in SDK model tests
- Update TokenCountTransformer tests to match new passthrough behavior
- Update test_create_agent_config assertions to include context_manager_config parameter
- Fix TaskStep/ActionStep mocks to use real classes for dataclass inheritance
- Add proper package stubs for sdk.nexent.core.agents and utils modules
* fix: update test_nexent_agent mocks for agent_run_with_observer
- Add timing.duration attribute to mock action steps (implementation expects step_log.timing.duration)
- Add step_number attribute to mock action steps
- Import ANY from unittest.mock for flexible assertions
- Update TOKEN_COUNT assertions to use ANY (implementation now sends JSON token data)
- Fix test_agent_run_with_observer_with_none_duration: implementation now handles None gracefully (0.0)
* fix: add context_manager and step_metrics to CoreAgent test mocks
Implementation now accesses context_manager and step_metrics in _collect_step_metrics method.
Tests need these attributes initialized to avoid AttributeError.
---------
Co-authored-by: liudongfei <744532452@qq.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Jinglong Wang <wangjinglong8@huawei.com>
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 🐛 Bugfix: Multi-turn dialogues and file uploads are not working properly. #2864 (#2866)
[Specification Details]
1. bugfix.
* ✨feat:add haotian knowledge base search tool (#2878)
* ✨ Feat: Enhance final answer generation with streaming support (#2873)
* ✨ Feat: Enhance final answer generation with streaming support
- Introduced a new method to build messages for final answer generation, incorporating task prompts and memory messages.
- Updated the max steps handling to utilize streaming for real-time answer generation, improving user experience.
- Enhanced error handling during final answer generation to provide fallback messages in case of failures.
* 🔧 Update max steps warning logic in chat stream final message component
- Modified the condition for displaying the max steps warning to trigger when the message is complete and contains maxStepsInfo.
- Improved clarity in the code comments to better reflect the updated logic.
* ✨ Add unit tests for _build_final_answer_messages function
- Introduced a new test suite for the _build_final_answer_messages function, covering various scenarios including basic message structure, skipping the first memory message, handling empty memory, and template rendering with task variables.
- Enhanced the test setup by mocking necessary modules to ensure isolated testing of the function's behavior.
* 🔧 Fix: Ensure knowledge_base_names is always included in template context (#2880)
- Updated prompt generation logic to always include knowledge_base_names in the template context, defaulting to an empty string when not available. This change prevents errors related to undefined variables in Jinja2 templates.
- Modified YAML files for English and Chinese prompts to reflect the updated syntax for knowledge_base_names, ensuring consistency in few-shot example generation.
* fix: add enable_context_manager column to init.sql files (#2883)
- Add enable_context_manager BOOLEAN column to ag_tenant_agent_t table
- Add column comment for enable_context_manager
- Sync docker/init.sql and k8s init.sql with migration v2.0.4_0427
Co-authored-by: Jinglong Wang <wangjinglong8@huawei.com>
* ✨ Enhance OpenAIModel error handling and chunk processing (#2886)
- Added validation for API response types to raise ValueError for unexpected string or dictionary responses.
- Implemented safety checks to skip non-standard chunks that lack expected attributes, logging warnings for such cases.
- Introduced unit tests to cover new error handling scenarios and ensure robust processing of API responses.
* 🐛 Bugfix: expose URL via the northbound api to allow third-party MCP tools to access MinIO files (#2885)
* feat: Expose URL via the northbound api to allow third-party MCP tools to access MinIO files
* Add relevant configuration instructions
* Update backend/prompts/managed_system_prompt_template_zh.yaml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update backend/consts/const.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update backend/prompts/managed_system_prompt_template_en.yaml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update backend/database/attachment_db.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 新增测试用例,修改测试用例
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 🐛 Bugfix: Fixes the issue where external APIs cannot be converted to MCP services under Kubernetes deployment. (#2890)
* 🐛 Bugfix: Fixed the issue of the session deletion interface reporting an error. (#2894)
* Bugfix: Overwrite agent draft info when rolling back version (#2893)
* 🐛 Bugfix: always include knowledge_base_names in prompt template context (#2899)
* Bugfix: Overwrite agent draft info when rolling back version
* Bugfix: always include knowledge_base_names in prompt template context
Made-with: Cursor
* Bugfix: force refresh agent info when needed (#2901)
* 🐛 Bugfix: Modify callbackBaseUrl in the Kubernetes deployment environment and modify the mem0ai version. (#2902)
* hide model api key for security (#2900)
* Update overview docs to fit version 2.1.0 (#2906)
* Update App Version
* 🐛 Bugfix: Files in knowledge base creation cannot be previewed and file_size=0 (#2907)
* 🐛 Bugfix: Resolve rotation reverse issue and replace scrollbar with drag interaction for image preview (#2898)
* resolve rotation reverse issue and replace scrollbar with drag interaction for image preview
Co-authored-by: Copilot <copilot@github.com>
* bug fix
* Migration tool function
---------
Co-authored-by: Copilot <copilot@github.com>
* 🐛 Bugfix: Fixed the issue of conversation history not being saved correctly. (#2927)
* 🐛 Bugfix: Fixed the issue of conversation history not being saved correctly.
[Specification Detail]
1. For Pydantic data types, directly use item.role to retrieve them.
* 🐛 Bugfix: Fixed the issue of conversation history not being saved correctly.
[Specification Detail]
1. Fix test cases.
---------
Co-authored-by: Dallas98 <40557804+Dallas98@users.noreply.github.com>
* 🐛 Bugfix: Fixed the issue of conversation history not being saved correctly. (#2928)
* 🐛 Bugfix: Fixed the issue of conversation history not being saved correctly.
[Specification Detail]
1. For Pydantic data types, directly use item.role to retrieve them.
* 🐛 Bugfix: Fixed the issue of conversation history not being saved correctly.
[Specification Detail]
1. Fix test cases.
* ✨ Feat: Enhance final answer prompts for maximum step limit (#2930)
- Updated English and Chinese final answer templates to include comprehensive summary requests when the maximum step limit is reached.
- Added structured prompts for users to summarize accomplishments, key findings, and incomplete tasks.
- Improved clarity in post-message instructions to ensure concise summaries are provided.
* import ali and volc stt model (#2934)
* improve codecov
* implement asr
* import ali qwen realtime tts model
* import volc realtime tts model
* improve code readability
* improve code readability
* add test files
* improve code readability and maintainability by adding comments and improving variable names.
* improve test files
* improve test files
* improve test files
* add test code for ali voice model to improve coverage
* add test code for ali voice model to improve coverage
* add test code for voice model to improve coverage
* add test code for voice model to improve coverage
* add test code for voice model to improve coverage
* add test code for voice model to improve coverage
* add test code for voice model to improve coverage
* add test code for voice model to improve coverage
* add test code for voice model to improve coverage
* add test code for voice model to improve coverage
* add test code for voice model to improve coverage
* save stt only
* add test files
* add user guide for voice model and Modify the prompt in the base_utl input box of the voice model
* 🐛 Bugfix: Fixed the issue where VLM could not be added properly without internet access. (#2947)
[Specification Detail]
1.Include images in the SDK package.
* 📝 Doc: Add API to MCP service documentation (#2905)
* 📝 Doc: Add API to MCP service documentation (#2960)
[Specification Detail]
1. Add the required images to the document
* 📝 Docs: Revise docs and register hint to guide user star our repo (#2937)
* 🐛 Bugfix: modify sql name (#2949)
* 🔧 Chore: Extend pipeline trigger scope and implement automatic image push (#2958)
* 🔧 Chore: Update pipeline configurations to include release and hotfix branches
* 🔧 Chore: Update Docker pipeline configurations to use dynamic versioning and improve runner label handling
* 🔧 Chore: Update Docker pipeline configurations to support dynamic versioning and latest tagging for main branch
* 🔧 Chore: Update Docker pipeline configurations to tag and push latest images for main branch on push events
* :sparkles: Feat: Auto generate summery for vector database (#2877)
* :sparkles: Feat: Auth generate summery for vector database
* :bug: Fix generating summery error
* :bug: Fix SonarQube issues
* :bug: Fix SonarQube issues
* :bug: Fix SonarQube issues
* :bug: Fix SonarQube issues
* :test: Add unit test
* :sparkle: Move frequency selector to summary page
* :sparkle: Update frequency
* :sparkle: Fix web type check
* :sparkle: Fix ut
* :sparkle: Reduce unnecessary performance depletion
* Fix test failures from auto-summary optimization
- Add update_last_summary_time to top-level imports in vectordatabase_service.py
- Mock update_last_doc_update_time in all tests that call index_documents or delete_documents
- Mock update_last_summary_time in test_change_summary
These database calls were added as part of auto-summary optimization to track document changes,
but tests were missing mocks, causing PostgreSQL connection errors.
Fixes: 10 failing tests in test_vectordatabase_service.py
* :sparkle: Reduce unnecessary performance depletion
* Feat: Improve processing speed (#2832)
* only_get_file_size()_jumps_out_of_loop
* improve processing speed
* improve processing speed
* improve processing speed
* modify unit test file
* add dependencies
* modify unit test files to improve coverage
* ✨ Feat:Add support for new filetypes (#2429)
* ✨ add support for new filetypes
* merge develop and modify unit test files
* 🐛 Bugfix: add embedding_model_id to knowledge base records (#2938)
* ✨ Feat: Update embedding model handling and knowledge base integration
- Refactored embedding model retrieval to use model IDs instead of names, enhancing accuracy and flexibility.
- Introduced validation checks for embedding models in knowledge base searches, ensuring necessary configurations are in place.
- Updated database models to include embedding model IDs for better tracking and management.
- Enhanced logging and error handling for embedding model retrieval processes, improving overall robustness.
- Added new functions to streamline embedding model lookups by index names and IDs.
* fix kb select embedding model
* Updated tests to mock new embedding model retrieval and adjusted related assertions for consistency.
* fix kb select embedding model
* Updated tests to mock new embedding model retrieval and adjusted related assertions for consistency.
* ✨Feat: support Nacos A2A Client (#2935)
* feat: support Nacos A2A Client
* Bugfix: Fix the issues raised in the code review
* 修复UT
* Bugfix: a2a agent must need message_id header
* Update A2A Agent instruction docs
* 修改图片路径
* 📃 Docs:Update skill documents (#2971)
* 📃 Update skill documents
* 📃 Update skill documents
* 📃 Update skill documents
* Chore: add three components to the sdk layer dependency (#2972)
* add three components to the sdk layer dependency
* modify dependency location
* 🐛 Fixed an issue where tool calls were not processed correctly when invoking the ME model. (#2974)
[Specification Detail]
1. Removed our custom ME model input processing logic and replaced it with the one provided by smolagents (implemented via parameter passing).
2. Add test cases.
* 🐛 Fixed an issue where the model output history was not included during agent debugging. (#2980)
[Specification Detail]
1. Modify the front-end logic to retrieve the final_answer and store it in the request structure.
2. Delete redundant log records.
* 🐛 Bugfix: change to lazy import to decouple data-process and config (#2982)
* 🐛 Bugfix: change to lazy import to decouple data-process and config
* 🧪 Unittest fix
* Bump APP_VERSION to v2.1.1
* 🐛 Bugfix: Resolve issue where saving external collaboration agent fails in create mode (#2983)
* Bugfix: the creator cannot set its own agent version
* Bugfix: Resolve issue of missing fields when generating agent information
* Bugfix: Resolve issue where saving external collaboration agent fails in create mode
* 修复单元测试
* Bugfix: Add external northbound a2a url in k8s (#2985)
* 🐛 Bugfix: Fix file forward failed and missing ijson (#2987)
* fix:init model_appid sql (#2989)
* fix dashscope add model failed (#2990)
* Optimize prompt (#2924)
* feat: add section-level prompt optimization for generated agent details
* feat: add section-level prompt optimization for generated agent details
* feat: add section-level prompt optimization for generated agent details
* feat: add section-level prompt optimization for generated agent details
* 📃 Add sql tools document (#3005)
* 🐛 Bugfix: Avoid directly modifying files in the runtime environment using code. #3006 (#3007)
* 🐛 Bugfix: Auto-clean account when exists in Supabase but not in postgresql (#3002)
* Bugfix: Auto-clean account when exists in Supabase but not in postgresql database
* Bugfix: Remove type field from A2A v1.0 as it should not exist
* 修复文档图片大小
* Bugfix: Prevent session expiration while user is active
* 修改测试用例
* 修改测试用例
* Bugfix: Immediately show login page on 401 response
* Chore: Add workflow and script for offline deployment package build (#3010)
* ✨ Add workflow and script for building offline deployment package
* Chore: Add workflow and script for offline deployment package build (#3011)
* ✨ Add workflow and script for building offline deployment package
* feat: add prompt template management for agent generation (#2925)
* feat: add prompt template management for agent generation
* feat: add prompt template management for agent generation
* feat: add prompt template management for agent generation
* feat: add prompt template management for agent generation
* feat: add prompt template management for agent generation
* feat: add prompt template management for agent generation
* feat: add prompt template management for agent generation
* feat: add prompt template management for agent generation
* feat: add prompt template management for agent generation
* feat: add prompt template management for agent generation
* feat: add prompt template management for agent generation
* Feature:Refine and internationalize OAuth account completion flow (#2984)
* Refine OAuth account completion flow
* Simplify OAuth complete modal flow
* Internationalize OAuth login error handling
* Update agent instructions for prompt skill workflow
* clean code
* clean code
* Remove user persistence from OAuth completion
---------
Co-authored-by: hhhhsc <name>
* Feat: Enhance monitoring with OpenTelemetry, Grafana, and new providers (#2969)
* ✨ Feat: Update monitoring configuration to use OpenTelemetry OTLP protocol and enhance observability features
* Refine OpenTelemetry monitoring and multi-platform config
* Add local Phoenix and Langfuse monitoring deployment support
* ✨ Feat: Enhance monitoring capabilities with FastAPI instrumentation and OpenTelemetry integration
* ✨ Feat: Add Grafana and Tempo support for enhanced monitoring capabilities
* ✨ Feat: Update monitoring configurations with specific versioning for Grafana, Tempo, Phoenix, Langfuse, and Redis
* ✨ Feat: Refactor monitoring configuration to use environment variables for Grafana, Phoenix, and Langfuse ports; remove deprecated Jaeger support
* ✨ Feat: Expand OpenTelemetry design documentation to include observability principles, usage of OpenTelemetry, and detailed signal definitions
* ✨ Feat: Add support for Apache SkyWalking as a monitoring provider, including configuration and documentation updates
* 支持zipkin查看
* ✨ Feat: Add support for LangSmith as a monitoring provider, including configuration updates and documentation enhancements
* clean code
* clean code
* ✨ Feat: Add OpenTelemetry monitoring stack with configurable providers and settings
* Normalize monitoring env variables
* ✨ Feat: Add OpenTelemetry monitoring stack with configurable providers and settings
* 支持白名单黑名单配置
* 补充
* 优化代码实现
* 优化代码实现
* Enhance monitoring trace payload summaries
* fix test
* clean code
* Enhance monitoring configuration by adding LangSmith API key, project, and OTLP traces endpoint
* Add monitoring configuration options for trace content and limits
* Remove deprecated fastapi flag and normalize trace payloads
* 清楚langfuse适配字段
* Update service configurations to support NodePort for Grafana, Langfuse, Phoenix, and Zipkin
* 网络配置优化
---------
Co-authored-by: hhhhsc <name>
* ✨ Feat: support user to configurate model concurrency limit and timeout seconds (#2943)
* 解决冲突
* 修改sql脚本名称
* Bugfix: ssl_verify causing different result in check embedding model connection
* Feat: support user to configurate model concurrency limit
* 修改sql脚本名称
* 优化名称/变量名称重复提示
* Bugfix: when creating an embedding modal, embedding_dimension_check lack fallback casuing dimension=0
* Bugfix: fix the published agent version need at least one tool
* Bugfix: unify agent unavaliable reason
* Bugfix: use STARTTLS (TLS upgrade) when using port 587 to send email
* 新增haotian知识库路由
* 修复前端
* 为nexent-config挂载证书,令容器内的 Python 应用使用宿主机的 CA 证书来验证外部 SMTP 服务器的 SSL 证书
* 修复模型健康检查报错
* 区分send email针对是否跳过证书校验的逻辑
* 区分sender_email和和sender_name
* 修复无法获取昊天知识库列表的问题
* Create a session with trust_env=False to ignore proxy environment variables
* 设置generate_title为非流式接口
* Revert "设置generate_title为非流式接口"
This reverts commit d1cffeb589b3ea2cb735d42d4d1ab7f61e125b39.
* "设置generate_title为非流式接口"
* 设置authorization字段也为密码展示
* 如果是公共知识库,设置默认id
* 新增并发数量的限制
* Bugfix: Resolve frontend cache issue when only one model is available
* 修复循环依赖的问题
* Bugfix: Prevent overwriting of agent name and variable name when generating agent info
* Bugfix: Immediately show login page on 401 response
* Revert "Bugfix: Immediately show login page on 401 response"
This reverts commit 9b59e72125d564a020dabf9c3dc37e166557046a.
* Bugfix: Remove invalid concurrency_limit related code from OpenAIModel
* 优化代码,修复单元测试
* 修改单元测试
* 修改单元测试
* 修改单元测试
* 修改单元测试
* 修改单元测试
* 修改单元测试
* 修改单元测试
* 删除使用宿主机的证书
* 修改sql
* 修改UT
* 修改默认昊天公共知识库Id
* 修改单元测试
* 删除单元测试
* 使用DefaultHttpxClient而非httpx.client
* 删除不存在的函数
* 修改单元测试
* 修改单元测试
* ✨ Support modifying passward #2809 (#3016)
* ♻️ Mcp Tools Management Page Development (#2771)
* 添加MCP管理界面,支持添加、删除、修改、启用、停止、查看MCP服务,支持用户自行添加和公共市场快速添加,目前公共市场快速添加只支持链接形式的MCP服务;
添加公共市场的浏览和搜索。
* 重构代码以符合项目规范,前端样式修改
* feat: Enhance MCP Tools functionality and UI
- Added new service enabling and disabling messages in English and Chinese localization files.
- Updated API endpoints for enabling and disabling MCP tools.
- Introduced new container service addition functionality in the MCP tools service.
- Refactored mcpToolsService to handle container services and improve error handling.
- Updated types for MCP tools to reflect new transport types and service details.
- Created a new SQL migration script to extend the mcp_record_t table for additional MCP tool attributes.
- Implemented a custom hook for managing MCP tools page state and interactions.
功能亮点:增强 MCP 工具的功能与用户界面
- 在英文和中文本地化文件中添加了启用和禁用服务的提示信息。
- 更新了用于启用和禁用 MCP 工具的 API 接口。
- 在 MCP 工具服务中引入了新增容器服务的功能。
- 重构了 mcpToolsService 以处理容器服务并改进错误处理机制。
- 更新了 MCP 工具的类型,以反映新的传输类型和服务详情。
- 创建了新的 SQL 迁移脚本,用于扩展 mcp_record_t 表以支持 MCP 工具的额外属性。
- 实现了自定义钩子,用于管理 MCP 工具页面的状态和交互。
* Rewrite the code to rename “market” to ‘registry’
Remove the “market_name” field from the mcp_record_t SQL extension and correct the spelling error in the source code
重构代码,将market命名转为registry
移除mcp_record_t扩展sql的market_name,修正拼写错误souce
* Add a community marketplace feature where users can upload their own MCPs to the community marketplace for other users to browse and discover.
添加社区市场功能,用户可以上传自己的MCP到社区市场供其它用户浏览发现。
* Support for displaying and filling in variables and request headers during quick addition in MCP Registry;
Removal of the old MCP Tools interface and uniform migration to the new interface;
Caching of the search bar in external marketplaces;
Update to the logic of the tool list on the Agent page, synchronized with the MCP Tools page
外部市场支持快速添加时的变量和请求头显示和填写;
去除mcp tools的旧接口,统一改为新接口;
外部市场搜索栏缓冲;
智能体页面工具列表逻辑更新,和mcp tools页面同步更新
* Add source and transport type method filters
增加来源和传输方式筛选
* /container/add: The App layer has been changed from “handling business logic” to “only making calls and mapping exceptions.”
Aggregation of props for frontend detail pop-ups.
New MCP domain exceptions have been added; the service layer throws MCP exceptions, and the App layer uniformly maps them to HTTP status codes.
/container/add 由 App 层“做业务”改为“只做调用+异常映射”。
前端详情弹窗 props 聚合。
新增 MCP 领域异常,service 层抛出MCP异常,app 层统一映射 HTTP 状态。
* Store tags as an array and add the ability to filter MCPs by tag.
将tags改为数组形式存储,新增用tag筛选mcp。
* Add restrictions on request headers; only Bearer tokens in the Authorization header are allowed.增加请求头填写限制,只允许Authorization的Bearer Token填写
* Supports displaying descriptions in Markdown format, supports expanding and collapsing descriptions, and supports descriptions of unlimited length.
支持描述markdown形式展示,支持描述展开和收起,支持无限长的描述。
* Add pagination to the community marketplace; add display of shipping methods and tags; add filtering by shipping methods and tags.
社区市场添加分页,添加传输方式和tag显示,添加传输方式和tag筛选.
* Optimized the display of installation package variables on the remote market details page;
Added a hyperlink entry point to the Modelscope MCP Plaza.
优化外部市场详情界面安装包变量显示;
新增魔搭mcp广场超链接入口。
* Fine-tune description style
微调描述样式
* Added container service port conflict verification and recommended port features;
When quickly adding a container from the external market, a port needs to be filled in;
Refactored the code of mcp_management_app and service, moving a large amount of data validation handling to the app, using Pydantic for validation, simplifying the code.
添加了容器服务端口冲突校验和推荐端口功能;
外部市场快速添加容器需要填写端口;
重构了mcp_managemeny_app和service的代码,讲大量数据检验处理移动到app中,利用Pydantic校验,简化代码。
* Data validation for the mcptools frontend form;
Fix the front-end and back-end integration errors of My Posts and Community Market;
Fix the display of description editing in My Posts editing and Community Market.
mcptools前端表单进行数据校验;
修复我的发布和社区市场前后端对接错误;
修复我的发布编辑和社区市场的描述编辑显示。
* 禁止oci形式mcp添加
* Add MCP.so hyperlink
添加MCP.so超链接
* Optimized the frontend's handling of OCI unsupported display.
Slightly optimized the backend code for OCI unsupported cases.
优化前端对oci的不支持显示。
稍微优化了后端对oci不支持的代码。
* Remove duplicate code
去除重复代码
* Optimization
Recommended ports are now random
Fixed container name duplication issue
Abstracted front-end code port handling to reduce duplicate code
Added a prompt for failed addition of services with duplicate names
Loading state between each MCP card is independent and does not interfere
优化
推荐端口现在改为随机
容器重名问题修复
前端代码端口处理问题抽象,减少重复代码
增加对重复命名服务添加失败的提示
每个mcp卡片之间加载状态独立不干扰
* Fixed the issue of accompanying registry_json errors when adding to the community market, and optimized redundant code
修复社区市场添加时附带registry_json错误的问题,并优化冗余代码
* Readjust, change stdio to a container
重新调整,把stdio改成容器
* Mini Fix
小修复
* ♻️ Refactor: Refactor the remote_mcp and mcp_management services, and adapt the Agent development page to the mcp service.
* 尝试优化前端代码架构,进行初步重构,优化了Props传递和hooks设计不合理的一部分问题;
删除mcp描述的markdown展示;
删除不必要的工具列表Model,改用统一Model Component。
* 二次重构,继续优化
* 前端代码样式重构,优化标题样式,去除所有圆角,修改主界面布局,去除我的发布,改为主界面导入的服务和发布的服务切换,优化搜索栏和筛选栏样式,优化卡片列表支持动态布局,优化详情弹窗显示,优化查看server.json和容器配置弹窗样式,修改标签样式,增加发布到社区的确认和修改弹窗,去除连通性校验弹窗,优化添加弹窗显示避免大小抖动,去除common.json中部分过时字段
后端去除last_sync_time字段和少量冗余代码
* 优化状态显示组件,移动端口组件
* 修复端口冲突显示bug
调整部分Types和const的代码写法
* 修改容器配置和server.json弹窗样式
修复小bug
* 修复更新合并带来的部分冲突,如/list和delete
由于接口变化,修改tag筛选为前端筛选
* ♻️ Refactor: Refactor the remote_mcp and mcp_management services, and adapt the Agent development page to the mcp service.
[Specification Details]
1. Modify healthcheck method.
* 修改部分post接口为get
* 修复输入了authorization_token但是list却不传authorization_token的问题.
修复删除Mcp不删除对应容器的问题
修复前端点击启用关闭不刷新的问题,并添加刷新工具中信息提示。
* 简化部分组件传递信息代码
* 修复我的发布详情界面滚动条问题
* 修复社区市场tag筛选项是按租户显示的问题;
社区市场传输类型筛选改为后端实现;
去除原来的http和sse,统一改为url;
修复部分代码不必要的null和可选性问题;
修复部分翻译键问题;
修复添加容器化服务的部分前端逻辑代码错误。
* 修复社区市场弹窗层级问题
* 修改发布代码逻辑
支持发布时修改config_json和url
删除healthcheck详细显示
* 整体页面色调改为绿色
* 修改主界面切换页签样式
修改主界面布局
* 修改卡片样式设计
* 改进添加和详情弹窗,缩小宽度,添加动态过渡
* 小修复
* 给发布的服务提供筛选栏
tag筛选改为前端筛选,删除相关代码
* 调整容器启用关闭以兼容k8s部署,现在会删除停止的容器,启用时重新拉取
* 修复详情界面切换服务状态信息显示不更新问题
* 修复页签字体不居中,筛选栏字体大小问题
* 前端代码组件分类
* 修复弹窗问题
* 改名
* 修复i18n缺失bug
* 删除部分未使用文本
* 小修复
* 添加测试文件
* 修改sql
* 更新文档
* ♻️ Refactor: Front-end style adjustment.
* ♻️ Refactor: Front-end style adjustment & test cases addition.
* ♻️ Refactor: Front-end style adjustment & test cases addition.
[Specification Details]
Fix frontend build.
* ♻️ Refactor: Revert to the container naming rules for launching containers in Docker and Kubernetes clients.
[Specification Details]
Modify the name of the update SQL statement and synchronize the Kubernetes init.sql file.
* ♻️ Refactor: Revert to the container naming rules for launching containers in Docker and Kubernetes clients.
[Specification Details]
1. Fix test cases.
* ♻️ Refactor: Add UUID when creating the container.
[Specification Details]
1. Fix test cases.
* 修复描述为空导致的搜索栏bug
修复社区市场不必要的来源显示
* 🐛 Bugfix: Fix the issue of missing fields in init.sql.
* 🐛 Bugfix: ModelAddDialog.tsx rollback
---------
Co-authored-by: panyehong <2655992392@qq.com>
Co-authored-by: panyehong <91180085+YehongPan@users.noreply.github.com>
* ♻️ Performance optimization of the knowledge base file list query interface (#3025)
* ♻️ Performance optimization of the knowledge base file list query interface
* ♻️ Performance optimization of the knowledge base file list query interface: ut
* ✨ Skill ability enhancement and bug fix (#3017)
* ✨ Support skill params config
* ✨ Add frontend official skill install wizard, which could be triggered by tenant creation or admin management
♻️ Remove terminal skill installation in deploy.sh
✨ Users can now manage skills in tenant resource page
* ♻️ Remove terminal skill installation in deploy.sh
♻️ Change default skill install directory to $ROOT_DIR/nexent-data
* ✨ Supports tenant-level separation of skills
🐛 Bugfix: code retrieved from knowledge base would falsely be executed
* ♻️ Now constraint and few shot tab would remain empty when generating agent prompt
♻️ Add backend support to skill-tenant management and official skill installation
* ✨ Agent export/import now includes skills
* 🐛 Bugfix: frontend syntax error
* 🐛 Bugfix: frontend syntax error
🧪 Add unit tests
* ♻️ Refactor: remove redundant code
🧪 Add unit tests
* 🐛 Bugfix: frontend syntax error
* 🧪 Fix test files
* 🐛 Bugfix: frontend syntax error
* 🐛 Bugfix: frontend syntax error
* 🧪 Fix test files
* 🐛 Bugfix: SU skill resource management with wrong scope
* 🐛 Bugfix: SU skill resource management with wrong scope
* 🐛 Fixes the model addition issue in ModelEngine. (#3026)
[Specification Detail]
1. Fixed the issue where the model list could not be retrieved when adding models in batches on the ME platform.
2. When adding a single model, check /open/router to modify model_factory.
* Feat: support user to add and use tts model (#2959)
* import tts model
* add test files
* add test files
* add test files
* add test files
* 🔧 Chore: Update Docker pipeline configurations to tag and push latest images for main branch on push events
---------
Co-authored-by: Dallas98 <990259227@qq.com>
* 🐛 Bugfix: Cannot generate agent prompt (#3028)
* 🐛 Bugfix: Cannot generate agent prompt
* ♻️ ag_skill_info_t SQL fixup
* ♻️ Refactor: Optimize agent page layout & refactor agent generate page (#3020)
* 修改单元测试
* Revert "修改单元测试"
This reverts commit d0aad142d4363c2e6656a7c37b7529d9a23f3d84.
* Optimize agent page layout
* Refactor agent generate page
* 对于agent的currentAgentPermission状态进行统一处理,暴露isReadOnly
* 修复智能体生成页面,所有字段既由form item的name控制,又由streamValues控制
* 更新i18n
* 更新单元测试
* 更新api/agent/search_info返回的结果,新增skills,统一tools和skills
* 修复单元测试
* 解决冲突
* 修复web编译失败问题
* 处理在创建模式下智能体生成后无法保存的问题
* 删除注释
* 优化代码
* 修复前端编译失败
* 更新单元测试
* 更新单元测试
* Revert "更新单元测试"
This reverts commit d5b787910532725ddab16943b1c1b72af630404b.
* Reapply "更新单元测试"
This reverts commit 35f0821ebabfe0f751dd7d2caa5a0d555ad7d989.
* Optimize deployment scripts and improve Helm chart instructions (#3029)
* 部署脚本优化
* 部署脚本优化
* 部署脚本优化
* Remove namespace template from Helm common chart
* Update commit message generation instructions
* Refine prompt-writing instructions
* Reuse Supabase secrets and harden suadmin provisioning
* Add back navigation to deployment TUI
* Make K8s local data deletion optional
* Update deployment docs for optional application selection
---------
Co-authored-by: hhhhsc <name>
* ♻️ Add v2.2.0 shell script to update the directory of skills (#3035)
* Feat: Add vision-language model classification and audio understanding tools (#3001)
* 视觉语言模型分类 以及添加音频理解工具
* 补充test测试
* Chore: Update .dockerignore to remove unnecessary backend assets
* Feat: add optional id field to SingleModelConfig interface
---------
Co-authored-by: Dallas98 <990259227@qq.com>
* feat: Support image extraction & retrieval for office/PDF documents (#2720)
* ✨add_image_retrieval
* ✨add_image_retrieval
* ✨add_image_retrieval
* ✨add_image_retrieval
* ✨add_image_retrieval
* ✨add_image_retrieval
* ✨add_image_retrieval
* ✨add_image_retrieval
* ✨add_image_retrieval
* ✨add_image_retrieval
* add_image_retrieval
* add_image_retrieval
* add_image_retrieval
* add_image_retrieval
* add_image_retrieval
* modify unit test file
* modify unit test file
* modify fix the bug
* modify test file
* modify test files
* cancel downloading models and modifying test files
* modify the image configuration file
* resolve conflict
* modify test files
* modify test file
* improve test coverage
* remove unnecessary input parameter
* modify test file
* modify test files
* modify test file
* modify test file
* modify test files
* modify test file
* feat: support multi-turn compare sessions (#3012)
* feat: support multi-turn compare sessions
* feat: support multi-turn compare sessions
* ♻️ Improvement: Supports adding custom headers when adding MCP services. (#3036)
* ♻️ Improvement: Supports adding custom headers when adding MCP services.
[Specification Details]
1. When creating an MCP service, custom headers can be passed in when calling the tool and agent.
2. Add test cases.
* ♻️ Improvement: Supports adding custom headers when adding MCP services.
[Specification Details]
1. Fix the front-end pipeline and test case pipeline
* Fix markdown table code block diaplay eccentrically (#2992)
* :bug: Fix markdown code block display error
* :bug: Fix markdown code block display error
* Support adding models individually and Fix audio tools (#3049)
* 视觉语言模型分类 以及添加音频理解工具
* 补充test测试
* Chore: Update .dockerignore to remove unnecessary backend assets
* Feat: add optional id field to SingleModelConfig interface
* fix_audio_tools,Support adding models individually
* fix test
* fix test 2
---------
Co-authored-by: Dallas98 <990259227@qq.com>
* 🐛 Bugfix: Fix the issue with permission control for released agents. (#3052)
* :bug: Add detail error message in debug mode (#2977)
* :bug: Add detail error message in debug mode
* :bug: Fix test
* 🐛 Bugfix: Fix iData tool call error. (#3054)
* 🐛 Bugfix: Fix iData tool call error.
[Specification Details]
1. Modify the front-end component logic to pass the `dataset_ids` field for idata and haotian knowledge base retrieval.
* 🐛 Bugfix: Fix iData tool call error.
[Specification Details]
1. Submit incremental sql
* ✨ Feat: Context management refactoring. Add benchmark for agent context module. (#3039)
* ♻️ refactor: consolidate context building into ContextManager
Purpose:
Consolidate ALL context building related code into a single ContextManager
class, making it the single source of truth for system prompt assembly,
component injection, memory management, and token-aware compression.
This refactoring introduces a component-based architecture where system
prompt parts (tools, skills, memory, knowledge base, agent definitions)
are assembled from registered ContextComponent instances using pluggable
selection strategies.
Changes Summary:
- Added ContextComponent hierarchy with 7 subclasses
- Added ContextStrategy implementations with 4 algorithms
- Extended ContextManagerConfig with strategy and injection flags
- Added component management methods to ContextManager
- Integrated component registration in NexentAgent
- Modified CoreAgent to use component-based system prompt assembly
- Created backend helper for component building
- Updated tests with comprehensive coverage (260 tests)
File Changes:
sdk/nexent/core/agents/agent_model.py:
- Added ContextComponent abstract base class with to_messages() pattern
- Added 7 component subclasses: SystemPromptComponent, ToolsComponent,
SkillsComponent, MemoryComponent, KnowledgeBaseComponent,
ManagedAgentsComponent, ExternalAgentsComponent
- Added ContextStrategy abstract class with 4 implementations:
FullStrategy, TokenBudgetStrategy, BufferedStrategy, PriorityWeightedStrategy
- Added context_components field to AgentConfig
sdk/nexent/core/agents/summary_config.py:
- Added StrategyType literal for strategy selection
- Extended ContextManagerConfig with strategy field
- Added inject_* flags for each component type (7 flags)
- Added component_budgets dict for per-component token limits
- Added buffer_size_per_component for buffered strategy
sdk/nexent/core/agents/agent_context.py:
- Added _components registry in __init__
- Added register_component() for component accumulation
- Added clear_components() and get_registered_components()
- Added _get_strategy() for strategy selection
- Added build_system_prompt() for component-based assembly
- Added _calculate_component_budget() for budget allocation
- Added _message_already_present() for deduplication
sdk/nexent/core/agents/__init__.py:
- Exported all new ContextComponent subclasses
- Exported all ContextStrategy implementations
- Exported StrategyType
sdk/nexent/core/agents/nexent_agent.py:
- Added component registration after ContextManager mount
- Iterates context_components from AgentConfig and registers each
sdk/nexent/core/agents/core_agent.py:
- Modified SystemPromptStep creation to use component-based assembly
- Added fallback logic: components -> original system_prompt
backend/utils/context_utils.py (NEW):
- Added build_context_components() main function
- Added build_*_component() helpers for each type
- Added _format_*_description() helpers for text formatting
- Added build_app_context_string() for app metadata
backend/agents/create_agent_info.py:
- Imported build_context_components from context_utils
- Called build_context_components() with agent configuration
- Passed context_components to AgentConfig
test/sdk/core/agents/test_context_component.py (NEW):
- Added 66 tests for ContextComponent hierarchy
- Tests for each subclass creation, validation, to_messages()
- Tests for ContextStrategy implementations
test/sdk/core/agents/test_agent_context/unit/test_component_management.py (NEW):
- Added 29 tests for ContextManager component methods
- Tests for register, clear, get_registered, build_system_prompt
- Tests for strategy selection and budget calculation
test/sdk/core/agents/test_nexent_agent_component_integration.py (NEW):
- Added 9 integration tests for NexentAgent and CoreAgent
- Tests for component registration flow
- Tests for system prompt assembly with fallback
- Tests for backward compatibility
test/backend/utils/test_context_utils.py (NEW):
- Added 27 tests for context_utils helper functions
- Tests for format helpers and build helpers
- Tests for build_context_components main function
test/sdk/core/agents/test_agent_context/loader.py:
- Added _load_agent_model() for loading agent_model.py
- Exported all ContextComponent and ContextStrategy classes
test/sdk/core/agents/test_agent_context/stubs.py:
- Fixed register_smolagents_mocks() to always overwrite sys.modules
test/backend/agents/test_create_agent_info.py:
- Added _create_stub_component_class() helper
- Added component class stubs to agent_model mock setup
test/common/test_mocks.py:
- Removed unnecessary nexent.core.agents.agent_model mocking
* fix(db): add missing semicolon to is_new index in init.sql
Without the terminator, psql parses the CREATE INDEX and the following
CREATE TABLE as a single statement and aborts with a syntax error at
line 415, leaving 28 tables uncreated (including ag_prompt_template_t
and user_tenant_t). This breaks every backend service on a fresh DB.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* ♻️ refactor: route rendered system_prompt through build_context_components
build_context_components() now accepts an optional pre-rendered
``system_prompt``. When provided it returns a single SystemPromptComponent
carrying the Jinja2 output verbatim so ContextManager.build_system_prompt()
emits a system prompt byte-identical to what CoreAgent saw before the
context-management refactor. When omitted the function keeps its
piece-wise behaviour for future incremental componentization.
create_agent_info.py forwards the rendered string, completing the
behavior-preserving migration: ContextManager is now the single assembly
point without changing what the agent actually sees. Splitting the
rendered prompt into real semantic components (Tools / Skills / Memory /
KB) is deferred to a follow-up.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* 🧪 test: add prompt-equivalence golden test
Two golden tests guard the behavior-preserving migration of system prompt
assembly into ContextManager:
* test_system_prompt_component_roundtrip - wraps a Jinja2-rendered prompt
in a single SystemPromptComponent, registers it, runs
build_system_prompt() through ContextManager, joins role=system
messages and asserts byte-identical content. Verifies the component
machinery (register / strategy / dedup / role filter / join) is
loss-less. Parametrised over language (zh/en) and is_manager flag.
* test_full_build_context_components_matches_jinja2 - mirrors what
backend/agents/create_agent_info.py does in production: render Jinja2
then hand the rendered string to
build_context_components(system_prompt=...). Asserts the full
end-to-end output stays byte-identical to the Jinja2 baseline. If
this turns red the migration path itself has regressed.
Both run only on branches that have backend.utils.context_utils and the
new ContextComponent classes; the module-level skip keeps it inert on
older branches.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* 🔧 chore: log when a ContextStrategy drops a component
TokenBudgetStrategy / BufferedStrategy / PriorityWeightedStrategy used to
silently drop components that did not fit their selection criteria, which
made truncated system prompts impossible to diagnose at runtime. Each
strategy now emits a logger.warning identifying the component type,
priority, and which constraint tripped (total_budget vs type_budget vs
buffer overflow vs relevance threshold vs per-component token fit).
Behaviour for callers is unchanged - the selection results are identical;
only observability improves. FullStrategy is unaffected since it cannot
drop.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* ✨ feat(sdk): pass-through extra_body to chat.completions.create
ModelConfig.extra_body / OpenAIModel(extra_body=...) / NexentAgent.
create_model() forwarding is reintroduced so callers can supply
provider-specific knobs to every chat.completions.create payload — most
commonly Qwen3's chat_template_kwargs={"enable_thinking": false} to
suppress reasoning preludes.
Production safety: the field defaults to None on ModelConfig and the
runtime guard "if self.extra_body" gates the kwargs injection, so any
caller that does not opt in sees byte-identical request payloads.
Originally added on feature/agent-context-improvement-eval to support
the benchmark's thinking-off flag; missing on refactor/context-management
caused the flag to be silently dropped (Pydantic v2 default extra='ignore'
absorbed the kwarg, leaving </think> residues in benchmark model output).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* ✨ feat(sdk): pre-truncate long observations under ContextManager
Adds ContextManagerConfig.max_observation_length (chars; 0 = disabled,
the production default) and a corresponding head+tail truncation in
CoreAgent.execute_action that fires only when ContextManager is enabled
AND the observation exceeds the configured limit. A short marker tells
the agent the elision is recoverable via search/read tools.
Originally added on feature/agent-context-improvement-eval as commit
c992b48b "truncate model/tool output" by liudongfei. That commit also
accidentally enabled `import pdb; pdb.set_trace()` at line 294; this
back-port carries only the intended truncation logic.
Production safety:
- New field defaults to 0 (disabled). Existing callers see no behaviour
change unless they explicitly set it.
- Guarded by self.context_manager.config.enabled, so even setting the
field has no effect when ContextManager is off.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* ✨ feat(sdk): add benchmark instrumentation APIs on ContextManager
Back-ports three small additions from feature/agent-context-improvement-eval
that benchmarks depend on but were not part of the refactor:
* incremental_summary_system_prompt (commit 9aecd0f3 on feature):
Dedicated system prompt for incremental summary updates ("previous
summary + new turns -> updated summary"). compress_*_with_cache's
incremental paths now select this prompt via prompt_type='incremental'.
Falls back to summary_system_prompt when the field is empty so callers
that have not customised it still see a sensible default.
* ge…
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.
🐛 Bugfix: Fixed the issue of conversation history not being saved correctly. Fixes #2926
[Specification Detail]
[Test Result]