|
| 1 | +# MGit Copilot Configuration Example |
| 2 | + |
| 3 | +This file shows example configuration for the Copilot feature. |
| 4 | + |
| 5 | +## Configuration Location |
| 6 | + |
| 7 | +The copilot configuration is stored in MGit's config file (managed by ConfigManager). |
| 8 | +Typically located at: `~/.config/mgit/config.json` or similar location depending on your OS. |
| 9 | + |
| 10 | +## Configuration Keys |
| 11 | + |
| 12 | +```json |
| 13 | +{ |
| 14 | + "copilot": { |
| 15 | + "enabled": true, |
| 16 | + "api_key": "your-siliconflow-api-key-here", |
| 17 | + "model": "Qwen/Qwen2.5-7B-Instruct" |
| 18 | + } |
| 19 | +} |
| 20 | +``` |
| 21 | + |
| 22 | +## Available Models |
| 23 | + |
| 24 | +You can use any of these models with SiliconFlow: |
| 25 | + |
| 26 | +### Qwen Series (Recommended) |
| 27 | +- `Qwen/Qwen2.5-7B-Instruct` - Best balance of speed and quality (default) |
| 28 | +- `Qwen/Qwen2.5-14B-Instruct` - Higher quality, slightly slower |
| 29 | +- `Qwen/Qwen2.5-32B-Instruct` - Highest quality, slower |
| 30 | + |
| 31 | +### DeepSeek |
| 32 | +- `deepseek-ai/DeepSeek-V2.5` - Strong reasoning, good for technical content |
| 33 | + |
| 34 | +### Meta LLaMA |
| 35 | +- `meta-llama/Meta-Llama-3.1-8B-Instruct` - Open source alternative |
| 36 | + |
| 37 | +## Getting API Key |
| 38 | + |
| 39 | +1. Visit https://siliconflow.cn |
| 40 | +2. Register or login to your account |
| 41 | +3. Navigate to API Keys section |
| 42 | +4. Create a new API key |
| 43 | +5. Copy the key to Copilot settings in MGit |
| 44 | + |
| 45 | +## Configuration via UI |
| 46 | + |
| 47 | +The recommended way to configure Copilot is through the UI: |
| 48 | + |
| 49 | +1. Open MGit |
| 50 | +2. Go to menu: `Copilot > Copilot设置` |
| 51 | +3. Enter your API key |
| 52 | +4. Select your preferred model |
| 53 | +5. Check "启用 Copilot" |
| 54 | +6. Click "测试连接" to verify |
| 55 | +7. Click "保存" |
| 56 | + |
| 57 | +## Security Notes |
| 58 | + |
| 59 | +- API keys are stored in local configuration file |
| 60 | +- Never commit configuration files with API keys to git |
| 61 | +- Use environment variables for CI/CD if needed |
| 62 | +- Keys are encrypted in configuration storage |
| 63 | + |
| 64 | +## Environment Variables (Optional) |
| 65 | + |
| 66 | +You can also set API key via environment variable: |
| 67 | + |
| 68 | +```bash |
| 69 | +export SILICONFLOW_API_KEY="your-api-key-here" |
| 70 | +``` |
| 71 | + |
| 72 | +Note: UI configuration takes precedence over environment variables. |
| 73 | + |
| 74 | +## Troubleshooting |
| 75 | + |
| 76 | +### API Key Not Working |
| 77 | +- Verify key is correct (no extra spaces) |
| 78 | +- Check account balance on SiliconFlow |
| 79 | +- Ensure network connectivity |
| 80 | +- Try "测试连接" in settings dialog |
| 81 | + |
| 82 | +### Model Not Available |
| 83 | +- Some models may require specific API tier |
| 84 | +- Check SiliconFlow documentation for model availability |
| 85 | +- Try using default model first |
| 86 | + |
| 87 | +### Connection Timeout |
| 88 | +- Check internet connection |
| 89 | +- Verify firewall settings |
| 90 | +- Try increasing timeout in code if needed |
| 91 | + |
| 92 | +## Advanced Configuration |
| 93 | + |
| 94 | +For advanced users, you can modify additional parameters by editing the source code: |
| 95 | + |
| 96 | +- `temperature`: Controls randomness (0.0-1.0), in copilot_manager.py |
| 97 | +- `max_tokens`: Maximum output length, in copilot_manager.py |
| 98 | +- API timeout: In siliconflow_client.py |
| 99 | + |
| 100 | +## Rate Limits |
| 101 | + |
| 102 | +Be aware of SiliconFlow API rate limits: |
| 103 | +- Free tier: Limited requests per minute |
| 104 | +- Paid tiers: Higher limits |
| 105 | + |
| 106 | +Check your plan at https://siliconflow.cn |
| 107 | + |
| 108 | +## Support |
| 109 | + |
| 110 | +For issues or questions: |
| 111 | +- Check the [Copilot Guide](./copilot_guide.md) |
| 112 | +- Submit GitHub issue |
| 113 | +- Contact SiliconFlow support for API issues |
0 commit comments