Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// AIProvider 决定使用哪个 AI 客户端 ("openai", "gemini", "openrouter")
AIProvider string `mapstructure:"ai_provider"`
// Proxy 是用于 AI 请求的网络代理
Proxy string `mapstructure:"proxy"`
// Silent 静默模式,如果为 true,则 ai-commit commit 命令将直接提交
Silent bool `mapstructure:"silent"`
// ExcludeFileSuffix 是需要从 git diff 中排除的文件后缀
ExcludeFileSuffix []string `mapstructure:"exclude_file_suffix"`
// DEBUG 是否启用调试模式
DEBUG bool `mapstructure:"debug"`
// PromptTemplate 是发送给 AI 的提示词
PromptTemplate string `mapstructure:"prompt_template"`
// EnableEmoji 控制是否在 commit message 中添加 emoji
EnableEmoji bool `mapstructure:"enable_emoji"`
// EmojiMapping 定义了 scope 和 emoji 之间的映射
EmojiMapping map[string]string `mapstructure:"emoji_mapping"`
// 各个 AI 服务的配置
OpenAI OpenAIConfig `mapstructure:"openai"`
Gemini GeminiConfig `mapstructure:"gemini"`
OpenRouter OpenRouterConfig `mapstructure:"openrouter"`
}
Config 是配置的根结构
var AppConfig Config
AppConfig 保存所有应用程序的配置。 它是全局可访问的(在 InitConfig 之后)。
type GeminiConfig ¶
type GeminiConfig struct {
APIKey string `mapstructure:"api_key"`
Model string `mapstructure:"model"`
}
GeminiConfig 保存 Gemini 特定的配置
type OpenAIConfig ¶
type OpenAIConfig struct {
APIKey string `mapstructure:"api_key"`
Model string `mapstructure:"model"`
BaseURL string `mapstructure:"base_url"` // 用于代理或兼容 API
}
OpenAIConfig 保存 OpenAI 特定的配置
Click to show internal directories.
Click to hide internal directories.