AI Dialog
The AI dialog feature allows you to interact intelligently with artificial intelligence, improving work efficiency.
Overview
The AI dialog sidebar is one of Chaterm's core features, providing users with powerful AI dialog capabilities. It supports multiple dialog modes, intelligent command execution, file upload, voice input, and other features, aimed at improving user terminal operation efficiency.
Architecture Design
Core Component Structure
src/renderer/src/views/components/AiTab/
├── index.vue # Main component
├── markdownRenderer.vue # Markdown renderer
├── voiceInput.vue # Voice input component
├── terminalOutputRenderer.vue # Terminal output renderer
├── components/
│ └── todo/
│ └── TodoInlineDisplay.vue # Todo display component
├── composables/
│ └── useTodo.ts # Todo functionality composable
├── types.ts # Type definitions
└── utils.ts # Utility functionsMain Features
1. Dialog Modes
The AI sidebar supports three dialog modes:
Chat Mode
Purpose: Pure text dialog, similar to ChatGPT
Features: Supports natural language communication, AI responds in text form
Use Cases: Q&A, concept explanation, code review, etc.
Command Mode
Purpose: Generate and execute terminal commands
Features: AI generates executable commands, users can choose to copy or execute directly
Use Cases: System management, file operations, development tasks, etc.
Agent Mode
Purpose: Intelligent agent that can execute complex multi-step tasks
Features: AI can autonomously execute commands and handle interactive commands
Use Cases: Automated tasks, complex workflows, etc.
2. Message System
Message Types
| Type | Description |
|---|---|
| User Message | User input content |
| Assistant Message | AI responses |
| Command Message | Generated command code |
| Output Message | Command execution results |
| Thinking Message | AI reasoning process (Thinking mode) |
3. Smart Features
File Upload
Supported Formats:
.txt,.md,.js,.ts,.py,.java,.cpp,.c,.html,.css,.json,.xml,.yaml,.yml,.sql,.sh,.bat,.ps1,.log,.csv,.tsv
Maximum File Size: 1MB
Smart Formatting: Automatically adds code block markers based on file type
Host Management
Auto Detection: Automatically detects currently connected terminal host
Manual Selection: Agent mode supports manual @ selection of target host
Multi-host Support: Agent mode supports multi-host operations
Connection Types: Supports personal connections and JumpServer connections
4. History Management
Feature Characteristics
Auto Save: All dialogs automatically saved locally
Search Function: Supports searching historical records by title
Favorites Function: Can favorite important dialogs
Pagination Loading: Supports paginated display of large amounts of historical records
Edit Title: Can customize dialog titles
Historical Record Operations
Restore Dialog: Click historical records to restore previous dialogs
Delete Records: Supports deleting unnecessary historical records
Favorites Management: Can add or remove favorite markers
5. Interactive Features
Command Operations
Approve Execution: Users can choose to approve AI-generated commands
Reject Operations: Can reject inappropriate commands
Copy Commands: Copy commands to clipboard
Direct Execution: Directly execute commands in Command mode
Option Processing
Single Choice Options: AI-provided option selection
Custom Input: Supports custom option input
Batch Operations: Supports batch selection and processing
Feedback System
Like/Dislike: Provide feedback on AI responses
Task Completion: Mark task completion status
Retry Mechanism: Supports retry after failure
Usage Methods
Basic Operations
1. Start Dialog
- Open Application: Open Chaterm application
- Open Sidebar: Click the AI icon on the right to open the sidebar
- Select Mode: Choose dialog mode (Chat/Command/Agent)
- Input Content: Enter questions or instructions in the input box
- Send Message: Press Enter or click send button
2. Host Selection
- Input Symbol: Type
@symbol in the input box - Select Host: Choose target host from dropdown list
- Search Navigation: Supports search and keyboard navigation
- Confirm Selection: Selected host will display as a tag
3. File Upload (Optional)
- Select File: Click upload icon to select file
- Auto Read: System automatically reads file content
- Code Block Display: Content added to input box as code block
- Edit Send: Can continue editing or send directly
Advanced Features
1. History Management
View History: Click history icon to view all dialogs
Search Records: Enter keywords in search box
Favorite Dialogs: Click star icon to favorite important dialogs
Edit Title: Click edit icon to modify dialog title
2. Command Execution
Command Mode: After generating commands, can choose to copy or execute
Agent Mode: AI automatically executes commands and handles interaction
Local Execution: Supports executing commands on local host
Remote Execution: Supports executing commands on remote host
3. Code Processing
Syntax Highlighting: Code automatically applies syntax highlighting
Code Folding: Long code automatically folds
Copy Code: Click copy icon to copy code
Formatting: Supports intelligent recognition of multiple code formats
Configuration Options
Model Configuration
API Providers: Supports OpenAI, DeepSeek, LiteLLM, AWS Bedrock, etc.
Model Selection: Can choose different AI models
Parameter Adjustment: Supports temperature, max tokens, and other parameter settings
Feature Switches
Auto Execution: Can configure automatic execution strategy for commands
Best Practices
1. Dialog Tips
Clear Instructions: Provide clear, specific instructions
Context Maintenance: Maintain context coherence within the same dialog
Step-by-step Execution: For complex tasks, can execute step by step
2. Command Usage
Command Mode: Suitable for generating single commands or simple scripts
Agent Mode: Suitable for complex multi-step tasks
Security Check: Carefully check content before executing commands
3. File Processing
File Size: Pay attention to file size limits (1MB)
Format Selection: Choose appropriate file format for upload
Content Cleanup: Clean sensitive information before upload
4. History Management
Regular Cleanup: Regularly delete unnecessary historical records
Important Favorites: Add important dialogs to favorites
Title Naming: Use meaningful titles for easy searching
Troubleshooting
Common Issues
1. Dialog stuck in processing state for a long time
Session Connection: Can click new dialog to restart dialog operations
2. Command execution failure
Permission Check: Ensure you have permission to execute commands
Host Connection: Check target host connection status
Command Syntax: Verify command syntax is correct