-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.go
50 lines (40 loc) · 994 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"github.com/spf13/viper"
"strconv"
)
func getGitUsernameConf() string {
return viper.GetString("git.username")
}
func getReportModeConf() string {
return viper.GetString("report.mode")
}
func getGitReposConf() []string {
return viper.GetStringSlice("git.repo")
}
func getReportIntervalDayConf() int {
return viper.GetInt("report.intervalDay")
}
func getReportOutConf() string {
return viper.GetString("report.out")
}
func getReportLangConf() string {
return viper.GetString("report.lang")
}
func getReportFlowConf() bool {
return viper.GetBool("report.flow")
}
func getAiConf() AiConfig {
usedAi := getUseAiConf()
m := viper.GetStringMapString("ai." + usedAi)
maxInputTokens, _ := strconv.ParseUint(m["maxinputtokens"], 10, 32)
return AiConfig{
Model: m["model"],
BaseUrl: m["baseurl"],
ApiKey: m["apikey"],
MaxInputTokens: uint32(maxInputTokens),
}
}
func getUseAiConf() string {
return viper.GetString("useAi")
}