✨ Feat: Allow setting agent as main agent via configuration#3461
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an is_main_agent flag for tenant agents, allowing the frontend to configure whether an agent is treated as a “main agent” (defaulting to true). It spans database schema, backend models/service logic, and frontend types/state/UI (including a new “Advanced Settings” modal).
Changes:
- Add
is_main_agentcolumn toag_tenant_agent_twithNOT NULL DEFAULT TRUE, plus baseline schema + migration. - Plumb
is_main_agentthrough backend Pydantic models and agent create/export/import/update flows. - Update frontend typing, store defaults/dirty-checking, save payloads, and introduce an Advanced Settings modal with i18n strings.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
test/backend/database/test_agent_db.py |
Updates test fixture defaults to include is_main_agent = True. |
frontend/types/agentConfig.ts |
Adds is_main_agent to agent types and update payload typing. |
frontend/stores/agentConfigStore.ts |
Adds defaulting, mapping, and dirty-check logic for is_main_agent. |
frontend/services/agentConfigService.ts |
Adds is_main_agent to update payload + response mapping default. |
frontend/public/locales/zh/common.json |
Adds zh translations for “Advanced Settings” and “Main Agent” flag. |
frontend/public/locales/en/common.json |
Adds en translations for “Advanced Settings” and “Main Agent” flag. |
frontend/hooks/agent/useSaveGuard.ts |
Includes is_main_agent in save/update request payload. |
frontend/app/[locale]/agents/components/AgentSelectorHeader.tsx |
Includes is_main_agent when copying/creating agents from detail. |
frontend/app/[locale]/agents/components/agentManage/AgentList.tsx |
Includes is_main_agent when copying/creating agents from list. |
frontend/app/[locale]/agents/components/agentInfo/AgentGenerateDetail.tsx |
Adds Advanced Settings modal UI and wires is_main_agent into the edit flow. |
deploy/sql/migrations/v2.4.0_0720_add_agent_is_main_agent.sql |
Adds migration to introduce is_main_agent with default TRUE. |
deploy/sql/init.sql |
Updates baseline schema to include is_main_agent + column comment. |
backend/services/agent_service.py |
Includes is_main_agent in create/update/export/import agent payloads. |
backend/database/db_models.py |
Adds ORM column is_main_agent with default True, non-nullable. |
backend/database/agent_db.py |
Ensures is_main_agent defaults on create and is returned in create response. |
backend/consts/model.py |
Adds is_main_agent to AgentInfoRequest and export/import model. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
新增高级设置
默认为主智能体