配置指南
MyDeskBot 桌面应用提供了丰富的配置选项,让您可以根据个人需求定制 AI 助手的行为。
目录
配置文件位置
macOS
~/Library/Application Support/MyDeskBot/config.jsonWindows
%APPDATA%\MyDeskBot\config.jsonLinux
~/.config/MyDeskBot/config.json基础配置
最低配置示例
json
{
"api_key": "sk-...",
"model": "gpt-4",
"language": "zh-CN"
}完整配置示例
json
{
"api_key": "sk-...",
"api_base": "https://api.openai.com/v1",
"model": "gpt-4",
"language": "zh-CN",
"theme": "dark",
"proxy": {
"enabled": true,
"host": "127.0.0.1",
"port": 7890
},
"security": {
"store_api_key": true,
"enable_encryption": true
}
}API 配置
OpenAI API
json
{
"api_key": "sk-your-api-key-here",
"api_base": "https://api.openai.com/v1",
"model": "gpt-4"
}Anthropic Claude API
json
{
"api_key": "sk-ant-your-api-key-here",
"api_base": "https://api.anthropic.com/v1",
"model": "claude-3-opus-20240229"
}自定义 API 端点
json
{
"api_key": "your-custom-api-key",
"api_base": "https://your-api-endpoint.com/v1",
"model": "custom-model-name"
}模型配置
模型选择
支持多种 AI 模型:
| 模型 | 描述 | 适用场景 |
|---|---|---|
gpt-4 | 最强大的模型 | 复杂任务、代码生成 |
gpt-4-turbo | 平衡性能与成本 | 日常开发、分析 |
gpt-3.5-turbo | 快速响应 | 简单查询、补全 |
claude-3-opus | 超长上下文 | 长文档分析 |
claude-3-sonnet | 平衡选择 | 多场景通用 |
高级模型参数
json
{
"model": "gpt-4",
"model_params": {
"temperature": 0.7,
"max_tokens": 4096,
"top_p": 1.0,
"frequency_penalty": 0,
"presence_penalty": 0
}
}参数说明
temperature (0.0-2.0): 控制输出随机性
0.0: 更确定、更可预测1.0: 默认值2.0: 更随机、更有创意
max_tokens: 最大响应 token 数
- 代码生成:
2048-4096 - 简单问答:
512-1024
- 代码生成:
top_p (0.0-1.0): 核采样
0.1: 更聚焦1.0: 考虑所有 token
代理设置
HTTP 代理
json
{
"proxy": {
"enabled": true,
"type": "http",
"host": "127.0.0.1",
"port": 7890,
"username": null,
"password": null
}
}SOCKS5 代理
json
{
"proxy": {
"enabled": true,
"type": "socks5",
"host": "127.0.0.1",
"port": 1080,
"username": "user",
"password": "pass"
}
}环境变量代理
也可以通过环境变量配置代理:
bash
export HTTP_PROXY=http://127.0.0.1:7890
export HTTPS_PROXY=http://127.0.0.1:7890
export ALL_PROXY=socks5://127.0.0.1:1080界面配置
主题设置
json
{
"theme": "dark",
"theme_options": {
"accent_color": "#3b82f6",
"font_size": 14,
"code_font_size": 13,
"line_height": 1.6
}
}可用主题
light: 浅色主题dark: 深色主题(推荐)auto: 跟随系统
窗口设置
json
{
"window": {
"remember_position": true,
"always_on_top": false,
"show_in_tray": true,
"minimize_to_tray": false
}
}编辑器设置
json
{
"editor": {
"tab_size": 2,
"insert_spaces": true,
"word_wrap": true,
"show_line_numbers": true,
"auto_save": true
}
}快捷键配置
自定义快捷键
json
{
"shortcuts": {
"toggle_panel": "CmdOrCtrl+Shift+M",
"new_chat": "CmdOrCtrl+N",
"clear_chat": "CmdOrCtrl+L",
"copy_code": "CmdOrCtrl+Shift+C",
"send_message": "CmdOrCtrl+Enter"
}
}平台特定快捷键
macOS
json
{
"shortcuts": {
"toggle_panel": "Cmd+Shift+M",
"new_chat": "Cmd+N",
"send_message": "Cmd+Enter"
}
}Windows/Linux
json
{
"shortcuts": {
"toggle_panel": "Ctrl+Shift+M",
"new_chat": "Ctrl+N",
"send_message": "Ctrl+Enter"
}
}安全配置
API 密钥加密
json
{
"security": {
"store_api_key": true,
"enable_encryption": true,
"encryption_key": null // 自动生成或自定义
}
}会话历史
json
{
"history": {
"enabled": true,
"max_entries": 100,
"persist_to_disk": true,
"auto_cleanup": true,
"cleanup_days": 30
}
}隐私设置
json
{
"privacy": {
"anonymous_usage_stats": true,
"crash_reports": true,
"share_code_snippets": false
}
}插件配置
启用插件
json
{
"plugins": {
"enabled": true,
"plugin_dir": "~/.mydeskbot/plugins",
"auto_load": ["code-runner", "database-client"]
}
}插件特定配置
json
{
"plugins_config": {
"code-runner": {
"language": "typescript",
"timeout": 5000
},
"database-client": {
"default_connection": "localhost:5432"
}
}
}高级配置
日志配置
json
{
"logging": {
"level": "info",
"file": "~/logs/mydeskbot.log",
"max_size": "10MB",
"max_files": 5,
"console": true
}
}日志级别
debug: 详细调试信息info: 一般信息(推荐)warn: 警告信息error: 仅错误信息
性能配置
json
{
"performance": {
"streaming_enabled": true,
"cache_enabled": true,
"cache_size_mb": 512,
"parallel_requests": 3
}
}网络配置
json
{
"network": {
"timeout_ms": 30000,
"retry_attempts": 3,
"retry_delay_ms": 1000,
"keep_alive": true
}
}配置验证
配置文件会在启动时自动验证。如果配置有误,应用会:
- 显示错误信息
- 使用默认配置
- 生成备份配置文件
验证配置
使用命令行工具验证配置:
bash
mydeskbot config validate查看当前配置
bash
mydeskbot config show故障排除
配置不生效
- 检查配置文件路径是否正确
- 验证 JSON 格式是否有效
- 重启应用
- 查看日志文件
常见配置错误
JSON 语法错误
json
// 错误:缺少逗号
{
"api_key": "sk-..."
"model": "gpt-4"
}
// 正确
{
"api_key": "sk-...",
"model": "gpt-4"
}模型名称错误
json
// 错误
{
"model": "gpt-5" // 不存在的模型
}
// 正确
{
"model": "gpt-4"
}重置配置
重置为默认配置:
bash
mydeskbot config reset备份当前配置后重置:
bash
mydeskbot config reset --backup下一步
获取帮助
遇到配置问题?
- 查看 故障排除指南
- 访问 社区论坛
- 提交 GitHub Issue