Skip to content

Commit

Permalink
Merge 7f4da6f into 4e2534a
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoshinonyaruko authored Jun 6, 2024
2 parents 4e2534a + 7f4da6f commit a11ef76
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 13 additions & 7 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3024,13 +3024,15 @@ func GetYuanqiConf(options ...string) (string, string) {

// getYuanqiConfInternal 内部递归函数,处理配置获取逻辑
func getYuanqiConfInternal(options ...string) (string, string) {
// 从instance中读取配置数组
if instance != nil && len(instance.Settings.Yuanqiconfs) > 0 {
if len(options) == 0 || options[0] == "" {
if len(options) == 0 || options[0] == "" {
// 从instance中读取配置数组
if instance != nil && len(instance.Settings.Yuanqiconfs) > 0 {
// 从instance全局变量中随机选择一个配置
index := rand.Intn(len(instance.Settings.Yuanqiconfs))
conf := instance.Settings.Yuanqiconfs[index]
return conf.YuanqiAssistantID, conf.YuanqiToken
} else {
return "", ""
}
}

Expand Down Expand Up @@ -3070,9 +3072,11 @@ func GetReplacementPairsIn(options ...string) []structs.ReplacementPair {
// getReplacementPairsInInternal 内部递归函数,处理配置获取逻辑
func getReplacementPairsInInternal(options ...string) []structs.ReplacementPair {
// 从instance中读取配置数组
if instance != nil && len(instance.Settings.ReplacementPairsIn) > 0 {
if len(options) == 0 || options[0] == "" {
if len(options) == 0 || options[0] == "" {
if instance != nil && len(instance.Settings.ReplacementPairsIn) > 0 {
return instance.Settings.ReplacementPairsIn
} else {
return nil
}
}

Expand Down Expand Up @@ -3109,9 +3113,11 @@ func GetReplacementPairsOut(options ...string) []structs.ReplacementPair {
// getReplacementPairsInOutternal 内部递归函数,处理配置获取逻辑
func getReplacementPairsOutInternal(options ...string) []structs.ReplacementPair {
// 从instance中读取配置数组
if instance != nil && len(instance.Settings.ReplacementPairsOut) > 0 {
if len(options) == 0 || options[0] == "" {
if len(options) == 0 || options[0] == "" {
if instance != nil && len(instance.Settings.ReplacementPairsOut) > 0 {
return instance.Settings.ReplacementPairsOut
} else {
return nil
}
}

Expand Down
2 changes: 0 additions & 2 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -1504,8 +1504,6 @@ func ReplaceTextIn(text string, promptstr string) string {
// 调用 GetReplacementPairsIn 函数获取替换对列表
replacementPairs := config.GetReplacementPairsIn(promptstr)

fmt.Printf("测试测试:%+v,%v", replacementPairs, promptstr)

if len(replacementPairs) == 0 {
return text
}
Expand Down

0 comments on commit a11ef76

Please sign in to comment.