AionUi icon indicating copy to clipboard operation
AionUi copied to clipboard

feat: add custom agent management UI and model selection

Open WeekendSuperhero opened this issue 2 weeks ago • 2 comments

Pull Request

Description

This PR adds comprehensive custom agent management capabilities and model selection features to AionUi:

🎯 Main Features

  1. Custom Agent Settings Page: Added dedicated "Agent" section in Settings sidebar with custom ACP agent management
  2. Model Selection for Custom Agents: Users can now view and select models before starting conversations with custom agents
  3. Agent Metadata Fetching: Fetches available models, capabilities, and auth methods from custom ACP agents
  4. Model Display in Chat: Shows selected model name in chat header during active conversations

📝 Detailed Changes

Custom Agent Management

  • Settings UI: Added "Agent" tab to settings sidebar (src/renderer/pages/settings/SettingsSider.tsx)
  • Agent Modal Enhancements: Improved custom agent configuration modal with:
    • "Fetch Models & Meta" button to retrieve agent capabilities
    • Model selection dropdown showing available models with token limits
    • Auto-population of models in advanced JSON configuration
    • Better error handling and loading states

Model Selection Flow

  • Guide Page:
    • Fetches agent metadata when custom agent is selected
    • Displays model dropdown with available models
    • Auto-selects agent's default model, user can change before starting chat
    • Send button disabled until model is selected for custom agents
  • Chat Page:
    • Displays selected model name in header (read-only)
    • Model info persisted in conversation metadata

Backend Infrastructure

  • ACP Connection:

    • Added modelId parameter to newSession() method
    • Added parseAcpMeta() method to extract models and capabilities from ACP responses
    • Added public cleanup() method for proper resource cleanup
    • Fixed --experimental-acp argument handling (no longer added by default for custom agents)
  • Bridge Layer:

    • Added fetchAgentMeta IPC method to retrieve agent metadata via temporary connection
    • Enhanced conversation creation to include selectedModel parameter
  • Type Definitions:

    • Added ModelInfo interface for model metadata
    • Added AcpMeta interface for agent capabilities
    • Added selectedModel to ACP conversation type

Bug Fixes

  • Fixed custom agent argument handling (respects agent-specific ACP args)
  • Fixed metadata parsing to use initialize response instead of session response
  • Fixed conversation object creation to preserve selectedModel
  • Fixed ESLint configuration (removed invalid eslint/config import)
  • Fixed import duplicates and empty catch blocks

Files Changed (13 files, +287 -27)

Core Files

  • src/agent/acp/AcpConnection.ts - Model ID parameter, metadata parsing, cleanup method
  • src/agent/acp/index.ts - Pass selectedModel through session creation
  • src/common/ipcBridge.ts - New fetchAgentMeta bridge method
  • src/common/storage.ts - Added selectedModel to conversation type
  • src/process/bridge/acpConversationBridge.ts - Metadata fetching implementation
  • src/process/initAgent.ts - Preserve selectedModel in conversation creation

UI Files

  • src/renderer/pages/guid/index.tsx - Model selection on guide page
  • src/renderer/pages/conversation/ChatLayout.tsx - Model display in chat header
  • src/renderer/pages/conversation/ChatConversation.tsx - Pass model to layout
  • src/renderer/pages/settings/CustomAcpAgent/CustomAcpAgentModal.tsx - Enhanced agent config UI
  • src/renderer/pages/settings/SettingsSider.tsx - Added Agent settings tab

Type Files

  • src/types/acpTypes.ts - New ModelInfo and AcpMeta interfaces
  • src/renderer/i18n/locales/en-US.json - Translation for "Fetch Models & Meta"

Related Issues

Enables better custom agent management and model selection for ACP agents

Type of Change

  • [x] New feature (non-breaking change which adds functionality)
  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Documentation update

Testing

  • [x] Tested on macOS
  • [ ] Tested on Windows
  • [ ] Tested on Linux
  • [x] My code follows the project's code style guidelines
  • [x] I have performed a self-review of my own code
  • [x] My changes generate no new warnings or errors

Screenshots

Custom agent settings page with model selection and metadata fetching. Model dropdown on guide page. Selected model displayed in chat header.

Additional Context

This PR significantly improves the custom agent experience by:

  • Making custom agents visible and manageable in Settings UI
  • Allowing users to choose optimal models for their tasks
  • Providing transparency about which model is being used
  • Supporting agents with multiple model options (like copilot-cli, custom OpenAI endpoints, etc.)

Thank you for contributing to AionUi! 🎉

WeekendSuperhero avatar Dec 29 '25 10:12 WeekendSuperhero