File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed
Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 11# 飞书
2+ BASE_URL : https://open.feishu.cn
23APP_ID : cli_axxx
34APP_SECRET : xxx
45APP_ENCRYPT_KEY : xxx
Original file line number Diff line number Diff line change @@ -2,18 +2,20 @@ package initialization
22
33import (
44 "fmt"
5- "github.com/spf13/pflag"
65 "os"
76 "strconv"
87 "strings"
98 "sync"
109
10+ "github.com/spf13/pflag"
11+
1112 "github.com/spf13/viper"
1213)
1314
1415type Config struct {
1516 // 表示配置是否已经被初始化了。
1617 Initialized bool
18+ FeishuBaseUrl string
1719 FeishuAppId string
1820 FeishuAppSecret string
1921 FeishuAppEncryptKey string
@@ -64,6 +66,7 @@ func LoadConfig(cfg string) *Config {
6466 //fmt.Println(string(content))
6567
6668 config := & Config {
69+ FeishuBaseUrl : getViperStringValue ("BASE_URL" , "" ),
6770 FeishuAppId : getViperStringValue ("APP_ID" , "" ),
6871 FeishuAppSecret : getViperStringValue ("APP_SECRET" , "" ),
6972 FeishuAppEncryptKey : getViperStringValue ("APP_ENCRYPT_KEY" , "" ),
@@ -163,7 +166,7 @@ func filterFormatKey(keys []string) []string {
163166 var result []string
164167 for _ , key := range keys {
165168 if strings .HasPrefix (key , "sk-" ) || strings .HasPrefix (key ,
166- "fk" ) {
169+ "fk" ) || strings . HasPrefix ( key , "fastgpt" ) {
167170 result = append (result , key )
168171 }
169172 }
Original file line number Diff line number Diff line change @@ -8,9 +8,14 @@ import (
88var larkClient * lark.Client
99
1010func LoadLarkClient (config Config ) {
11+ options := []lark.ClientOptionFunc {
12+ lark .WithLogLevel (larkcore .LogLevelDebug ),
13+ }
14+ if config .FeishuBaseUrl != "" {
15+ options = append (options , lark .WithOpenBaseUrl (config .FeishuBaseUrl ))
16+ }
1117
12- option := lark .WithLogLevel (larkcore .LogLevelDebug )
13- larkClient = lark .NewClient (config .FeishuAppId , config .FeishuAppSecret , option )
18+ larkClient = lark .NewClient (config .FeishuAppId , config .FeishuAppSecret , options ... )
1419
1520}
1621
You can’t perform that action at this time.
0 commit comments