增加ai配置
This commit is contained in:
@@ -125,3 +125,10 @@ alarm_notification:
|
|||||||
dpanic: 1
|
dpanic: 1
|
||||||
panic: 1
|
panic: 1
|
||||||
fatal: 1
|
fatal: 1
|
||||||
|
|
||||||
|
# AI 服务配置
|
||||||
|
ai:
|
||||||
|
gemini:
|
||||||
|
api_key: "YOUR_GEMINI_API_KEY" # 替换为你的 Gemini API Key
|
||||||
|
model_name: "gemini-2.5-flash" # Gemini 模型名称,例如 "gemini-pro"
|
||||||
|
timeout: 30 # AI 请求超时时间 (秒)
|
||||||
@@ -103,3 +103,10 @@ alarm_notification:
|
|||||||
dpanic: 1
|
dpanic: 1
|
||||||
panic: 1
|
panic: 1
|
||||||
fatal: 1
|
fatal: 1
|
||||||
|
|
||||||
|
# AI 服务配置
|
||||||
|
ai:
|
||||||
|
gemini:
|
||||||
|
api_key: "AIzaSyAJdXUmoN07LIswDac6YxPeRnvXlR73OO8" # 替换为你的 Gemini API Key
|
||||||
|
model_name: "gemini-2.5-flash" # Gemini 模型名称,例如 "gemini-pro"
|
||||||
|
timeout: 30 # AI 请求超时时间 (秒)
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ type Config struct {
|
|||||||
|
|
||||||
// AlarmNotification 告警通知配置
|
// AlarmNotification 告警通知配置
|
||||||
AlarmNotification AlarmNotificationConfig `yaml:"alarm_notification"`
|
AlarmNotification AlarmNotificationConfig `yaml:"alarm_notification"`
|
||||||
|
|
||||||
|
// AI AI服务配置
|
||||||
|
AI AIConfig `yaml:"ai"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppConfig 代表应用基础配置
|
// AppConfig 代表应用基础配置
|
||||||
@@ -231,6 +234,15 @@ type AlarmNotificationConfig struct {
|
|||||||
NotificationIntervals NotificationIntervalsConfig `yaml:"notification_intervals"`
|
NotificationIntervals NotificationIntervalsConfig `yaml:"notification_intervals"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AIConfig AI 服务配置
|
||||||
|
type AIConfig struct {
|
||||||
|
Gemini struct {
|
||||||
|
APIKey string `yaml:"api_key"` // Gemini API Key
|
||||||
|
ModelName string `yaml:"model_name"` // Gemini 模型名称,例如 "gemini-pro"
|
||||||
|
Timeout int `yaml:"timeout"` // AI 请求超时时间 (秒)
|
||||||
|
} `yaml:"gemini"`
|
||||||
|
}
|
||||||
|
|
||||||
// NewConfig 创建并返回一个新的配置实例
|
// NewConfig 创建并返回一个新的配置实例
|
||||||
func NewConfig() *Config {
|
func NewConfig() *Config {
|
||||||
// 默认值可以在这里设置,但我们优先使用配置文件中的值
|
// 默认值可以在这里设置,但我们优先使用配置文件中的值
|
||||||
|
|||||||
Reference in New Issue
Block a user